OnPlayerCrashVehicle - Emmet_ - 05.01.2014
OnPlayerCrashVehicle
Introduction
This include simply detects if a player crashes their vehicle. This is done by comparing the vehicle's last health and speed, and checking if both of them dropped abruptly.
How does it work?
As explained above, the system checks if the vehicle's health or speed dropped unexpectedly. I've tested this extensively and it seems to work great. The callback is not fired when a player shoots at the vehicle.
Installation
Simply download the include and place it inside your include folder.
pawn Код:
#include <a_samp>
#include <OPVA>
Now you can use the callback correspondingly:
pawn Код:
public OnPlayerCrashVehicle(playerid, vehicleid)
{
return 1;
}
And you're done!
There are also some definitions at the top of the include. Feel free to adjust them accordingly, but be sure you know what you're doing first!
Damage status updating
I am aware that there is a callback for this already, however that specific callback is fired when a vehicle's damage status is updated. It is also called when a player shoots at a vehicle, so it really isn't reliable to use for this purpose.
Download
Solidfiles
Pastebin
Re: OnPlayerCrashVehicle -
Delete_ - 05.01.2014
Cool, Congratulations.
Re: OnPlayerCrashVehicle -
newbie scripter - 05.01.2014
Nice one, could be nice in some Servers. Is it possible to deduct the part of car which got crashed?
Re: OnPlayerCrashVehicle - Emmet_ - 05.01.2014
Quote:
Originally Posted by newbie scripter
Nice one, could be nice in some Servers. Is it possible to deduct the part of car which got crashed?
|
I'm not sure that's possible yet.
Re: OnPlayerCrashVehicle -
iZN - 05.01.2014
Quote:
Originally Posted by newbie scripter
Nice one, could be nice in some Servers. Is it possible to deduct the part of car which got crashed?
|
https://sampwiki.blast.hk/wiki/GetVehicleDamageStatus
Re: OnPlayerCrashVehicle - Emmet_ - 05.01.2014
I'm creating three new callbacks for this include:
pawn Код:
// Called when a player rams into a vehicle.
public OnPlayerCollideVehicle(playerid, vehicleid) {}
// Called when a player rams into an object.
public OnPlayerCollideObject(playerid, objectid) {}
// Called when a player rams into a player.
public OnPlayerCollidePlayer(playerid, targetid) {}
Should be released shortly, although I might have a bit of trouble with the second one!
Re: OnPlayerCrashVehicle -
Ada32 - 05.01.2014
Quote:
Originally Posted by Emmet_
although I might have a bit of trouble with the second one!
|
you shouldn't, but it will be ugly!
edit, scratch that. you should be fine.
Re: OnPlayerCrashVehicle -
newbie scripter - 06.01.2014
Quote:
Originally Posted by Emmet_
I'm creating three new callbacks for this include:
pawn Код:
// Called when a player rams into a vehicle. public OnPlayerCollideVehicle(playerid, vehicleid) {}
// Called when a player rams into an object. public OnPlayerCollideObject(playerid, objectid) {}
// Called when a player rams into a player. public OnPlayerCollidePlayer(playerid, targetid) {}
Should be released shortly, although I might have a bit of trouble with the second one!
|
Really? OnPlayerCollideObject?? i really wanted that callback. If possible can u make a OnObjectCollideObject?
Re: OnPlayerCrashVehicle -
Ada32 - 06.01.2014
we got some physics nerds
https://sampforum.blast.hk/showthread.php?tid=446286
Re: OnPlayerCrashVehicle -
SimonItaly - 22.05.2014
Quote:
Originally Posted by newbie scripter
Is it possible to deduct the part of car which got crashed?
|
https://sampwiki.blast.hk/wiki/OnVehicleDamageStatusUpdate