/setrankname command.
#3

Quote:
Originally Posted by DTV
Посмотреть сообщение
I assume that 'rankname' is suppose to be a string, however you have it set up to be checked as a integer under sscanf.

pawn Код:
command(setrankname, playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {
        new target, rankname[24], string[128]; //change [24] to however long you want the rank name to be at maximum
        if(sscanf(params,"us[24]", target, rankname)) return SendClientMessage(playerid, GREY, "SYNTAX:{FFFFFF} /setrankname [ID] [rankname]");
        {
            PlayerInfo[target][pRankName] = rankname;
            {
                format(string, sizeof(string), "WARN: You changed: %s's rankname to: %s", RPName(target), PlayerInfo[playerid][pRankName]);
                SendClientMessage(playerid, ADMINBLUE, string);
                format(string, sizeof(string), "WARN: %s has changed your rankname to: %s", RPName(playerid), PlayerInfo[playerid][pRankName]);
                SendClientMessage(target, ADMINBLUE, string);
            }
        }
    }
    return 1;
}
If you get an error related to
Код:
PlayerInfo[target][pRankName] = rankname;
, try using this.

pawn Код:
format(string, sizeof(string), "%s", rankname);
PlayerInfo[target][pRankName] = string;
That should fix it if an error shows up.
I changed the "PlayerInfo[target][pRankName] = rankname;" to the pawn you said along with the rankname being [24] characters, I still got this error "error 047: array sizes do not match, or destination array is too small" on the line that has the code: "PlayerInfo[target][pRankName] = rankname;"

Thanks for the help.
Reply


Messages In This Thread
/setrankname command. - by OMonger - 14.08.2015, 08:36
Re: /setrankname command. - by DTV - 14.08.2015, 09:07
Re: /setrankname command. - by OMonger - 14.08.2015, 09:17
Re: /setrankname command. - by LetsOWN[PL] - 14.08.2015, 10:03
Re: /setrankname command. - by OMonger - 14.08.2015, 10:07
Re: /setrankname command. - by OMonger - 14.08.2015, 10:42

Forum Jump:


Users browsing this thread: 1 Guest(s)