Why does this not work
#1

Well im trying to make it if the player does not have the trucker job it will remove them from the vehicle and send them a message it dont do any of this

pawn Код:
if(Jobs[Player[playerid][Job]][JobType] != 8 || Jobs[Player[playerid][Job2]][JobType] != 8)
    {
        new car = GetPlayerVehicleID(playerid);
        if(car == 403 || car == 591)
        {
            RemovePlayerFromVehicle(vehicleid);
            SendClientMessage(playerid, WHITE, "You must have the trucker job to drive this vehicle");
        }
    }
Please help

Thanks
Reply
#2

pawn Код:
if(Jobs[Player[playerid][Job]][JobType] != 8 || Jobs[Player[playerid][Job2]][JobType] != 8)
    {
        new car = GetPlayerVehicleID(playerid);
        if(car == 403 || car == 591)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, WHITE, "You must have the trucker job to drive this vehicle");
        }
    }
It's playerid in RemovePlayerFromVehicle and not "vehicleid"
Reply
#3

Replace
pawn Код:
new car = GetPlayerVehicleID(playerid);
With
pawn Код:
new car = GetVehicleModel(GetPlayerVehicleID(playerid));
Reply
#4

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Replace
pawn Код:
new car = GetPlayerVehicleID(playerid);
With
pawn Код:
new car = GetVehicleModel(GetPlayerVehicleID(playerid));
Tried both of your options but it still dont work this is what i have

pawn Код:
if(Jobs[Player[playerid][Job]][JobType] != 8 || Jobs[Player[playerid][Job2]][JobType] != 8)
    {
        new car = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(car == 403 || car == 591)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, WHITE, "You must have the trucker job to drive this vehicle");
        }
    }
Please help

Thanks
Reply
#5

This code is in OnPlayerEnterVehicle or in OnPlayerStateChange ?
Reply
#6

pawn Код:
if(Jobs[Player[playerid][Job]][JobType] != 8 || Jobs[Player[playerid][Job2]][JobType] != 8)
    {
        new carid = GetPlayerVehicleID(playerid);
        new carmodel = GetVehicleModel(carid);
        if(carmodel == 403 || carmodel == 591)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, WHITE, "You must have the trucker job to drive this vehicle");
        }
    }
Try it at least
Reply
#7

pawn Код:
if(Jobs[Player[playerid][Job]][JobType] != 8 || Jobs[Player[playerid][Job2]][JobType] != 8)
I assume JobType 8 is the trucking job?
If so you are checking if JobType 1 is not 8 OR JobType 2 is not 8

Which would mean that if one of the two JobTypes were not 8, then the if statement would be true, whether the other Jobtype were 8 or not.

If you replace the || (OR) with && (AND) it would check if both Jobtypes are not 8. Which I am assuming is what you want to check for.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)