error 002: only a single statement (or expression) can follow each "case" - 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: only a single statement (or expression) can follow each "case" (
/showthread.php?tid=370831)
error 002: only a single statement (or expression) can follow each "case" -
_Khaled_ - 21.08.2012
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
Class[playerid] = classid;
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,944.99,-41.64,1001.77);
SetPlayerFacingAngle(playerid,180.0);
SetPlayerCameraPos(playerid,944.69,-47.54,1001.12);
SetPlayerCameraLookAt(playerid,944.99,-41.64,1001.77);
SetPlayerTeamFromClass(playerid, classid);
switch(classid)
{
case 0:
{
GameTextForPlayer(playerid,"~w~CIVILIAN",1000,8);
}
case 1:
{
GameTextForPlayer(playerid,"~b~COP",1000,3);
}
case 2:
{
GameTextForPlayer(playerid,"~g~ARMY",1000,4);
}
case 3:
{
GameTextForPlayer(playerid,"~w~CIA",1000,3);
}
case 4:
{
GameTextForPlayer(playerid,"~P~MEDIC",1000,5);
}
return 1;
}
Код:
D:\SAMP\Server\gamemodes\****.pwn(349) : error 002: only a single statement (or expression) can follow each "case"
D:\SAMP\Server\gamemodes\*****.pwn(349) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: error 002: only a single statement (or expression) can follow each "case" -
RanSEE - 21.08.2012
You must end the switch statement before setting return 1
and you got a missing bracket btw.
Re: error 002: only a single statement (or expression) can follow each "case" -
clarencecuzz - 21.08.2012
pawn Код:
switch(classid)
{
case 0:
{
GameTextForPlayer(playerid,"~w~CIVILIAN",1000,8);
}
case 1:
{
GameTextForPlayer(playerid,"~b~COP",1000,3);
}
case 2:
{
GameTextForPlayer(playerid,"~g~ARMY",1000,4);
}
case 3:
{
GameTextForPlayer(playerid,"~w~CIA",1000,3);
}
case 4:
{
GameTextForPlayer(playerid,"~P~MEDIC",1000,5);
}
}
return 1;
}
^^
Missing a bracket.