[STANDALONE] Deployable Emergency Vehicle Light

deployable_light

:rotating_light: Deployable Emergency Vehicle Light

Whether it is undercover law enforcement, paramedic services or road-workers, this deployable emergency light will make them noticeable by everyone. Equip any vehicle with either a blue, red or orange emergency light on the spot through this highly configurable, but easily implementable script.

:shopping_cart: Get it here: gamzkystore.com

:question: Support: Discord

:movie_camera: Detailed preview: Youtube

Features

  • Works as a standalone script without any dependencies, only if you wish to make use of the item will you need a respective inventory script (esx, qb, ox and others).
  • The used light props are included with the files and not encrypted.
  • Will automatically work on any vehicle with a roof without any additional configuration (unless the vehicle is blacklisted), so no need to configure individual light positions for each vehicle.
  • Special vehicles without for instance a roof, can be manually configured to use a suitable position for the light.
  • The used light color (blue, red, orange) can be uniquely configured for different vehicles.
  • It is also possible to make the light blink instead of rotate.
  • Possibility to also enable a toggleable siren, which can be used when the light is deployed (Custom sirens are supported).
  • Light properties, animations, vehicle configurations, sirens and more are configurable.
  • Fully synchronized between players and optimized to run smoothly even when multiple lights are simultaneously deployed (only nearby vehicle lights are displayed).

Resmon: Idle: 0.00ms - Active on 1 vehicle: 0.07ms - Active on 10 close-by vehicles: 0.13ms

How it works

  • Deploy light: Simply use the item or command whenever driving a vehicle which is not blacklisted in the configuration, to deploy the emergency light.
  • Light deployed: A default light configuration is used, which automatically finds a suitable position for the light on the roof. So no need to configure all vehicles individually. It is still possible to uniquely configure specific vehicles, to use a different place-animation, light-color, light-position, sirens etc.
  • Toggle Siren: With the light deployed, you can also use a siren through L-SHIFT (also configurable and can be disabled).
  • Removing light: The light can be removed again, by using the command or L-CRTL (also configurable).

Core/framework related functions are fully accessible in the encrypted version, feel free to create a support ticket in our Discord in case of questions.

Config
Config = {}

-- If set to true, only the light closest to the player will fully display. Any additional lights from vehicles further away will be optimized to reduce performance impact
-- In general, you can leave this off as the script is already optimized well, but if you expect 10+ vehicles in a compact area to be using the light simultaneously you could consider turning this on for a slightly better (ms) run-time
Config.OptimizeMode = false

-- The speed multiplier for the light rotation, larger value means faster rotation
Config.LightRotationSpeedMultiplier = 1.15

-- The required item to deploy a light, this can only be used if you have an inventory system to handle items
Config.RequiredItem = {
    Enabled = false,
    Name = 'deployable_light'
}

-- Enable the command to toggle light on a vehicle (command = \light), you can use this if you do not have an inventory system to handle items
Config.EnableLightCommand = true

-- The key which you can use to remove a light from the vehicle
Config.RemoveLightKey = 36 -- L-CTRL

-- If you also want an optional siren to be usable with the deployable light, set Enabled to true
Config.Siren = {
    Enabled = true,
    Key = 21, -- L-SHIFT
}

-- The blacklist for classes and models which cannot use the light
Config.Blacklist = {
    ['classes'] = { 8, 13, 14, 15, 16, 21, 22 },
    ['models'] = { `adder` }
}

-- The settings corresponding to the light effect
Config.LightSettings = {
    ['red'] = {
        LightPropHash = `hei_prop_wall_alarm_red`, -- Prop of the light
        RGB = vector3(255, 0, 0),                  -- RGB color of the light
        Distance = 12.0,                           -- The maximum distance the light can reach
        Brightness = 5.0,                          -- The brightness of the light
        Roundness = 2.0,                           -- "smoothness" of the circle edge
        Radius = 60.0,                             -- The radius size of the light
        Falloff = 3.0,                             -- The falloff size of the light's edge
    },
    ['blue'] = {
        LightPropHash = `hei_prop_wall_alarm_blue`,
        RGB = vector3(0, 0, 255),
        Distance = 12.0,
        Brightness = 5.0,
        Roundness = 2.0,
        Radius = 60.0,
        Falloff = 3.0,
    },
    ['orange'] = {
        LightPropHash = `hei_prop_wall_alarm_orange`,
        RGB = vector3(242, 87, 10),
        Distance = 12.0,
        Brightness = 5.0,
        Roundness = 2.0,
        Radius = 60.0,
        Falloff = 3.0,
    }
}

-- The defined animations applied when attaching/detaching the light
Config.Animation = {
    ['default'] = {
        Dict = 'veh@drivebystd_ds_grenades',
        Name = 'throw_180r',
        AnimTime = 500,
        AttachBoneId = 18905, -- Left hand
        HandPosition = vector3(0.1, 0.0, 0.1),
        HandRotation = vector3(90.0, 0.0, 0.0),
    },
    ['front_window'] = {
        Dict = 'veh@van@ds@base',
        Name = 'change_station',
        AnimTime = 1500,
        AttachBoneId = 57005, -- Right hand
        HandPosition = vector3(0.1, 0.0, -0.05),
        HandRotation = vector3(180.0, 0.0, 0.0),
    },
    ['quad'] = {
        Dict = 'veh@bike@quad@front@base',
        Name = 'change_station',
        AnimTime = 1500,
        AttachBoneId = 57005, -- Right hand
        HandPosition = vector3(0.1, 0.05, 0.0),
        HandRotation = vector3(-90.0, 0.0, 0.0),
    },
}

-- The attachment information for the light, default is always used unless specified otherwise.
-- Position: Defines the light-prop coordinates w.r.t. the center of the vehicle. Leave at vector3(0.0, 0.0, 0.0) and the script will automatically try to estimate a good position.
-- Rotation: Defines the light-prop rotation.
-- Animation: The animation to play when attaching/detaching the light.
-- LightSetting: The light setting to use for the light.
-- SirenName: The siren name that can be used when the light is enabled, only works if Config.Siren.Enabled is set to true. If SirenName is not defined, the siren cannot be used for that vehicle.
Config.VehicleData = {
    ['default'] = { Position = vector3(0.0, 0.0, 0.0), Rotation = vector3(-95.0, -5.0, 0.0), Animation = 'default', LightSetting = 'red', SirenName = 'VEHICLES_HORNS_SIREN_1' },
    [`baller`] = { Position = vector3(0.0, 0.0, 0.0), Rotation = vector3(-90.0, -5.0, 0.0), Animation = 'default', LightSetting = 'blue', SirenName = 'VEHICLES_HORNS_SIREN_1' },
    [`blazer2`] = { Position = vector3(0.0, 0.15, 0.4), Rotation = vector3(-90.0, -0.0, 0.0), Animation = 'quad', LightSetting = 'red', SirenName = 'VEHICLES_HORNS_SIREN_2' },
    [`burrito4`] = { Position = vector3(0.0, 0.0, 0.0), Rotation = vector3(-95.0, -5.0, 0.0), Animation = 'default', LightSetting = 'orange' },
    [`zorrusso`] = { Position = vector3(0.3, 0.9, 0.29), Rotation = vector3(-90.0, 0.0, 0.0), Animation = 'front_window', LightSetting = 'blue' },
    -- You can add more unique vehicle settings here if you wish, the key should be the vehicle model hash
}

Code is accessible No, but there is an unencrypted version
Subscription-based No
Lines (approximately) 714
Requirements None
Support Yes
6 Likes

Nice work :+1:

1 Like

Very cool! Great work!

1 Like

Can this be integrated with LVC for custom sirens?

Hi Stark,

You can customize the siren in the configuration. The script itself does not interact with LVC.

Hi, is there a way to add Job restriction ?

Hi MalibuSantez,

Yes that is possible (also in the encrypted version). There is a function:

Functions.CanPlayerDeployLight = function()
    return true
end

This can be modified to include a job-restriction, we are also happy to assist with this :smile:

Nice good to know, thanks :slight_smile:

is there a way to make it brighter on daytime i almost dosent see it at all

There is a brightness option in the config under Config.LightSettings which you can try to increase. But it is mostly limited by GTA itself to what extend you can make lights more visible during the day.

Whats the max value do u know that ?

There is no maximum value documented on the FiveM docs, so I think you will have to test through trial and error to what extent you can increase the value.

There are also some more parameters in Config.Lightsettings which you can try to tweak, distance for instance configures the maximum distance the light can reach.

The parameters that you can change in the config correspond to this function: DrawSpotLight - FiveM Natives @ Cfx.re Docs

This includes some extra documentation on what each parameter does which might come in handy when tweaking the config.

30.0 brightness seems to work good at daytime @Eviate idk maybe improve that value a bit down but its good there just lettin ya know

Good to know, thanks! :ok_hand:t2:

how about making it safe on restarts so it stays on the car.

You mean server-restarts?

That would be quite a lot of work, so I don’t think that will be added unfortunately.

Or a feature to toggle a light on the roof on/of instead of takeing it off everytime

Thanks for the suggestion, always appreciated :+1:t2:

I am planning on adding an option to make the light blink instead of rotate somewhere in the future. Maybe if this is easy to implement I will also add this to the update but I cannot make any promises :smile:

Blink would be cool

New Update (1.1.0)

  • You can now also configure a light to blink instead of rotate. This can be done by adding LightBehaviour = 'blinking' in the corresponding Config.VehicleData configuration of a specific vehicle.
  • Added support for custom sirens. You can enable this feature in Config.Siren and define a to be used AudioRef in Config.VehicleData.
1 Like