SA-MP Forums Archive
Error 002: - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error 002: (/showthread.php?tid=369838)



Error 002: - ZBits - 18.08.2012

pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerCameraPos(playerid, 2220.9197,-1164.0920,25.7331);
    SetPlayerCameraLookAt(playerid, 2215.1963,-1164.0492,25.7266);
    SetPlayerPos(playerid, 2215.1963,-1164.0492,25.7266);
    SetPlayerFacingAngle(playerid, 270.5322);
    ApplyAnimation(playerid,"DANCING","DAN_LOOP_A",4.0,1,0,0,0,-1);
    switch(classid) // Switching between the classids
    {
         case 0..2:
         {
              SetPlayerTeam(playerid, TEAM_AZTECAS); // Setting players team
              GameTextForPlayer(playerid, "~w~[]AZTECAS[]", 2000, 5); // Screen msg for player to show what team
         }
         case 3..5:
         {
              SetPlayerTeam(playerid, TEAM_VAGO); // Setting players team
              GameTextForPlayer(playerid, "~y~[]Vagos[]", 2000, 5); // Screen msg for player to show what team
         }
         case 6..11:
         {
              SetPlayerTeam(playerid, TEAM_GROVE); // Setting players team
              GameTextForPlayer(playerid,"~g~[]Grove[]",  2000,5); // Screen msg for player to show what team
         }
         case 12..14:
         {
              SetPlayerTeam(playerid, TEAM_BALLA); // Setting players team
              GameTextForPlayer(playerid,"~p~[]Balla[]",2000,5); // Screen msg for player to show what team
         }
         case 15..16:
         {
              SetPlayerTeam(playerid, TEAM_BIKER); // Setting players team
              GameTextForPlayer(playerid,"~l~[]BIKER[]",2000,5); // Screen msg for player to show what team
         }
         case 17..19:
         {
              SetPlayerTeam(playerid, TEAM_MEDIC); // Setting players team
              GameTextForPlayer(playerid,"~w~[]Medic[]",2000,5); // Screen msg for player to show what team
         }
         case 20..22:
         {
              SetPlayerTeam(playerid, TEAM_WHORE); // Setting players team
              GameTextForPlayer(playerid,"~r~[]Whore[]",2000,5); // Screen msg for player to show what team
         }
         case 23..25:
         {
              SetPlayerTeam(playerid, TEAM_COPS); // Setting players team
              GameTextForPlayer(playerid,"~b~[]Cops[]",2000,5); // Screen msg for player to show what team
         }
         case 26..27:
         {
              SetPlayerTeam(playerid, TEAM_INDIAN); // Setting players team
              GameTextForPlayer(playerid,"~w~[]Indian[]",2000,5); // Screen msg for player to show what team
         }
         case 28..30:
         {
              SetPlayerTeam(playerid, TEAM_FBI); // Setting players team
              GameTextForPlayer(playerid,"~w~[]FBI[]",200,5); // Screen msg for player to show what team
              }
              else//line 3079!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
              {
              if (GetPlayerScore(playerid) < 50)
              {
                    GameTextForPlayer(playerid,"~r~You must have 50 Scores to be FBI",6500,6);
              }
         }
    }
    return 1;
}
Error:
Код:
(3079) : error 002: only a single statement (or expression) can follow each "case"



Re: Error 002: - Rudy_ - 18.08.2012

[pawn]
]
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerCameraPos(playerid, 2220.9197,-1164.0920,25.7331);
    SetPlayerCameraLookAt(playerid, 2215.1963,-1164.0492,25.7266);
    SetPlayerPos(playerid, 2215.1963,-1164.0492,25.7266);
    SetPlayerFacingAngle(playerid, 270.5322);
    ApplyAnimation(playerid,"DANCING","DAN_LOOP_A",4.0,1,0,0,0,-1);
    switch(classid) // Switching between the classids
    {
         case 0..2:
         {
              SetPlayerTeam(playerid, TEAM_AZTECAS); // Setting players team
              GameTextForPlayer(playerid, "~w~[]AZTECAS[]", 2000, 5); // Screen msg for player to show what team
         }
         case 3..5:
         {
              SetPlayerTeam(playerid, TEAM_VAGO); // Setting players team
              GameTextForPlayer(playerid, "~y~[]Vagos[]", 2000, 5); // Screen msg for player to show what team
         }
         case 6..11:
         {
              SetPlayerTeam(playerid, TEAM_GROVE); // Setting players team
              GameTextForPlayer(playerid,"~g~[]Grove[]",  2000,5); // Screen msg for player to show what team
         }
         case 12..14:
         {
              SetPlayerTeam(playerid, TEAM_BALLA); // Setting players team
              GameTextForPlayer(playerid,"~p~[]Balla[]",2000,5); // Screen msg for player to show what team
         }
         case 15..16:
         {
              SetPlayerTeam(playerid, TEAM_BIKER); // Setting players team
              GameTextForPlayer(playerid,"~l~[]BIKER[]",2000,5); // Screen msg for player to show what team
         }
         case 17..19:
         {
              SetPlayerTeam(playerid, TEAM_MEDIC); // Setting players team
              GameTextForPlayer(playerid,"~w~[]Medic[]",2000,5); // Screen msg for player to show what team
         }
         case 20..22:
         {
              SetPlayerTeam(playerid, TEAM_WHORE); // Setting players team
              GameTextForPlayer(playerid,"~r~[]Whore[]",2000,5); // Screen msg for player to show what team
         }
         case 23..25:
         {
              SetPlayerTeam(playerid, TEAM_COPS); // Setting players team
              GameTextForPlayer(playerid,"~b~[]Cops[]",2000,5); // Screen msg for player to show what team
         }
         case 26..27:
         {
              SetPlayerTeam(playerid, TEAM_INDIAN); // Setting players team
              GameTextForPlayer(playerid,"~w~[]Indian[]",2000,5); // Screen msg for player to show what team
         }
         case 28..30:
         {
            if(GetPlayerScore(playerid) > 49)
            {
              SetPlayerTeam(playerid, TEAM_FBI); // Setting players team
              GameTextForPlayer(playerid,"~w~[]FBI[]",200,5); // Screen msg for player to show what team
            }
            else
            {
                GameTextForPlayer(playerid,"~r~You must have 50 Scores to be FBI",6500,6);
            }
         }
    }
    return 1;
}
You will have lose indentation errors


Re: Error 002: - ZBits - 18.08.2012

what was the problem? BTw its fixed but i need to know the problem so i dont make a mistake in future


Re: Error 002: - Rudy_ - 18.08.2012

pawn Код:
case 28..30:
         {
            if(GetPlayerScore(playerid) > 49)
            {
              SetPlayerTeam(playerid, TEAM_FBI); // Setting players team
              GameTextForPlayer(playerid,"~w~[]FBI[]",200,5); // Screen msg for player to show what team
            }
            else //you had the " else " in use for case, and case can't have else..
            {
                GameTextForPlayer(playerid,"~r~You must have 50 Scores to be FBI",6500,6);
            }
         }
    }
    return 1;
}
this