On player enter vehicle help
#1

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

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

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

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
Reply
#4

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 ))
Reply
#5

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)
Reply
#6

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!
Reply
#7

or can do so that the function becomes more optimized.

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

thanks all .. fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)