Flashing lights!
#1

Hey! I just wanted to ask if it's possible to make it so when a player unlocks his car, that it sets the car lights on then off immediately - just to add a little flash effect on the vehicle lights.

Here is the code.
PHP код:
CMD:lock(playeridparams[])
{
    new 
str[128], id GetNearestVehicle(playerid15.0);
     if(
id != INVALID_VEHICLE_ID)
     {
        if (
Vehicles[id][Owner] == Character[playerid][ID])
        {
            if(
Vehicles[id][Locked] == 0// IF IT ISNT LOCKED
            
{
                
SetVehicleParamsEx(idEngine[id], Lights[id], alarm[id], 1bonnet[id], boot[id], objective[id]);
                
doors[id] = 1;
                                
PlayerPlaySound(playerid10530.00.010.0);
                
GameTextForPlayer(playerid"LOCKED"20004);
                
// Lock the vehicle status
                
Vehicles[id][Locked] = 1;
            }
            else if (
Vehicles[id][Locked] == 1// IF IT IS LOCKED
            
{
                
SetVehicleParamsEx(idEngine[id], Lights[id], alarm[id], 0bonnet[id], boot[id], objective[id]);
                
doors[id] = 0;
                                 
PlayerPlaySound(playerid10520.00.010.0);
                
GameTextForPlayer(playerid"UNLOCKED"20004);
                                
// Vehicle lights flash here once
                // Unlock the vehicle status
                
Vehicles[id][Locked] = 0;
            }
        } 
Thank you.
Reply
#2

just run a timer, has to be quick timer i guess. to turn them on and off.. passing the vehicleID

Код:
forward FlashLights(vehicleid);
public FlashLights(vehicleid)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(lights>0){
    SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, objective);
}else{
    SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
    SetTimerEx("FlashLights", 800, false, "i", vehicleid);
}
}
something like that maybe ?
just use FlashLights(vehicleid); to flash the lights
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)