03.05.2009, 09:37
pawn Код:
if(strcmp(cmd, "/hi", true) == 0)
{
new tmp[256], string[256], str[256], PlayerName[24], OtherPlayerName[24];
tmp = strtok(cmdtext, idx);
new OtherPlayer = strval(tmp);
GetPlayerName( OtherPlayer, OtherPlayerName, 24 );
GetPlayerName( playerid, PlayerName, 24 );
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hi <playerid>");
if(!IsPlayerConnected(OtherPlayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Playerid.");
if(OtherPlayer == playerid) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You cannot say hi to yourself!");
format(string, sizeof(string), "You have said hi to %s.", OtherPlayerName);
format(str, sizeof(str), "%s said hi to you.", PlayerName);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(OtherPlayer, COLOR_GREEN, str);
return 1;
}