Errors which I'm struggling to fix
#1

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
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)