01.01.2014, 10:04
The sscanf was used incorrect.
By the way if you use another command processor except ZCMD, then you'll get the "SERVER: Unknown command." message.
pawn Код:
CMD:stats(playerid, params[])
{
if(!PlayerInfo[playerid][pLogged]) return Kick(playerid);
new targetid;
if(!sscanf(params, "u", targetid))
{
if(!IsPlayerConnected(targetid)) return SCM(playerid, -1,""ERROR_MSG" Player isn't connected.");
if(!PlayerInfo[targetid][pLogged]) return SCM(playerid, -1, ""ERROR_MSG" Player isn't logged in yet.");
new Score = PlayerInfo[targetid][pScore], Cash = PlayerInfo[targetid][pCash], Kills = PlayerInfo[targetid][pKills], Deaths = PlayerInfo[targetid][pDeaths];
new Admin = PlayerInfo[targetid][pAdmin], tstr[37], str[256];
format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(targetid), targetid);
format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
ShowPlayerDialog(playerid, DIALOG_STATS2, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
}
else
{
new Score = PlayerInfo[playerid][pScore], Cash = PlayerInfo[playerid][pCash], Kills = PlayerInfo[playerid][pKills], Deaths = PlayerInfo[playerid][pDeaths];
new Admin = PlayerInfo[playerid][pAdmin], tstr[37], str[256];
format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(playerid), playerid);
format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
SCM(playerid, -1,""INFO_MSG" You can also use /stats [PlayerID/PartOfName]");
}
return 1;
}

