/setrank not working
#1

Hey everybody. I'm using ZCMD & SSCANF, and I wondered if I could get some help:

This command is not working. Basically, I want it to be able to use /setrank [playerid] [rank name] with the rank name being customly inputed. So let's say you typed /setrank 5 Mayor, it'd set that persons rank to Mayor. Although at the moment it doesn't seem to work. It compiles fine yet, so what's wrong?

pawn Код:
CMD:setrank(playerid, params[])
{
    new id, rankname;
    if(PlayerInfo[playerid][pFactionLeader] == 1 || PlayerInfo[playerid][pFactionAMember] == 1)
    {
       if(sscanf(params, "us", id, rankname)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /setrank [playerid] [rankname]");
       if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: This player is not connected.");
       if(id == PlayerInfo[playerid][pFaction] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: This player is not a member of your faction.");
       PlayerInfo[id][pRank] = rankname;
       new str[128];
       format(str,sizeof(str), "INFO: %s's rank was changed to: %s.", id, rankname);
       SendClientMessage(playerid, COLOR_INFO, str);
       return 1;
    }
    else return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are unauthorized to use this command.");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)