SA-MP Forums Archive
Vehicle upside down - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Vehicle upside down (/showthread.php?tid=273928)



Vehicle upside down - Incubator - 03.08.2011

Is there any way to check if a vehicle is upside down other than by the rate of health loss?

Because I found an annoying bug, that if you exit a vehicle before it flips over and than it chaches on fire, GetVehicleHealth will give the health value of the vehicle before you exit it :\ (Feel free to try and see for yourself)


Re: Vehicle upside down - Calgon - 03.08.2011

You can use this stock made by hencz:

pawn Код:
stock IsVehicleUpsideDown(vehicleid)
{
    new Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z;
    GetVehicleRotationQuat(vehicleid,quat_w,quat_x,quat_y,quat_z);
    new Float:y = atan2(2*((quat_y*quat_z)+(quat_w*quat_x)),(quat_w*quat_w)-(quat_x*quat_x)-(quat_y*quat_y)+(quat_z*quat_z));
    return (y > 90 || y < -90);
}
If you search next time, you'll be able to find a relevant result (note, the search term I used was 'site:forum.sa-mp.com IsVehicleUpsideDown' in ******).


Re: Vehicle upside down - Incubator - 03.08.2011

Wow, thank you SO MUCH, I'm sorry its just that the search function here in the forums doesn't work for me for god knows why.
You helped me alot, I spent my whole day on this crappy thing!