Errors which I'm struggling to fix - 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: Errors which I'm struggling to fix (
/showthread.php?tid=326734)
Errors which I'm struggling to fix -
cloudysky - 18.03.2012
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(PlayerInfo[playerid][New] == 1)
{
switch(classid)
{
case 0:
{
GameTextForPlayer(playerid, "~g~Trucker", 1500, 6);
SetPlayerPos(playerid, 2468.3013, -1658.8794, 13.3239);
SetPlayerFacingAngle(playerid, 90.5538);
SetPlayerCameraPos(playerid, 2463.6008, -1658.9351, 13.3047);
SetPlayerCameraLookAt(playerid, 2468.3013, -1658.8794, 13.3239);
SetPlayerColor(playerid, COLOR_INFO);
gTeam[playerid] = TEAM_TRUCKER;
SetPlayerInterior(playerid, 0);
ApplyAnimation(playerid,"DEALER","DEALER_IDLE_01",4.1,1,0,0,1,0);
}
else if(PlayerInfo[playerid][New] == 0)
{
SpawnPlayer(playerid);
}
}
}
return 1;
}
pawn Код:
error 002: only a single statement (or expression) can follow each "case"
error 010: invalid function or declaration
Just started doing this again so I'm a little rusty :L
Re: Errors which I'm struggling to fix -
Shabi RoxX - 18.03.2012
You are using else statement in switch(classid)
Use this :
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(PlayerInfo[playerid][New] == 1)
{
switch(classid)
{
case 0:
{
GameTextForPlayer(playerid, "~g~Trucker", 1500, 6);
SetPlayerPos(playerid, 2468.3013, -1658.8794, 13.3239);
SetPlayerFacingAngle(playerid, 90.5538);
SetPlayerCameraPos(playerid, 2463.6008, -1658.9351, 13.3047);
SetPlayerCameraLookAt(playerid, 2468.3013, -1658.8794, 13.3239);
SetPlayerColor(playerid, COLOR_INFO);
gTeam[playerid] = TEAM_TRUCKER;
SetPlayerInterior(playerid, 0);
ApplyAnimation(playerid,"DEALER","DEALER_IDLE_01",4.1,1,0,0,1,0);
}
}
}
else if(PlayerInfo[playerid][New] == 0)
{
SpawnPlayer(playerid);
}
return 1;
}