15.10.2012, 19:10
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/sendto", true)) { if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, 0xFF0000AA, "You need to be RCON for use this command"); new player1; new player2; new str[128]; new p1[MAX_PLAYER_NAME]; new p2[MAX_PLAYER_NAME]; new pd[MAX_PLAYER_NAME]; if(sscanf(params, "uu", player1, player2))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /sendto [p1][p2]"); if(player1 == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Error: player not connected"); if(player2 == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000AA, "Error: player not connected"); GetPlayerName(playerid, pd, MAX_PLAYER_NAME); GetPlayerName(player1, p1, MAX_PLAYER_NAME); GetPlayerName(player2, p2, MAX_PLAYER_NAME); new Float:x; new Float:y; new Float:z; GetPlayerPos(player1, x, y, z); SetPlayerPos(player2, x+1, y+1, z); format(str, sizeof(str),"Admin %s has teleported you to %s", pd, p2); SendClientMessage(player1, 0x00FF00AA, str); format(str, sizeof(str),"Admin %s teleported %s to you", pd, p1); SendClientMessage(player2, 0x00FF00AA, str); format(str, sizeof(str), "You teleported %s to %s", p1, p2); SendClientMessage(playerid, 0x00FF00AA, str); return 1; }