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



GetVehicleDamageStatus - Marshas - 02.04.2019

Hello everyone. How should I properly use GetVehicleDamageStatus, UpdateVehicleDamageStatus, and most important - store it in mysql database? I can't fully understand how does bits works, how is they used in damage status, how to export them properly (wiki says, that sa-mp returns a decimal number, and using encode_(panels, doors, tires, lights) I should get every part damage state separately). I read tutorials about bit, but that did not helped for me. Can someone provide an example, how to properly get, update, and most important - store vehicle damage status in database. That type of column should I use? Integer, Bit, or any other type? Thanks in advance!


Re: GetVehicleDamageStatus - SymonClash - 02.04.2019

Panels, doors, lights & tires are ALL integers.

And in this case, as the wheel says, integers should be saved with the %d specifier.

Unless you're saving vehicle health (which is a FLOAT - so %f).

pawn Code:
new panels, doors, lights, tires;

GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);

printf("Vehicle Info: [Panels] : %d - [Doors] : %d - [Lights] : %d - [Tires] : %d", panels, doors, lights, tires);
Remember, panels and doors are both 0-1.

Save it like you save every other variable (such like player kills or deaths), there is no difference.