23.04.2015, 20:03
Quote:
that won't be consistant though (For example, you might get the same random 4 times and that light would stay lit)
I did it that way to change states every 115ms, in the following pattern: left, off, left, right, off, right |
![Smiley](images/smilies/smile.png)
pawn Code:
forward OnLightFlash(vehicleid);
public OnLightFlash(vehicleid)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
new states[ 3 ] =
{
2, 4, 5
};
new idx = random( 3 );
idx = ( ( states[ idx ] == Flash[ vehicleid ] ) ? ( idx == 2 ? 0 : ( idx + 1 ) ) : idx );
UpdateVehicleDamageStatus( vehicleid, panels, doors, states[ idx ], tires );
Flash[ vehicleid ] = states[ idx ];
return 1;
}