05.06.2017, 18:01
So the below code, I want it to send a message when the user is made a higher rank than he is. For example, if my level is 4... and I'm made level 5... then it'll say promotion and it'll say derank if he gets lowered a level.
What it's doing at t he moment is sending the 'PROMOTION' message and then killing the command! Why?
I understand this probably isn't the easiest, nor the most efficient way of doing what I'm trying to do. If you have any suggestions on how I can improve that, that would help me out a lot...
I guess creating a save string... so instead of saving the variable as an int... save it as a variable... if any one knows how to do this, please suggest below!
Thanks in advance!!
What it's doing at t he moment is sending the 'PROMOTION' message and then killing the command! Why?
pawn Код:
if(sscanf(params, "ui", id, rank)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setrank [playerid] [rank] (1-5)");
{
if(PlayerInfo[playerid][pFacLeader] == 1 || PlayerInfo[playerid][pAdmin] == 4)
{
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected!");
if(rank > 5) return SendClientMessage(playerid, COLOR_RED, "You can't set a rank higher than 5!");
if(rank > PlayerInfo[playerid][pFacRank]) return SendClientMessage(playerid, COLOR_GREEN, "PROMOTION!");
switch(rank)
{
case 1:
{
switch(PlayerInfo[playerid][pFac])
{
case 1:
{
format(string, sizeof(string), "%s set your rank to Cadet!", pName);
}
case 2:
{
format(string, sizeof(string), "%s set your rank to Associate!", pName);
}
case 3:
{
format(string, sizeof(string), "%s set your rank to Associate!", pName);
}
case 4:
{
format(string, sizeof(string), "%s set your rank to Raw Recruit!", pName);
}
case 5:
{
format(string, sizeof(string), "%s set your rank to Raw Recruit!", pName);
}
}
}
case 2:
{
switch(PlayerInfo[playerid][pFac])
{
case 1:
{
format(string, sizeof(string), "%s set your rank to Trooper!", pName);
}
case 2:
{
format(string, sizeof(string), "%s set your rank to Soldier!", pName);
}
case 3:
{
format(string, sizeof(string), "%s set your rank to Soldier!", pName);
}
case 4:
{
format(string, sizeof(string), "%s set your rank to Street Soldier!", pName);
}
case 5:
{
format(string, sizeof(string), "%s set your rank to Street Soldier!", pName);
}
}
}
case 3:
{
switch(PlayerInfo[playerid][pFac])
{
case 1:
{
format(string, sizeof(string), "%s set your rank to Lieutenant!", pName);
}
case 2:
{
format(string, sizeof(string), "%s set your rank to Capo!", pName);
}
case 3:
{
format(string, sizeof(string), "%s set your rank to Capo!", pName);
}
case 4:
{
format(string, sizeof(string), "%s set your rank to Gang Fighter!", pName);
}
case 5:
{
format(string, sizeof(string), "%s set your rank to Gang Fighter!", pName);
}
}
}
case 4:
{
switch(PlayerInfo[playerid][pFac])
{
case 1:
{
format(string, sizeof(string), "%s set your rank to Deputy Chief of Police!", pName);
}
case 2:
{
format(string, sizeof(string), "%s set your rank to Underboss!", pName);
}
case 3:
{
format(string, sizeof(string), "%s set your rank to Underboss!", pName);
}
case 4:
{
format(string, sizeof(string), "%s set your rank to Henchman!", pName);
}
case 5:
{
format(string, sizeof(string), "%s set your rank to Henchman!", pName);
}
}
}
case 5:
{
switch(PlayerInfo[playerid][pFac])
{
case 1:
{
format(string, sizeof(string), "%s set your rank to Chief of Police!", pName);
}
case 2:
{
format(string, sizeof(string), "%s set your rank to Boss!", pName);
}
case 3:
{
format(string, sizeof(string), "%s set your rank to Boss!", pName);
}
case 4:
{
format(string, sizeof(string), "%s set your rank to Gang Leader!", pName);
}
case 5:
{
format(string, sizeof(string), "%s set your rank to Gang Leader!", pName);
}
}
I guess creating a save string... so instead of saving the variable as an int... save it as a variable... if any one knows how to do this, please suggest below!
Thanks in advance!!