SA-MP Forums Archive
On player enter vehicle help - 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: On player enter vehicle help (/showthread.php?tid=423964)



On player enter vehicle help - Anak - 20.03.2013

how can i add vehicle id "BOTveh2 and BOTveh3" also in this code

pawn Код:
new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(vehicle == BOTveh1 && ispassenger == 1)
    {
    }



Re: On player enter vehicle help - Anak - 20.03.2013

pawn Код:
new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(vehicle == BOTveh1 || vehicle == BOTveh2 || vehicle == BOTveh3 && ispassenger == 1)
    {
    }
right?


Re: On player enter vehicle help - Gamer_007 - 20.03.2013

Quote:
Originally Posted by Anak
Посмотреть сообщение
pawn Код:
new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(vehicle == BOTveh1 || vehicle == BOTveh2 || vehicle == BOTveh3 && ispassenger == 1)
    {
    }
right?
First of all u r spamming forum a lot.And if u know everything then why u tell us.first try that then post


Re: On player enter vehicle help - Denying - 20.03.2013

Quote:
Originally Posted by Anak
Посмотреть сообщение
pawn Код:
new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    if(vehicle == BOTveh1 || vehicle == BOTveh2 || vehicle == BOTveh3 && ispassenger == 1)
    {
    }
right?
I'm pretty sure it won't work, it will check if the vehicle id is BOTveh1, if it is it will continue, if not it will check if it's the BOTveh2, if it is it will continue.. if it is not it will check if it's the BOTveh3 and the player is a passenger.

It should be
pawn Код:
if(vehicle == BOTveh1 && ispassenger == 1 || vehicle == BOTveh2 && ispassenger == 1
|| vehicle == BOTveh3 && ispassenger == 1 ))



Re: On player enter vehicle help - 3ventic - 20.03.2013

Quote:
Originally Posted by Denying
Посмотреть сообщение
I'm pretty sure it won't work, it will check if the vehicle id is BOTveh1, if it is it will continue, if not it will check if it's the BOTveh2, if it is it will continue.. if it is not it will check if it's the BOTveh3 and the player is a passenger.

It should be
pawn Код:
if(vehicle == BOTveh1 && ispassenger == 1 || vehicle == BOTveh2 && ispassenger == 1
|| vehicle == BOTveh3 && ispassenger == 1 ))
Correct. The correct code would be
pawn Код:
if((vehicle == BOTveh1 || vehicle == BOTveh2 || vehicle == BOTveh3) && ispassenger == 1)



Re: On player enter vehicle help - Denying - 20.03.2013

Quote:
Originally Posted by 3ventic
Посмотреть сообщение
Correct. The correct code would be
pawn Код:
if((vehicle == BOTveh1 || vehicle == BOTveh2 || vehicle == BOTveh3) && ispassenger == 1)
Hah, did not know you can use it this way, thanks!


Re: On player enter vehicle help - Sky™ - 20.03.2013

or can do so that the function becomes more optimized.

pawn Код:
if(vehicle == BOTveh1 || vehicle == BOTveh2 || vehicle == BOTveh3){
    if(ispassenger){



Re: On player enter vehicle help - Anak - 20.03.2013

thanks all .. fixed