27.10.2011, 21:02
try using a simple targetid variable
pawn Code:
CMD:goto(playerid, params[])
{
new string[256],targetid;
if ( sscanf( params, "u",targetid) )return SendClientMessage(playerid, COLOR_ORANGE, "You can use /pgoto <on/off> to disable enable people to come to you"),SendUsage( playerid, "/goto <id>" );
if (P_DATA[targetid][ P_Goto ] == 0 && P_DATA[ playerid ][ P_Level ] < 1 )return format(string,sizeof( string ), "ERROR: %s has the goto turned off.", PlayerName2(targetid)),SendClientMessage(playerid, COLOR_RED, string );
if(targetid == playerid )return SendError( playerid, "You cannot teleport to yourself!");
new Float:ParamX, Float:ParamY, Float:ParamZ;
GetPlayerPos(targetid, Float:ParamX, Float:ParamY, Float:ParamZ);
SetCameraBehindPlayer( playerid );
SetPlayerInterior( playerid, GetPlayerInterior(targetid));
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld(targetid) );
if(GetPlayerState(playerid) == 2){
SetVehiclePos( GetPlayerVehicleID( playerid ), ParamX+2, ParamY, ParamZ );
LinkVehicleToInterior( GetPlayerVehicleID( playerid ), GetPlayerInterior(targetid));
SetVehicleVirtualWorld( GetPlayerVehicleID( playerid ) , GetPlayerVirtualWorld(targetid));
} else {
SetPlayerPos( playerid, ParamX+2, ParamY, ParamZ );
}
FormMessageForAllEx(playerid && targetid,COLOR_GREEN, "%s teleported to %s!",PlayerName2( playerid ), PlayerName2( params[ 0 ] ));
FormMessage( targetid, COLOR_GREEN, "%s teleported to you!",PlayerName2( playerid ) );
FormMessage( playerid, COLOR_GREEN, "You teleported to %s!",PlayerName2(targetid) );
return 1;
}

