Random damage car
#1

Hello,
I try to make a car that will be randomly broken parts. It works random pierced gums and random break light. But I can not randomly break down the door. I create 10 cars, but the doors are always undamaged. Why ?

Код:
new vehicleid = CreateVehicle(...);
UpdateVehicleDamageStatus(vehicleid,random(16),random(16),random(16),random(16));
SetVehicleParamsEx(vehicleid,random(2),1,0,1,random(2),random(2),0);
Thanks for any response.
Reply
#2

Consult the information here: https://sampwiki.blast.hk/wiki/DoorStates

A random(16) will only affect the first 4 bits, i.e. the hood. Try:

PHP код:
new doorStates;

for(new 
0cellbits+= 8)
{
    
doorStates |= (random(2) << 1) << i;
}

// now use doorStates in SetVehicleParams ... 
Reply
#3

#Vince, Can we use also the function to close the door of the driver.
e.g: we all know that when a player press "G" beside vehicle locked we see an animation happen, but nothing happens beside door driver, I want the same thing for the door, is that possible?
Reply
#4

Closing all the doors is very simple since there's no randomness involved. You can get away with this:

PHP код:
doorStates &= ~0x01010101
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)