14.02.2013, 13:16
Quote:
Hi, I'm looking for the command /teleportto [id] to teleport to a player being rcon logged in. Please don't use scanff, thank you.
|
pawn Code:
CMD:teleportto(playerid, params[])
{
if( !IsPlayerAdmin( playerid ))
return SendClientMessage( playerid, 0xFF0000FF, "[ERROR] Only RCON admins can use this command." );
if( isnull( params ))
return SendClientMessage( playerid, 0xFFFF00FF, "[USAGE] /teleport [target id] - teleports you to the player." );
new
iTarget = strval( params ),
Float: fPos[ 3 ]
;
GetPlayerPos( iTarget, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SetPlayerPos( playerid, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SendClientMessage( playerid, 0x00FF00FF, "[SUCCESS] You've been teleported to the specified player" );
return true;
}
pawn Code:
if( !strcmp( cmdtext, "/teleportto", true ))
{
if( !IsPlayerAdmin( playerid ))
return SendClientMessage( playerid, 0xFF0000FF, "[ERROR] Only RCON admins can use this command." );
stock const
params[ 116 ] = cmdtext[ 12 ]
;
if( isnull( params ))
return SendClientMessage( playerid, 0xFFFF00FF, "[USAGE] /teleport [target id] - teleports you to the player." );
new
iTarget = strval( params ),
Float: fPos[ 3 ]
;
GetPlayerPos( iTarget, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SetPlayerPos( playerid, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SendClientMessage( playerid, 0x00FF00FF, "[SUCCESS] You've been teleported to the specified player" );
return true;
}
pawn Code:
//taken from y_utils - a part of the YSI package by ******
#if !defined isnull
#define isnull(%1) \
((%1[0] == 0) || (%1[0] == 1 && %1[1] == 0))
#endif