UpdateVehicleDamageStatus (Looking for tutorial or some explaination)
#1

I'm looking for some one who can explain me how to use it properly ( i alrady saw samp wiki and completly understood what hapen with tieres, bu i need help with lights and doors, trunk , hood ect)
Reply
#2

what do you want todo with this info?

its basic an 32 bit cell,
and each bit stores a different "Flag" so to say,


so let me comment their door example and see if we can make this clear,

from the wiki
Код:
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
//this is read from right to left
pawn Код:
//byte 4      byte 3    byte 2     byte 1
00000001 00000010 00000011 00000100
co-drivers    drivers    trunk       hood
okay so now we know what each BYTE represents.
lets look at each BIT their are 8 per byte but we will only use
the first 3(right 3)

from the wiki
Код:
The first bit stores whether the door is opened(1) or not(0) (the door will still lock (and change the first bit to 0) if closed - its just open)
The second bit stores whether the door is damaged(1) or not(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(1) or attached(0)
The rest of the bits are empty
so for any of the bytes we want to affect we set the bits for
so i will break it down for one byte

starting with the right most bit

pawn Код:
00000001    //set the door to open
00000010    //set door to be damaged
00000100    //set door to be detached

00000011    //set the door to be opened and damaged.
now if you don't know about how to set these bits or binary numbers in general
you'll probably need to read up on that before this is clear. But i think
if you got the tires down this wont be to hard for ya.


and if you have any more question please ask,
I will explain as much as i can. The wiki don't explain the lights
at all so that one might be harder,
but i'm sure it is similar to the doors and could be figured out
with enough time and trial/error.

regards

hope this helps


EDIT:

just for your ref,
im making as set of function to make this easy,
heres what my enum looks like for all the bit for the doors



pawn Код:
enum
{
    evdHood_Opened          =   1,
    evdHood_Damaged         =   2,
    evdHood_Removed         =   4,
   
    evdTrunk_Opened         =   256,
    evdTrunk_Damaged        =   512,
    evdTrunk_Removed        =   1024,
   
    evdDriver_Opened        =   65536,
    evdDriver_Damaged       =   131072,
    evdDriver_Removed       =   262144,
   
    evdPassenger_Opened     =   16777216,
    evdPassenger_Damaged    =   33554432,
    evdPassenger_Removed    =   67108864
}

//and for the lights


enum
{
    evdLights_Drivers       =   1,     
    evdLights_Passengers    =   4,      
    evdLights_Rear          =   64     
}
Reply
#3

thnks a lot ++rep for you !
Reply
#4

i dont understand than .. can u help me too ?
i need a code for remove in all my GM car dors Driver and Co Driver
please paste me a code
Reply
#5

Quote:
Originally Posted by Toxik
Посмотреть сообщение
i dont understand than .. can u help me too ?
i need a code for remove in all my GM car dors Driver and Co Driver
please paste me a code
Quote:
Originally Posted by Jonny5
Посмотреть сообщение
Код:
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
//this is read from right to left
pawn Код:
//byte 4      byte 3    byte 2     byte 1
00000001 00000010 00000011 00000100
co-drivers    drivers    trunk       hood
Код:
The first bit stores whether the door is opened(1) or not(0) (the door will still lock (and change the first bit to 0) if closed - its just open)
The second bit stores whether the door is damaged(1) or not(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(1) or attached(0)
The rest of the bits are empty
pawn Код:
00000001    //set the door to open
00000010    //set door to be damaged
00000100    //set door to be detached

00000011    //set the door to be opened and damaged.
For every vehicle, you will need to set the values in a for loop for each vehicle, e.g
pawn Код:
//OnGameModeInit or the function you create all your vehicles in
for(new i = 0; i < MAX_VEHICLES; i++) UpdateVehicleDamageStatus(i, panels, doors, lights, tires);
You will probably need to do that on OnVehicleSpawn and whenever you create a new vehicle (e.g by a command) in order for them to always be removed, however we aren't here to do everything for you.
Reply
#6

well okay
Reply
#7

Toxik can't you see lol, you're bumping an 2014 topic.
Reply
#8

yup I see but I need the code for remove all 5 doors from the car
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)