SA-MP Forums Archive
What's wrong with IsPlayerInVehicle(playerid,vehicleid); - 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: What's wrong with IsPlayerInVehicle(playerid,vehicleid); (/showthread.php?tid=550195)



What's wrong with IsPlayerInVehicle(playerid,vehicleid); - Galletziz - 11.12.2014

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER){
        if(IsPlayerInVehicle(playerid,482)){
            print("player in burrito");
            TogglePlayerDynamicCP(playerid,businesscp_id,1);
        }
    }
    return 1;
}
I don't understand why the instruction if with this function doesn't works, is very strange, if i remove it, all works fine, the CP toggle on for player, but when i add this instruction, it considers as if im not in this vehicle id.. why?


Re: What's wrong with IsPlayerInVehicle(playerid,vehicleid); - Vince - 11.12.2014

You need to use GetVehicleModel instead. Pay close attention to the name of the parameters. If it says "vehicleid" it means the unique id of the vehicle, ranging from 1 to 2000. If it says "modelid" it refers to the vehicle's non-unique model, ranging from 400 to 611.


Re: What's wrong with IsPlayerInVehicle(playerid,vehicleid); - Galletziz - 11.12.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
You need to use GetVehicleModel instead. Pay close attention to the name of the parameters. If it says "vehicleid" it means the unique id of the vehicle, ranging from 1 to 2000. If it says "modelid" it refers to the vehicle's non-unique model, ranging from 400 to 611.
Hell yeah, i have look right now in Wiki samp and i have understand the same of you have explain me, anyways, thanks for the help, buddy.. +repped.