OnPlayerExitVehicle
#1

This is at the OnPlayerExitVehcile callback and it works perfectly,but this is for the bike dmv,and if during the exam i press F to exit the vehicle i fail the exam,but if i hit something and i get thrown off the bike,i can get back up on it,the callback isn't called,it's like i didn't exit the vehicle,what can i do >>

if(vehicleid == BikeCars[0]){
DisablePlayerRaceCheckpoint(playerid);
BikeCP[playerid] = 0;
DestroyVehicle(vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Fail:You left the exam car");
}
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerExitVehicle

Not called if the player falls off a bike or is removed from a vehicle by other means such as using SetPlayerPos.

You must use OnPlayerStateChange and check if their old state is PLAYER_STATE_DRIVER or PLAYER_STATE_PASSENGER and their new state is PLAYER_STATE_ONFOOT.
Reply
#3

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/OnPlayerExitVehicle

Not called if the player falls off a bike or is removed from a vehicle by other means such as using SetPlayerPos.

You must use OnPlayerStateChange and check if their old state is PLAYER_STATE_DRIVER or PLAYER_STATE_PASSENGER and their new state is PLAYER_STATE_ONFOOT.
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT){

new vehicleid = GetPlayerVehicleID(playerid);

if(BikeCP[playerid] != 0){
DisablePlayerRaceCheckpoint(playerid);
DestroyVehicle(vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Fail:Ai picat de pe motocicleta de examen");
BikeCP[playerid] = 0;
}
}
it all gets executed exept DestroyVehicle(playeried),the bike simply doesn't dissapear
Reply
#4

Because the player is not on the bike anymore dude! You need to save their last vehicle id when they enter a vehicle.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)