This is my stats command.. but its in DCMD...
Код:
dcmd_stats(playerid,params[])
{
new pname[MAX_PLAYER_NAME],pid,string[MAX_STRING];
sscanf(params,"s",pname,sizeof(pname));
if(params[0] == '\0') {
pid = playerid;
} else {
pid = FindPlayer(pname);
}
if(pid == INVALID_PLAYER_ID) {
return SendClientMessage(playerid,COLOR_RED,"Player not found!");
}
if(pid == playerid) {
SendClientMessage(playerid,COLOR_GREEN,"Your stats:");
format(string,sizeof(string),"Your kills -> %i ... Your deaths -> %i",Kills[pid],Deaths[pid]);
SendClientMessage(playerid,COLOR_YELLOW,string);
new money = GetPlayerMoney(playerid);
format(string,sizeof(string),"Money -> %i",money);
SendClientMessage(playerid,COLOR_YELLOW,string);
} else {
format(string,sizeof(string),"%s's stats:",ReturnPlayerName(pid));
SendClientMessage(playerid,COLOR_GREEN,string);
format(string,sizeof(string),"Kills -> %i ... Deaths -> %i",Kills[pid],Deaths[pid]);
SendClientMessage(playerid,COLOR_YELLOW,string);
new money = GetPlayerMoney(pid);
format(string,sizeof(string),"Money -> %i",money);
SendClientMessage(playerid,COLOR_YELLOW,string);
}
return 1;
}
BTW it uses scanf