IsPilotVehicle is never called
#1

The function is never called for some reason
I tried debugging using printf the vehicle id but nothing pops on console

stock and usage:

Stock
PHP код:
stock IsPilotVehicle(vehicleid)
{
    
printf("Test: %s."vehicleid);
    for(new 
i=0i<2i++)
    {
        if(
vehicleid == JobInfo[JOB_PILOT][jCars][i]) return 1;
    }
    return 
0;

OnPlayerEnterVehicle

PHP код:
else if(IsPilotVehicle(vehicleid))
        {
            
printf("Test = %i."vehicleid);
            if(
PlayerInfo[playerid][pJob] != JOB_PILOT && PlayerInfo[playerid][pVIPJob] != JOB_PILOT)
            {
                
printf("TEST = %i.",vehicleid);
                  new 
Float:pos[3];
                
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SendClientMessage(playeridCOLOR_ORANGE"You cannot start the engine as it belongs to the Los Santos Airline Company.");
            }
        } 
Reply
#2

Is something else inside of your "if - else - else if " construct called? Just add print("Test"); or smth to check it
Reply
#3

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
Is something else inside of your "if - else - else if " construct called? Just add print("Test"); or smth to check it
Print shows nothing
Like the else is never called
Reply
#4

First off you use %s for an integer, make it a %d or %i.

Also, what does the if before "else if(IsPilotVehicle(vehicleid))" check for?
Reply
#5

Quote:
Originally Posted by NaS
Посмотреть сообщение
First off you use %s for an integer, make it a %d or %i.

Also, what does the if before "else if(IsPilotVehicle(vehicleid))" check for?
The rest of the public OnPlayerEnterVehicle
If hes not a cop cant enter LSPD cars, if hes not a GOV cant enter GOV cars etc etc
Reply
#6

Anyone ?
Reply
#7

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
The rest of the public OnPlayerEnterVehicle
If hes not a cop cant enter LSPD cars, if hes not a GOV cant enter GOV cars etc etc
Does that work correctly (the ones before the pilot)?

It seems that the whole else if doesn't get called, so the if structure just before your IsPilotVehicle could be wrong.

And did you change the %s to %d in the first printf inside your IsPilotVehicle function?
Reply
#8

Quote:
Originally Posted by NaS
Посмотреть сообщение
Does that work correctly (the ones before the pilot)?

It seems that the whole else if doesn't get called, so the if structure just before your IsPilotVehicle could be wrong.

And did you change the %s to %d in the first printf inside your IsPilotVehicle function?
The else ifs before the IsPilotVehicle works perfect
I tried changing the else if to if, maybe it would work
and yeah I changed s to d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)