Why does this not work - 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: Why does this not work (
/showthread.php?tid=354411)
Why does this not work -
Euan Hughes - 26.06.2012
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
Re: Why does this not work -
.FuneraL. - 26.06.2012
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"
Re: Why does this not work -
ViniBorn - 26.06.2012
Replace
pawn Код:
new car = GetPlayerVehicleID(playerid);
With
pawn Код:
new car = GetVehicleModel(GetPlayerVehicleID(playerid));
Re: Why does this not work -
Euan Hughes - 26.06.2012
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
Re: Why does this not work -
ViniBorn - 26.06.2012
This code is in OnPlayerEnterVehicle or in OnPlayerStateChange ?
Re: Why does this not work -
zombieking - 26.06.2012
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
Re: Why does this not work -
Ray0 - 26.06.2012
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.