Which bit stores what?
The damage of each door (note that the hood and the trunk are also doors) will be saved in 1 byte (which is 8 bits). You can only change the state of one bit for every door at each time, so you have to call the function twice if you want to the door to be damaged and opened at the same time.
- The first bit stores whether the door is opened (value 1) or not (value 0). The door will still lock (and change the first bit to 0) if open, it's just open.
- The second bit stores whether the door is damaged (value 1) or not (value 0). If you want a damaged door to turn normal you have to remove and re-attach it undamaged.
- The third bit stores whether the door is removed (value 1) or not (value 0).
- The rest of the bits are empty.
It seems like there is no bit which stores if the door will lock or not.
Notice that the bits are counted from behind, so the first bit is the rightmost bit.
Which byte stores what?
- The first byte stores the state of the hood.
- The second byte stores the state of the trunk.
- The third byte stores the state of the drivers' door.
- The fourth byte stores the state of the co-drivers' door.
Notice that the bytes are counted from behind, so the first byte is the rightmost byte.
The following code tells that the hood is removed, the front left door is damaged, the front right door is opened and the trunk is damaged and opened:
00000001 00000010 00000011 00000100
However, SA-MP returns a decimal number so you have to convert it to a binary number first to get a result like above. What SA-MP would return given the example above is this:
First byte (hood):
Second byte (trunk):
Third byte (drivers' door):
Fourth byte (co-drivers' door):
Useful little snippet to avoid working with the bits and bytes too much.