VehicleDamageStatus unknown data !
#1

Wiki : https://sampwiki.blast.hk/wiki/GetVehicleDamageStatus
From wiki I could find data structure for doors and tires however panels and lights are still a secret to me.

What are lights and panels data structure ?
Reply
#2

If nobody beats me to this, I may document it later. For now, you could print the values as a binary number to see the individual bits (I forget how, sorry).
Reply
#3

Finally some SA:MP geek answered. I will wait for your document. And thanks.
Reply
#4

geek
/gēk/
Noun
An unfashionable or socially inept person.
A person with an eccentric devotion to a particular interest: "a computer geek".

I'm not a geek; I just know some stuff.

Do you know how bits work? Like in the case of TireStates?

0000 = 4 tires inflated
1111 = 4 tires deflated

Each bit (binary digit) is either on (popped) or off (not popped). This is the same case for keys (GetPlayerKeys/OnPlayerKeyStateChange).

If you print this in OnPlayerKeyStateChange:

pawn Code:
new szString[64];
format(szString, sizeof(szString), "%019b", newkeys);
SendClientMessage(playerid, -1, szString);
it will show something like

00000000010 = you're holding key ID 2 (KEY_CROUCH). You sort of need to know how to count in binary to do this (1, 2, 4, 8, 16, 32, 64, 128, 256 etc. represents each 'bit').

You can do the same to find out which panels are broken by looking at the bits. Just use UpdateVehicleDamageStatus, then the Get version to find out.

I WILL document this soon, but I just got back from college so I cba right now.

When OnPlayerKeyStateChange's 'newkeys' is KEY_HANDBRAKE (128), the bit that represents 128 (10000000) is 'on'. If KEY_CROUCH (2 - 10) is also held, 'newkeys' will be 129 (128 + 1). It's not possible for any other key combination to make 'newkeys' 129, which is the great thing about using bits. Not sure, but I think it's called big flagging (?)

P.S. Binary numbers are represented by the '0b' prefix (similar to '0x' for hex) in PAWN (so 0b10 is 2).
Reply
#5

Interesting question. I'm testing stuff right now, on a standard four door vehicle. The Taxi.

Based on my observations:
Code:
0000 0001 0000 0000 0000 0000 0000 0000 : Rear bumper damaged
0000 0010 0000 0000 0000 0000 0000 0000 : Rear bumper heavily damaged and hanging loose
0000 0011 0000 0000 0000 0000 0000 0000 : Rear bumper detached

0000 0000 0001 0000 0000 0000 0000 0000 : Front bumper damaged
0000 0000 0010 0000 0000 0000 0000 0000 : Front bumper heavily damaged and hanging loose
0000 0000 0011 0000 0000 0000 0000 0000 : Front bumper detached
I will update this when more comes in. Unfortunately, manually updating the status doesn't seem to work.
Reply
#6

@MP2 I'll wait for your documented structure.
@Vince Thanks. Please share with me if you understood what those bits mean.
Reply
#7

So is anyone going to make a suitable answer or do I have to find out by myself ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)