OnPlayerRequestclass error
#1

Hello, heres my code:

Код HTML:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
   	    {
              gTeam[playerid] = TEAM_USA;
              GameTextForPlayer(playerid, "~b~USA", 5000, 5);
              SetPlayerPos(playerid, 1522.6503,-806.6635,72.1700);
              SetPlayerFacingAngle(playerid, 8298);
              SetPlayerCameraPos(playerid, 1514.0861,-806.9355,72.0768);
              SetPlayerCameraLookAt(playerid, 1522.6503,-806.6635,72.1700);
        }
        case 1:
        {
               gTeam[playerid] = TEAM_RUSS;
               GameTextForPlayer(playerid, "~r~RUSSIAN", 5000, 5);
               SetPlayerPos(playerid, 1279.3276,-778.4965,95.9663);
               SetPlayerFacingAngle(playerid,8298);
               SetPlayerCameraPos(playerid,1266.1062,-778.3137,95.9665);
               SetPlayerCameraLookAt(playerid,1279.3276,-778.4965,95.9663);
        }
        case 2:
        {
               gTeam[playerid] = TEAM_ARAB;
               GameTextForPlayer(playerid, "~y~ARAB", 5000, 5);
               SetPlayerPos(playerid, 1522.6503,-806.6635,72.1700);
               SetPlayerFacingAngle(playerid, 8298);
               SetPlayerCameraPos(playerid, 1514.0861,-806.9355,72.0768);
               SetPlayerCameraLookAt(playerid, 1522.6503,-806.6635,72.1700);
         }
         case 3:
         {
               gTeam[playerid] = TEAM_EURO;
               GameTextForPlayer(playerid, "~g~EUROPE", 5000, 5);
               SetPlayerPos(playerid, 1279.3276,-778.4965,95.9663);
               SetPlayerFacingAngle(playerid,8298);
               SetPlayerCameraPos(playerid,1266.1062,-778.3137,95.9665);
               SetPlayerCameraLookAt(playerid,1279.3276,-778.4965,95.9663);
         }
         case 4:
         {
               gTeam[playerid] = TEAM_REBELS;
               GameTextForPlayer(playerid, "~br~REBELS", 5000, 5);
               SetPlayerPos(playerid, 1279.3276,-778.4965,95.9663);
               SetPlayerFacingAngle(playerid,8298);
               SetPlayerCameraPos(playerid,1266.1062,-778.3137,95.9665);
               SetPlayerCameraLookAt(playerid,1279.3276,-778.4965,95.9663);
        }
        
        case 5:
        {
               gTeam[playerid] = TEAM_ASIA;
               GameTextForPlayer(playerid, "~y~ASIAN", 5000, 5);
               SetPlayerPos(playerid, 1522.6503,-806.6635,72.1700);
               SetPlayerFacingAngle(playerid, 8298);
               SetPlayerCameraPos(playerid, 1514.0861,-806.9355,72.0768);
               SetPlayerCameraLookAt(playerid, 1522.6503,-806.6635,72.1700);
         }
         
        case 6:
         {
               gTeam[playerid] = TEAM_NONE;
               GameTextForPlayer(playerid, "~w~MERC", 5000, 5);
               SetPlayerPos(playerid, 1279.3276,-778.4965,95.9663);
               SetPlayerFacingAngle(playerid,8298);
               SetPlayerCameraPos(playerid,1266.1062,-778.3137,95.9665);
               SetPlayerCameraLookAt(playerid,1279.3276,-778.4965,95.9663);
        }
        ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class", "Choose","");//this is the class dialog, you can change it if you want but dont forget to define the class also
		}
  	    return 1;
}
But I got this error

Код HTML:
C:\Users\Charalambos\Desktop\dddd.pwn(525) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Charalambos\Desktop\dddd.pwn(525) : warning 215: expression has no effect
C:\Users\Charalambos\Desktop\dddd.pwn(527) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
What did I do wrong?
Reply
#2

You have ShowPlayerDialog within the switch block.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
You have ShowPlayerDialog within the switch block.
can you show me maybe the right script?
im quiet a scripting noob sry :/
Reply
#4

Show us the Dialog id. there no problem at all
Reply
#5

You have your code like this:
PHP код:
        ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"{6EF83C}Choose A Class:""Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class""Choose","");//this is the class dialog, you can change it if you want but dont forget to define the class also
        
}
          return 
1;

You need to have it as:
PHP код:
}
        
ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"{6EF83C}Choose A Class:""Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class""Choose","");//this is the class dialog, you can change it if you want but dont forget to define the class also
          
return 1;

@SoFahim Can you see the errors he has?
Reply
#6

thx bros, it worked! Rep for all of you!!
Reply
#7

Quote:
Originally Posted by Jamester
Посмотреть сообщение
You have your code like this:
PHP код:
        ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"{6EF83C}Choose A Class:""Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class""Choose","");//this is the class dialog, you can change it if you want but dont forget to define the class also
        
}
          return 
1;

You need to have it as:
PHP код:
}
        
ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"{6EF83C}Choose A Class:""Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class""Choose","");//this is the class dialog, you can change it if you want but dont forget to define the class also
          
return 1;

@SoFahim Can you see the errors he has?
Damn, I didnt't saw
PHP код:
 } return 1;

Sorry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)