CMD:stats(playerid, params[]) {
new id;
new pname[MAX_PLAYER_NAME], recievername[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
GetPlayerName(id,recievername,sizeof(recievername));
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED,"[USAGE] - /stats [ID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED,"[ERROR] - Player is not connected!");
new string[128];
format(string, sizeof(string), " | ..:: %s's stats ::.. |", pname);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "| ..:: Score: %d | Money: %d$ | Kills: %d | Deaths: %d ::.. |", GetPlayerScore(recievername), GetPlayerMoney(recievername), PlayerInfo[recievername][pKills], PlayerInfo[recievername][pDeaths]);
SendClientMessage(playerid, COLOR_GREEN, string);//Error line above this line.
return 1;
}
\test.pwn(2241) : error 035: argument type mismatch (argument 1)
GetPlayerName(id,recievername,sizeof(recievername));
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED,"[USAGE] - /stats [ID]");
GetPlayerName(id,recievername,sizeof(recievername));
You cannot use a string inside an array variable.
Use id instead reciever. I also noticed another Bug. In fact you're trying to read the targetname, before checking sscanf. pawn Код:
This is right pawn Код:
|
Would renaming it really do something?
Well, still.. re-named, nothing changed.. As i said earlier, i have a feeling that I'm missing something, but i can't notice it. Thanks, this worked. |
CMD:stats(playerid,params[])
{
new id;
if(sscanf(params,"u",id)) return SendClientMessage(playerid, BLUE,"USAGE: "cwhite"/stats (id / name)");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player is not connected!");
ShowStats(playerid, id);
return 1;
}