OnPlayerExitVehicle - 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: OnPlayerExitVehicle (
/showthread.php?tid=664722)
OnPlayerExitVehicle -
bosmania - 09.03.2019
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");
}
Re: OnPlayerExitVehicle -
v1k1nG - 09.03.2019
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.
Re: OnPlayerExitVehicle -
bosmania - 09.03.2019
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
Re: OnPlayerExitVehicle -
Pottus - 09.03.2019
Because the player is not on the bike anymore dude! You need to save their last vehicle id when they enter a vehicle.