Why is this giving error??
#1

Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3) && TruckJob[playerid] != 4) && TruckJob[playerid] != 5) && TruckJob[playerid] != 6) && TruckJob[playerid] != 7){ TruckJob[playerid] = 1; }
Its from a truck system im making,im not sure why this line is giving error:
Code:
C:\x\x.pwn(4663) : warning 215: expression has no effect
C:\x\x.pwn(4663) : error 001: expected token: ";", but found ")"
C:\x\x.pwn(4663) : error 029: invalid expression, assumed zero
C:\x\x.pwn(4663) : fatal error 107: too many error messages on one line
Please halp
Reply
#2

pawn Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3) && TruckJob[playerid] != 4) && TruckJob[playerid] != 5) && TruckJob[playerid] != 6) && TruckJob[playerid] != 7){ TruckJob[playerid] = 1)
You had a "}" there instead of a ")". And it's an if statement, so I deleted the ";" or it wont run the following code you have after that.
Reply
#3

Numbers 1 and 2 are without ) try deleting it entirely or put it everywhere.
Reply
#4

Not working,it cause every following code to give error
Reply
#5

Post us some code after that line.
Reply
#6

Code:
CMD:trucker(playerid, params[])
    {
		new TruckCheck;
		TruckCheck = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(TruckCheck == 403 || TruckCheck == 515 || TruckCheck == 514 )
        {
            if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))){ SendClientMessage(playerid,COLOR_RED,"[pr0jobz]You don't have a trailer attached to the vehicle!"); return 1; }
            if(TruckJob[playerid] != 1) && TruckJob[playerid] != 2) && TruckJob[playerid] != 3) && TruckJob[playerid] != 4) && TruckJob[playerid] != 5) && TruckJob[playerid] != 6) && TruckJob[playerid] != 7) { TruckJob[playerid] = 1; }
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "[pr0jobz]%s is now trucking,please do not disturb him/her.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);

            if(TruckJob[playerid] == 1){
                TruckJob[playerid] = 2;
                SetPlayerCheckpoint(playerid,1944.7424,-1771.1267,13.1157,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: San Fierro Docks");
                return 1;
            }
            if(TruckJob[playerid] == 2){
                TruckJob[playerid] = 3;
                SetPlayerCheckpoint(playerid,1003.4263,-941.8485,41.8079,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: Saw Mill");
                return 1;
            }
            if(TruckJob[playerid] == 3){
                TruckJob[playerid] = 4;
                SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: Chilliad Item Shack");
                return 1;
            }
            if(TruckJob[playerid] == 4){
                TruckJob[playerid] = 5;
                SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: LVA");
                return 1;
            }
            if(TruckJob[playerid] == 5){
                TruckJob[playerid] = 6;
                SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: LV Space Research Center");
                return 1;
            }
            if(TruckJob[playerid] == 6){
                TruckJob[playerid] = 7;
                SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: LS Transfender");
                return 1;
            }
            if(TruckJob[playerid] == 7){
                TruckJob[playerid] = 1;
                SetPlayerCheckpoint(playerid,1944.7424,-1771.1267,13.1157,10);
                SendClientMessage(playerid, COLOR_YELLOW,"[pr0jobz]Destination: San Fierro Docks");
                return 1;
            }
            return 1;
        }
        return SendClientMessage(playerid, COLOR_RED,"[pr0jobz]You have to be in a Roadtrain,Linerunner or Tanker to start the job");
    }
Reply
#7

The line is wrong, nothing after it would effect it to give that error code. You have too many closing braces than opening ones. Observe:

pawn Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3) /*YOUR IF STATEMENT FINISHES HERE DUE TO TO CLOSING BRACKET*/ && TruckJob[playerid] != 4) /*and another*/ && TruckJob[playerid] != 5) /*and another*/ && TruckJob[playerid] != 6) /*and another*/ && TruckJob[playerid] != 7)/*and another, this should be your proper final brace*/
{
    TruckJob[playerid] = 1;
}
It should look like this:

pawn Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3 && TruckJob[playerid] != 4 && TruckJob[playerid] != 5 && TruckJob[playerid] != 6 && TruckJob[playerid] != 7)
{
    TruckJob[playerid] = 1;
}
Reply
#8

Try this:

pawn Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3 && TruckJob[playerid] != 4 && TruckJob[playerid] != 5 && TruckJob[playerid] != 6 && TruckJob[playerid] != 7) { TruckJob[playerid] = 1; }
Reply
#9

Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3) && if(TruckJob[playerid] != 4 && TruckJob[playerid] != 5 && TruckJob[playerid] != 6 && TruckJob[playerid] != 7){ TruckJob[playerid] = 1; }
not sure if this one works but try it ^^
Reply
#10

It seems
Code:
if(TruckJob[playerid] != 1 && TruckJob[playerid] != 2 && TruckJob[playerid] != 3 && TruckJob[playerid] != 4 && TruckJob[playerid] != 5 && TruckJob[playerid] != 6 && TruckJob[playerid] != 7){ TruckJob[playerid] = 1; }
is working :\
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)