Author Topic: Map Teleporters  (Read 1466 times)

0 Members and 1 Guest are viewing this topic.

Offline freestyler

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 326
Map Teleporters
« on: June 22, 2008, 09:20:31 am »
Script name: Map Teleporters (I couldn't think of anything better...)
Script description: Allows you to make your own teleporters in any map. Everything is loaded from ...\maps\map_name.ini. More information on this image (also included in zip file).
Original author: fri
Core version: 2.6.3
Code: (one of procedures)
Code: [Select]
procedure CheckTeleporters;
  var
    playerX, playerY: array[1..32] of single;
    i, j: byte;
  begin
    for i := 1 to MaxID do begin
      GetPlayerXY(i, playerX[i], playerY[i]);
      for j := 1 to NumTele do begin
        if (GetPlayerStat(i, 'Active') = true) and (playerX[i] <= Tele[j].maxX) and (playerX[i] >= Tele[j].minX) and (playerY[i] <= Tele[j].maxY) and (playerY[i] >= Tele[j].minY) and (playerCool[i] = 0) and ((GetPlayerStat(i, 'Team') = Tele[j].Team) or (Tele[j].Team = 0)) and (Tele[j].Target <> 0) then
        // above: checking position, cooldown, team and target // below: checking if player needs to stand still to teleport
        if (((StandStill = 1) and (GetPlayerStat(i, 'VelX') = 0) and (GetPlayerStat(i, 'VelY') = 0)) or (StandStill = 0)) then begin
          MovePlayer(i, (Tele[Tele[j].Target].maxX + Tele[Tele[j].Target].minX)/2, (Tele[Tele[j].Target].maxY + Tele[Tele[j].Target].minY)/2);
          playerCool[i] := Cooldown; // adds a cooldown to prevent teleporting back too early
        end;
      end;
    end;
  end;

Additional information: Script fails to load settings of the first map after server start. This will be fixed in next SoldatServer version (OnMapChange will be called after ActivateServer). You can simply change map or use /reload command to fix it.
Maps contains settings for [ ctf_Ash ] and [ Cambodia ].

Commands:
(admin) /pos - displays your XY (useful for making your own teleporters)
(admin) /reload - reloads current map's INI file
« Last Edit: May 10, 2014, 12:40:08 pm by freestyler »

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Map Teleporters
« Reply #1 on: June 23, 2008, 07:36:39 am »
Nice script , thx!