The hell is the problem... ?
#7

The sscanf was used incorrect.
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;
}
By the way if you use another command processor except ZCMD, then you'll get the "SERVER: Unknown command." message.
Reply


Messages In This Thread
The hell is the problem... ? - by FailerZ - 01.01.2014, 09:05
Re: The hell is the problem... ? - by DaRk_RaiN - 01.01.2014, 09:27
Re: The hell is the problem... ? - by NikO1 - 01.01.2014, 09:27
Re: The hell is the problem... ? - by FailerZ - 01.01.2014, 09:32
Re: The hell is the problem... ? - by NikO1 - 01.01.2014, 09:56
Re: The hell is the problem... ? - by FailerZ - 01.01.2014, 10:01
Re: The hell is the problem... ? - by Konstantinos - 01.01.2014, 10:04
Re: The hell is the problem... ? - by FailerZ - 01.01.2014, 10:37

Forum Jump:


Users browsing this thread: 1 Guest(s)