Strange Error - Possibly SSCANF/ZCMD related
#1

So I wrote the following command, to me it looks correct... I can't work out why it's bugging up.
It's causing the server to partially crash (aka all commands stop working) and even though PlayerInfo[receiverid][pAdmin] DOES end up being whatever it was set to, it displays a random number, almost like a strval().

Any suggestions?

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new level;
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        if(sscanf(params, "ud", receiverid, level) == 0)
        {
            if(IsPlayerConnected(receiverid))
            {
                PlayerInfo[receiverid][pAdmin] = level;
                GetPlayerName(receiverid, ReceiverName);
                format(str, sizeof(str), "You have set %s's Admin Level to %d", ReceiverName, PlayerInfo[receiverid][pAdmin]);
                SendClientMessage(playerid, COLOR_YELLOW, str);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, " That player is not connected.");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [PlayerID/PartOfName] [Level (1 - 9999)]");
            return 1;
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)