#1

Код:
C:\Users\hayden\Desktop\LoF.pwn(3289) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\hayden\Desktop\LoF.pwn(3289 -- 3290) : error 029: invalid expression, assumed zero
C:\Users\hayden\Desktop\LoF.pwn(3290) : warning 217: loose indentation
C:\Users\hayden\Desktop\LoF.pwn(5268) : warning 217: loose indentation
C:\Users\hayden\Desktop\LoF.pwn(5469) : warning 217: loose indentation
C:\Users\hayden\Desktop\LoF.pwn(10508) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Код:
if(ChosenClass[playerid] == 2) //TRUCKER
	{
		switch(PInfo[playerid][sSpawn])
		{
		    case 0: //Default
		    {
		        if(gTeam[playerid] == TEAM_TRUCKER)
		        {
		        	DisplayDialogForPlayer(playerid, 66);
		        }
				else if(gTeam[playerid] == TEAM_MILITARY)
				{
    				DisplayDialogForPlayer(playerid, 5);
				}
		        UpdateSkin(playerid);
		        SetCameraBehindPlayer(playerid);
		        return 1;

		        }
		    }
Reply
#2

Is this an OnDialogResponse? I fixed errors like this by removing the switch statement (switch(pInfo[playerid][sSpawn])

Loose indentation can be fixed multiple ways EG: making your code beautiful on the eye. Here: http://codegenerators.pl/indent

as for the invalid expression error. you'll have to point the lines out
Reply
#3

Код:
public RespawnPlayer(playerid)
{
	if(ChosenClass[playerid] == 1) //Pilot
	{
		switch(PInfo[playerid][sSpawn])
		{
		    case 0: //Default
		    {
		        if(gTeam[playerid] == TEAM_CPILOT)
		        {
		        	DisplayDialogForPlayer(playerid, 3);
		        }
		        else if(gTeam[playerid] == TEAM_TRUCKER)
		        {
		        	DisplayDialogForPlayer(playerid, 66);
		        }
				else if(gTeam[playerid] == TEAM_MILITARY)
				{
    				DisplayDialogForPlayer(playerid, 5);
				}
		        UpdateSkin(playerid);
		        SetCameraBehindPlayer(playerid);
		        return 1;
		    }

		    case 1: //House 1
		    {
		        if(PInfo[playerid][House1] > 0)
		        {
			        new HID = PInfo[playerid][House1];
			        PurelySpawned[playerid] = 1;
			        PlayerSpawned[playerid] = 1;
			        SetPlayerHealth(playerid, 100);
			        SetPlayerInterior(playerid, HInfo[HID][hInterior]);
			        SetPlayerVirtualWorld(playerid, HID);
			        SetPlayerPos(playerid, HInfo[HID][hiX],HInfo[HID][hiY],HInfo[HID][hiZ]);
					UpdateSkin(playerid);
					UpdatePlayerColour(playerid);
			        InHouse[playerid] = HID;
			        SetCameraBehindPlayer(playerid);
			        return 1;
		        }
		        else
		        {
		            SendClientMessage(playerid, COLOR_ERROR, "You do not own a house in this slot! Please update your settings [/settings].");
		            DisplayDialogForPlayer(playerid, 3);
		            return 1;
		        }
			}
		    case 2: //House 2
		    {
		        if(PInfo[playerid][House2] > 0)
		        {
			        new HID = PInfo[playerid][House2];
			        PurelySpawned[playerid] = 1;
			        PlayerSpawned[playerid] = 1;
			        SetPlayerHealth(playerid, 100);
			        SetPlayerInterior(playerid, HInfo[HID][hInterior]);
			        SetPlayerVirtualWorld(playerid, HID);
			        SetPlayerPos(playerid, HInfo[HID][hiX],HInfo[HID][hiY],HInfo[HID][hiZ]);
					UpdatePlayerColour(playerid);
			        InHouse[playerid] = HID;
			        UpdateSkin(playerid);
			        SetCameraBehindPlayer(playerid);
			        return 1;
		        }
		        else
		        {
		            SendClientMessage(playerid, COLOR_ERROR, "You do not own a house in this slot! Please update your settings [/settings].");
		            DisplayDialogForPlayer(playerid, 3);
		            return 1;
		        }
		    }
		    case 3: // Airline
		    {
		        if(PInfo[playerid][Airline] > 0)
		        {
	    		    PurelySpawned[playerid] = 1;
				    PlayerSpawned[playerid] = 1;
				    SetPlayerHealth(playerid, 100);
				    SetPlayerInterior(playerid, 0);
				    SetPlayerVirtualWorld(playerid, 0);
				    SetPlayerPos(playerid, AInfo[PInfo[playerid][Airline]][aPos1], AInfo[PInfo[playerid][Airline]][aPos2], AInfo[PInfo[playerid][Airline]][aPos3]);
				    SetPlayerFacingAngle(playerid, AInfo[PInfo[playerid][Airline]][aPos4]);
				    UpdatePlayerColour(playerid);
				    UpdateSkin(playerid);
				    SetCameraBehindPlayer(playerid);
				    return 1;
		        }
		        else
		        {
		            SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline! Please update your settings [/settings].");
		            DisplayDialogForPlayer(playerid, 3);
		            return 1;
		        }
		    }

 if(ChosenClass[playerid] == 2) //TRUCKER
	{
		switch(PInfo[playerid][sSpawn])
		{
		    case 0: //Default
		    {
		        if(gTeam[playerid] == TEAM_TRUCKER)
		        {
		        	DisplayDialogForPlayer(playerid, 66);
		        }
				else if(gTeam[playerid] == TEAM_MILITARY)
				{
    				DisplayDialogForPlayer(playerid, 5);
				}
		        UpdateSkin(playerid);
		        SetCameraBehindPlayer(playerid);
		        return 1;

		        }
		    }
		}
	}
	return 1;
}
thats the whole part
Reply
#4

You forgot to close the switch statement after case 3.
Reply
#5

C:\Users\hayden\Desktop\LoF.pwn(3289) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\hayden\Desktop\LoF.pwn(3289 -- 3290) : error 029: invalid expression, assumed zero
C:\Users\hayden\Desktop\LoF.pwn(3290) : warning 217: loose indentation
C:\Users\hayden\Desktop\LoF.pwn(3310) : warning 209: function "RespawnPlayer" should return a value
C:\Users\hayden\Desktop\LoF.pwn(3311) : error 010: invalid function or declaration
C:\Users\hayden\Desktop\LoF.pwn(526 : warning 217: loose indentation
C:\Users\hayden\Desktop\LoF.pwn(5469) : warning 217: loose indentation
C:\Users\hayden\Desktop\LoF.pwn(1050 : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


thats what i got after adding another }
Reply
#6

I fixed it but how do i make it where you have to have a trailer attached to do /work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)