Vehicle upside down
#1

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

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 ******).
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)