03.08.2011, 05:36
Thats because your passing the playerid (the variable id) to "format" instead of the players name.
Its impossible to display a players name without using a string, because a players name IS a string.
pawn Код:
CMD:givecash(playerid,params[])
{
new
id,
amount;
if(sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
new
szPName[MAX_PLAYER_NAME];
GivePlayerMoney(id,amount);
new str[40+MAX_PLAYER_NAME];
GetPlayerName(id, szPName, MAX_PLAYER_NAME);
format(str, sizeof(str), "You have sent %d to %s",amount,szPName);
SendClientMessage(playerid, COLOR_GREEN, str);
GetPlayerName(playerid, szPName, MAX_PLAYER_NAME);
format(str, sizeof(str), "You have recieved %d from %s",amount,szPName);
SendClientMessage(id, COLOR_GREEN, str);
}
return 1;
}