22.06.2015, 20:01
Hey everyone, stats command work except name , it always says same wrong name on different players.
Anyone know how to fix it?
Anyone know how to fix it?
pawn Код:
CMD:stats(playerid,params[])
{
new name[MAX_PLAYER_NAME];
new id;
GetPlayerName(id, name, sizeof(name));
if(sscanf(params,"d",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];
new Float:ratio=floatdiv(PlayerInfo[id][pKills], PlayerInfo[id][pDeaths]);
format(string, 128, "%d %d %.2f", PlayerInfo[id][pKills], PlayerInfo[id][pDeaths], ratio);
format(string, sizeof(string), "Name: %s (ID:%d)\nAdmin Level :%d\nKills : %d\nDeaths : %d\nKill/Death Ratio: %.2f\nScore: %d",name, id, PlayerInfo[id][pAdmin], PlayerInfo[id][pKills], PlayerInfo[id][pDeaths], ratio,PlayerInfo[id][pScore]);
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",string,"Close","");
return 1;
}