Binary D:
#1

I hate binary.

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

I need to know whether the bonnet/hood is open or not.


The bits I'm interested in are opened and removed. If need to check if either are true.
Reply
#2

First byte (8 bits): hood
Opened: doors & 1
Removed: doors & 4
Reply
#3

Wouldn't removed be 3 not 4?
Reply
#4

Quote:
Originally Posted by MP2
Посмотреть сообщение
Wouldn't removed be 3 not 4?
No. Any subsequent bit is the previous bit times 2. 1, 2, 4, 8, 16, 32, ...
Reply
#5

pawn Код:
//new panels, doors, lights, tires
//GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
//bonnet = doors & 0x7; - i kinda forgot what this does


if(doors & 0b00000100) // hood is removed
if(doors & 0b00000010) // hood is damaged
if(doors & 0b00000011) // hood is damaged and opened
if(doors & 0b00000001) // hood is opened
Can't remember it totally, but this should be a start?
Reply
#6

Aren't those functions kind of old ?
Why dont you use GetVehicleParamsEx & SetVehicleParamsEx ?
Reply
#7

Quote:
Originally Posted by The__
Посмотреть сообщение
Aren't those functions kind of old ?
Why dont you use GetVehicleParamsEx & SetVehicleParamsEx ?
Good Idea, can't believe I didn't think about that. Unless he needs the 'damaged option' but he didn't say he needed that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)