[FilterScript] [0.3.7] Flashing Police Lights (ELM)
#6

Quote:
Originally Posted by TakeiT
View Post
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
aight, can be fixed with 1 line using the ternary operator

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;
}
Reply


Messages In This Thread
[0.3.7] Flashing Police Lights (ELM) - by TakeiT - 23.04.2015, 18:17
Re : [0.3.7] Flashing Police Lights (ELM) - by XDamienX007 - 23.04.2015, 18:42
Re: [0.3.7] Flashing Police Lights (ELM) - by Smileys - 23.04.2015, 19:10
Re: [0.3.7] Flashing Police Lights (ELM) - by TakeiT - 23.04.2015, 19:16
Re : [0.3.7] Flashing Police Lights (ELM) - by streetpeace - 23.04.2015, 19:46
Re: [0.3.7] Flashing Police Lights (ELM) - by Smileys - 23.04.2015, 20:03
Re: [0.3.7] Flashing Police Lights (ELM) - by d0nTtoucH - 24.04.2015, 11:49
Re: [0.3.7] Flashing Police Lights (ELM) - by TakeiT - 24.04.2015, 15:01
Re: [0.3.7] Flashing Police Lights (ELM) - by Maximun - 24.04.2015, 15:34
Re: [0.3.7] Flashing Police Lights (ELM) - by SpikY_ - 24.04.2015, 16:50

Forum Jump:


Users browsing this thread: 1 Guest(s)