open.mp forum
[Pawn] HELP! How to Get Status If The Vehicle go Flipped while destroyed? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] HELP! How to Get Status If The Vehicle go Flipped while destroyed? (/showthread.php?tid=2159)



HELP! How to Get Status If The Vehicle go Flipped while destroyed? - PutuSuhartawan - 2021-07-08

I saw a gamemode that supports anti-vehicle explode during a flip which is usually a scene of gasoline spilling and a fire burning. But here the purpose that will be discussed is the opposite. How can the vehicle flip itself back to its normal condition if the vehicle has really flipped and is about to explode?


RE: HELP! How to Get Status If The Vehicle go Flipped while destroyed? - Kwarde - 2021-07-08

https://sampwiki.blast.hk/wiki/GetVehicleRotation
https://sampwiki.blast.hk/wiki/GetVehicleHealth


RE: HELP! How to Get Status If The Vehicle go Flipped while destroyed? - xbruno1000x - 2021-07-09

Code:
new Float:pP[3];

SetCameraBehindPlayer(playerid);
GetPlayerPos(playerid, pP[0], pP[1], pP[2]);

SetVehiclePos(GetPlayerVehicleID(playerid), pP[0], pP[1], pP[2]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);



RE: HELP! How to Get Status If The Vehicle go Flipped while destroyed? - Pinch - 2021-07-10

SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);



Just this one line was enough.


RE: HELP! How to Get Status If The Vehicle go Flipped while destroyed? - Kwarde - 2021-07-11

Not if nobody is in the vehicle;
Quote:How can the vehicle flip itself
Might be a language barrier but I assumed (thanks to that line) the vehicle would be unmanned, in which case you would need the functions I sent.
Quote:(...) the vehicle has really flipped and is about to explode
GetVehicleRotation() to detect if it is flipped, GetVehicleHealth() to detect if it is on fire and thus about to explode. They start burning when the health is below 250, as stated on the wiki page. If it is, you indeed use SetVehicleZAngle() to flip it back.

Quote:SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
You might want to set it to the angle it's already facing. Otherwise it will always face North when flipping it. May be a tad inconvenient.