SA-MP Forums Archive
Vehicle damage status - Lights & Panels - 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: Vehicle damage status - Lights & Panels (/showthread.php?tid=358351)



Vehicle damage status - Lights & Panels - Siralos - 10.07.2012

Hello,

I'm scripting now a new repair system for my GM. It's clear for me the way tires and doors work, but... could somebody send me a link or explain the values returned when calling GetVehicleDamageStatus on Lights and Panels?

Thanks and kind regards,
Siralos


Re: Vehicle damage status - Lights & Panels - nepstep - 10.07.2012

Panels you mean?
I didn't clearly understand what you mean but if is this here is a stock coming with samp server at vehicleutils inside includes for Vehicle Lights
pawn Code:
stock ToggleVehicleLights(vid)
{
     new engine,lights,alarm,doors,bonnet,boot,objective;
     GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
     if(lights == VEHICLE_PARAMS_UNSET || lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
     else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
}



Re: Vehicle damage status - Lights & Panels - clarencecuzz - 10.07.2012

https://sampwiki.blast.hk/wiki/GetVehicleDamageStatus


Respuesta: Vehicle damage status - Lights & Panels - Siralos - 10.07.2012

Hello,

What I need to understand is the meaning of these arguments returned by GetVehicleDamageStatus(vehicleid, &panels, &doors, &lights, &tires)

The integer to store the panel damage data in, passed by reference.
The integer to store the light damage data in, passed by reference.

If they return, for example: 150... What does that mean in terms of visualization of the car?

Tires and Doors are explained correctly in sa-mp wiki, but not lights or panels.

Thanks in advance and regards,
Siralos


Respuesta: Vehicle damage status - Lights & Panels - Siralos - 10.07.2012

Anybody has every used this?
Thanks!


Re: Vehicle damage status - Lights & Panels - clarencecuzz - 10.07.2012

Panels and Lights return 1 if damaged, or 0 if undamaged.


Respuesta: Re: Vehicle damage status - Lights & Panels - Siralos - 10.07.2012

Quote:
Originally Posted by clarencecuzz
View Post
Panels and Lights return 1 if damaged, or 0 if undamaged.
Thanks! So, no distinction among the right or left light; that's what I needed to know.

Regards,
Siralos


Re: Vehicle damage status - Lights & Panels - clarencecuzz - 10.07.2012

To be honest, I'm not completely sure, but my guess is very small compared to what others may know. There should be a distinction between right and left, but I'm not sure how this function handles it. Sorry


Re: Respuesta: Re: Vehicle damage status - Lights & Panels - Kar - 10.07.2012

Quote:
Originally Posted by Siralos
View Post
Thanks! So, no distinction among the right or left light; that's what I needed to know.

Regards,
Siralos
Yes there is, they are stored in bits

Use this

pawn Code:
encode_lights(light1, light2, light3, light4)
{
    return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
UpdateVehicleDamageStatus(vehicleid, panels, doors, encode_lights(0, 0, 0, 0), tires);



Respuesta: Re: Respuesta: Re: Vehicle damage status - Lights & Panels - Siralos - 10.07.2012

Quote:
Originally Posted by Kar
View Post
Yes there is, they are stored in bits

Use this

pawn Code:
encode_lights(light1, light2, light3, light4)
{
    return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
UpdateVehicleDamageStatus(vehicleid, panels, doors, encode_lights(0, 0, 0, 0), tires);
Thank you very much. What about panels?

Thanks!