SA-MP Forums Archive
Trailer health - 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: Trailer health (/showthread.php?tid=536150)



Trailer health - mamorunl - 07.09.2014

I am trying to get the trailer health when it gets detached, but it appears that the trailer does not get updated at all when detached. I have tried all the call backs including the new OnTrailerUpdate() and OnUnoccupiedVehicleUpdate().

Any ideas if I can check the health (or even if it has exploded/turned upside down)?


Re: Trailer health - Vince - 07.09.2014

As far as I know, vehicles that aren't actively being driven by players can't be damaged at all. That includes trailers. You can check if a vehicle is upside down with GetVehicleRotationQuat, but you will most likely have to convert those values to the Euler system.


Re: Trailer health - mamorunl - 08.09.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
As far as I know, vehicles that aren't actively being driven by players can't be damaged at all. That includes trailers. You can check if a vehicle is upside down with GetVehicleRotationQuat, but you will most likely have to convert those values to the Euler system.
I have a IsVehicleUpsideDown with that function, but it still says the trailer is not upside down unless it is connected to my truck.

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=446462
pawn Код:
stock IsVehicleUpsideDown(vehicleid)
{
    new
        Float:ZUP,
        Float:ZDOWN,
        Float:Unused;
    PositionFromVehicleOffset(vehicleid,0.0,0.0,1.0,Unused,Unused,ZUP);
    PositionFromVehicleOffset(vehicleid,0.0,0.0,-1.0,Unused,Unused,ZDOWN);
    return ZUP < ZDOWN;
}
If upside down, assume it's destroyed within <how many seconds till explosion?> seconds :P
Can you tell me how this function is different from the one mentioned above by Vince?