Command Trouble
#1

Hello, I have come across a problem with my script and I am not sure what is wrong with it.

When I, or another faction leader tries to /setrank a already invited player, it doesn't actually set the rank and comes up with the following error message.

Quote:

[ERROR:] Rank must be below or equal to the factions rank amount.

This is the command,

pawn Code:
if(strcmp(cmd, "/setrank", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /setrank [playerid/partofname] [newrank]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if (PlayerInfo[playerid][pRank] == 1 && PlayerInfo[playerid][pFaction] != 255)
            {
                if (PlayerInfo[para1][pFaction] == PlayerInfo[playerid][pFaction])
                {
                    new faction = PlayerInfo[playerid][pFaction];
                    if (level)
                    {
                        if(level > 1 && level <= DynamicFactions[faction][fRankAmount])
                      {
                            if(IsPlayerConnected(para1))
                        {
                                if(gPlayerLogged[para1])
                                {
                                    if(para1 != INVALID_PLAYER_ID)
                                    {
                                        PlayerInfo[para1][pRank] = level;
                                        format(string, sizeof(string), "[INFO:] You rank has been changed by: %s, you are now rank: %d.", GetPlayerNameEx(playerid),level);
                                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                                        format(string, sizeof(string), "[INFO:] You have changed %s's rank to: %d.", GetPlayerNameEx(para1),level);
                                        SendClientMessage(playerid, COLOR_YELLOW, string);
                                        SetPlayerToFactionSkin(para1);

                                        if(PlayerInfo[para1][pSex] == 1)
                                        {
                                            format(string, sizeof(string), "[FACTION:] %s's rank has been changed, he is now rank: %d.",GetPlayerNameEx(para1), level);
                                            SendFactionMessage(PlayerInfo[playerid][pFaction], COLOR_FACTIONCHAT, string);
                                        }
                                        else
                                        {
                                            format(string, sizeof(string), "[FACTION:] %s's rank has been changed, she is now rank: %d.",GetPlayerNameEx(para1), level);
                                            SendFactionMessage(PlayerInfo[playerid][pFaction], COLOR_FACTIONCHAT, string);
                                        }
                                    }
                                }
                                else
                                {
                                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That players not logged in!");
                                }
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID/Player Not Connected.");
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Rank must be below or equal to the factions rank amount.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You must enter an amount!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] The person who's rank you tried to edit is not a member of your faction.");
                }
            }
            else
            {

                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not a leader.");
            }
        }
        return 1;
    }
EDIT: It is all indented correctly
Reply
#2

Bump
Reply
#3

Post in the godfather topic.
Reply
#4

Quote:
Originally Posted by Swift_
Post in the godfather topic.
Its not for the godfather script. It my own one, and having trouble with this.
Reply
#5

Look exactly like the godfather code.
Reply
#6

Quote:
Originally Posted by Swift_
Look exactly like the godfather code.
The godfather code is coded factions and is /giverank.

This is my own script, Dynamic factions and /setrank.
Reply
#7

--Bump--
Reply
#8

uhmm, you must have messed up the max rank somewhere, check it out.
Reply
#9

Quote:
Originally Posted by Thanatos
uhmm, you must have messed up the max rank somewhere, check it out.
Ok, would that be within the script or within the game?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)