driver door damage - 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: driver door damage (
/showthread.php?tid=636217)
driver door damage -
GoldenLion - 22.06.2017
Hi, I need to make the driver door of a vehicle damaged. I know I'll first need to use GetVehicleDamageStatus to get that doors set of bits then I need to somehow change that driver door byte to 010 according to
wiki, but I'm totally lost here because I don't know how to work with bits or bytes because I never had to. I'll appreciate that if someone helped me with this. I don't even know how to properly explain that, but basically what I want to do is set the damage state of the driver door to damaged and closed.
EDIT: I literally found
this after posting this.
EDIT 2:
Couldn't get it working, here's the code:
Код:
new panels, doors, lights, tires, bonnet, boot, driver_door, passenger_door;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
bonnet = doors & 7;
boot = doors >> 8 & 7;
driver_door = 2;
passenger_door = doors >> 24 & 7;
UpdateVehicleDamageStatus(vehicleid, panels, bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24), driver_door, passenger_door);
2 is supposed to be that damaged and closed state. What's wrong?
EDIT 3: Fixed. I put driver_door and passenger_door instead of lights and tires for the last 2 parameters, had to be like this:
Код:
UpdateVehicleDamageStatus(vehicleid, panels, bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24), lights, tires);
Re: driver door damage -
GoldenLion - 23.06.2017
Bumping this.
Re: driver door damage -
Dayrion - 24.06.2017
I still don't get what you are trying to do.
Re: driver door damage -
Pottus - 24.06.2017
It shows it right on the wiki dude...
Код:
enum Door
{
DOOR_HOOD,
DOOR_TRUNK,
DOOR_DRIVER
DOOR_PASSENGER
}
enum DoorState(<<= 1)
{
IS_OPENED = 1,
IS_DAMAGED,
IS_REMOVED
}
stock GetDoorState(doorStates, Door:door, DoorState:doorState)
return (doorStates >>> (8 * door)) & doorState;