[Include] OnPlayerCrashVehicle
#1

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
Reply
#2

Cool, Congratulations.
Reply
#3

Nice one, could be nice in some Servers. Is it possible to deduct the part of car which got crashed?
Reply
#4

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.
Reply
#5

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
Reply
#6

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!
Reply
#7

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.
Reply
#8

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?
Reply
#9

we got some physics nerds https://sampforum.blast.hk/showthread.php?tid=446286
Reply
#10

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
Is it possible to deduct the part of car which got crashed?
https://sampwiki.blast.hk/wiki/OnVehicleDamageStatusUpdate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)