28.06.2009, 08:41
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.
This is the command,
EDIT: It is all indented correctly
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. |
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;
}