MovePlayer
From the Scripting Manual
procedure MovePlayer(ID: byte; X, Y: single); Parameter Info: ID (Byte): Player ID of the target to be moved elsewhere. X (Single): X coordinate to be moved to. Y (Single): Y coordinate to be moved to. Description: This function will move player(ID) to the specified location (X/Y) instantly. NOTE: This function will NOT work on bots - only players.
Examples
var
Temp1, Temp2: string;
BlueFlagX, BlueFlagY, RedFlagX, RedFlagY: single;
begin
// This function is Copyright© Nick Cooper - It is displayed here for illustration purposes ONLY
// (Code taken from my multi-server script seen @ [eC] Trenchwars/Dodgeball/Climb)
if Copy(uppercase(Text), 1, 6) = '/MOVE ' then begin
try // Usage: /move PlayerToMove TargetPlayer (or red/blue for flags)
Temp1 := GetPiece(Text, ' ', 2); // Player to be moved
Temp2 := GetPiece(Text, ' ', 3); // "PlayerToMove" will be moved to this player's position
if (Temp2 = 'red') or (Temp2 = 'blue') then begin
// If "TargetPlayer" is set to red/blue, "PlayerToMove" will be moved to the red/blue flag instead
if GetPlayerStat(strtoint(Temp1), 'active') = true then begin
GetFlagsSpawnXY(BlueFlagX, BlueFlagY, RedFlagX, RedFlagY);
WriteConsole(0, GetPlayerStat(strtoint(Temp1), 'name') + ' has been moved by ' + GetPlayerStat(ID, 'name'), RGB(255, 255, 255));
// Player will now be moved to the red/blue flag!
MovePlayer(strtoint(Temp1), iif(Temp2 = 'red', RedFlagX, BlueFlagX), iif(Temp2 = 'red', RedFlagY, BlueFlagY));
end;
end else
if (GetPlayerStat(strtoint(Temp1), 'active') = true) and (GetPlayerStat(strtoint(Temp2), 'active') = true) then begin
WriteConsole(0, GetPlayerStat(strtoint(Temp1), 'name') + ' has been moved by ' + GetPlayerStat(ID, 'name'), RGB(255, 255, 255));
// Player will now be moved to the other player
MovePlayer(strtoint(Temp1), GetPlayerStat(strtoint(Temp2), 'x'), GetPlayerStat(strtoint(Temp2), 'y'));
end;
except
// If theres an error with the admin's input, it wont show any errors. Just ignores the command.
end;
end;
end;
// ph33r my skillz0r -EnEsCe