Rank problem during class selection
#1

I have ranks set, these ranks can be earned by having a certain amount of score. Only problem is, this rank rule is not working with class selection. I have multiple classes such as medic, engineer, etc. Let's say I try to choose a medic class which requires 100 score, even if I had 500 score, I couldn't choose this class and it would say "Rank not high enough". I believe the problem may lay below, what do you think?

Код:
if(PRESSED(KEY_JUMP)) // LSHIFT
	{
	    if(IsPlayerChoosingClass[playerid] == 1)
	    {
		    if(ClassChoosingStep[playerid] == 0) // ASSAULT
		    {
		        gClass[playerid] = ASSAULT;
			}
			if(ClassChoosingStep[playerid] == 1) // MEDIC
			{
   				if(Rank(playerid) != 2) return SendClientMessage(playerid, C_WHITE, "Your rank is not high enough!");
			    gClass[playerid] = MEDIC;
			}
			if(ClassChoosingStep[playerid] == 2) // ANTI-TANK
			{
			    if(Rank(playerid) != 3) return SendClientMessage(playerid, C_WHITE, "Your rank is not high enough!");
			    gClass[playerid] = ANTI-TANK;
			}
			if(ClassChoosingStep[playerid] == 3) // ENGINEER
			{
			    if(Rank(playerid) != 4) return SendClientMessage(playerid, C_WHITE, "Your rank is not high enough!");
			    gClass[playerid] = ENGINEER;
			}
			if(ClassChoosingStep[playerid] == 4) // AIRFORCE
			{
			    if(Rank(playerid) != 5) return SendClientMessage(playerid, C_WHITE, "Your rank is not high enough!");
			    gClass[playerid] = AIRFORCE;
			}
			if(ClassChoosingStep[playerid] == 5) // SPECICAL-OPS
			{
			    if(Rank(playerid) != 6) return SendClientMessage(playerid, C_WHITE, "Your rank is not high enough!");
			    gClass[playerid] = SPEC-OPS;
			}

			TextDrawHideForPlayer(playerid, ClassBox);
			TextDrawHideForPlayer(playerid, ClassNameLine);
			TextDrawHideForPlayer(playerid, ClassWeapons);
			TextDrawHideForPlayer(playerid, ClassDescription1);
			TextDrawHideForPlayer(playerid, ClassDescription2);
			TextDrawHideForPlayer(playerid, ClassRequiredRank);
			
			TextDrawHideForPlayer(playerid, ClassHelpBox);
			TextDrawHideForPlayer(playerid, ClassClick);
			TextDrawHideForPlayer(playerid, ClassSpawn);

			IsPlayerChoosingClass[playerid] = 0;
			TogglePlayerControllable(playerid, 1);
			SpawnPlayer(playerid);
		}
	}

	    
	return 1;
}
Reply
#2

Anyone able to help?
Reply
#3

I take it that the score is somehow interpreted into the Rank(playerid) and that Rank() is indeed a function (if it was a variable (array) it would be Rank[playerid]).

Also, if the rank would just be 2 for a specific type and not just for, lets say, 200 score then the code will not work as your rank is too high if you have rank 3.

So: your if-statements would be if(Rank[playerid] < 2) return SendClientMessage(playerid, C_WHITE, "Your rank is not high enough");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)