Help needed
#1

Код:
CMD:deploy(playerid, params[])
{
 if(PlayerClass[playerid] = AIR_TROOPER)
 {
 ShowPlayerDialog(playerid, DIALOG_DEPLOY, DIALOG_STYLE_LIST, "AirTrooper Deploy Menu", " America\n Russia\n Arabia\n France\n Australia\n Africa", "Select", "Cancel");
 }
 else SendClientMessage(playerid, RED,"[ERROR]: {FFFFFF}You need to spawn with airtrooper class to use this command.");
 return 1;
}
This works for all classes even though i want it to work for only airtrooper class only.
Reply
#2

first you should be getting syntax error for that
Код:
if(PlayerClass[playerid] = AIR_TROOPER)
Correct it to
Код:
if(PlayerClass[playerid] == AIR_TROOPER)
Second, When the player is selecting the class you should set the variable of PlayerClass for the player to AIR_TROOPER so double check it.
And also make sure if you have your class defines it doesn't have the same value
Reply
#3

Код:
if(GetPlayerScore(playerid) >= 500)
           				{
             				ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Air Trooper:", "{F81414}Abilities:\n{FFFFFF}Can teleport to an enemy base (/deploy), invisible on map\n\n{F81414}Weapons:\n\n{FFFFFF}Knife\n{FFFFFF}Sniper\n{FFFFFF}Silenced Pistol", "Play","");
       			     		PlayerClass[playerid] = AIR_TROOPER;
       			     		ChosenClass[playerid] = 6;
       			     		SetPlayerVirtualWorld(playerid, 0);
       			     		TogglePlayerControllable(playerid, 1);
       			     		ResetPlayerWeapons(playerid);
 							GivePlayerWeapon(playerid, 4, 1);//knife
	    			  		GivePlayerWeapon(playerid, 23, 200);//silenced pistol
	    			  		GivePlayerWeapon(playerid, 34, 200);//sniper
  				    		RemovePlayerMapIcon(playerid, 0);
Well i have this to double check, it set's when the player is selecting class, the class defines don't have the same values. Checked.. What's the possible error?
Reply
#4

You have to do some debugging then,
As maybe there is some function changing that variable on spawn or something.

Try that to see:
Put this under OnPlayerSpawn or make a command for it so you can test it in the game anytime OR just put it in the same command on top
Код:
printf("My class: %i - Should be class: %i", PlayerClass[playerid], AIR_TROOPER);
Check what does it print in the server console
Reply
#5

Код:
My class: 0 - Should be class: 6
Reply
#6

I just saw seems you have to variables for the same purpose, Why is that?

Код:
     		PlayerClass[playerid] = AIR_TROOPER;
       		ChosenClass[playerid] = 6;
About that seems the PlayerClass variable is getting reset to 0 somewhere
Maybe the right one is ChoosenClass[playerid]
Reply
#7

Okay got it, the id's are the classes. Not their names, thanks for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)