25.05.2014, 07:13
Here's an example of a 'goto' command which informs the player when someone teleports to him/her -
pawn Код:
CMD:go(playerid,params[])
{
new ID;
if(sscanf(params, "u", ID)) return GameTextForPlayer(playerid,"~g~Usage: ~n~~w~/Go <ID>",2000,3);
else if(!IsPlayerConnected(ID) || ID == playerid) return GameTextForPlayer(playerid,"~g~Error: ~n~~w~Player Is not connected",2000,3);
else
{
new Float:x, Float:y, Float:z;
new name[MAX_PLAYER_NAME+1],name2[MAX_PLAYER_NAME+1], string[40+MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(ID, name2, sizeof(name2));
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z+1);
format(string,sizeof(string),"{99FF00}>> %s(%d) has teleported to you. (/go)",name, playerid);
SendClientMessage(ID,0xFFFFFFc8,string);
format(string,sizeof(string),"{99FF00}>> You have teleported to %s. (/go)",name2, ID);
SendClientMessage(playerid,0xFFFFFFc8,string);
}
return 1;
}

