28.08.2014, 17:34
well it's easy, we will use zcmd
pawn Код:
CMD:goto(playerid,params[])
{
//first we define the targetid
new targetid;
//we will use sscanf too if the player didn't write the right command
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,GetPlayerColor(playerid),"[ERROR]/goto [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,GetPlayerColor(playerid),"[ERROR]player not connected");//if the player is not connected it will send a message to the playerid (which is you) telling that that player is invalid or not connected
if(playerid == targetid) return SendClientMessage(playerid,GetPlayerColor(playerid),"You Can't teleport to yourself");//if the playerid is the targetid
//x,y,z of the targetid
new Float:x,Float:y,Float:z;
GetPlayerPos(targetid,x,y,z);//get the pos of targetid
SetPlayerPos(playerid,x,y,z);//set the pos of the playerid to the targetid
return 1;
}