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).