[Release] Emergency Vehicle Siren Codes

Hello!

This script gives emergency vehicle drivers the ability to swap between code 1, 2, and 3 by pressing hotkeys.

Code 1: LCTRL + 1 (normal)
Code 2: LCTRL + 2 (lights)
Code 3: LCTRL + 3 (lights+sirens)

I had trouble finding production-ready code that would work properly, so threw together code I found around the forum.

A large portion of the logic behind this code was sourced from this thread.
Considering this, shout out to @lowheartrate & @Radbug for giving me a head start.

Source: ddPoliceCodes.zip (1.3 KB)

Installation:

  1. Unzip “ddPoliceCodes” into resources folder
  2. Add “start ddPoliceCodes” to your “server.cfg” file.

I also added optional commands to set the codes. They can be found commented out at the bottom of cl_policeSiren.lua

I know this isn’t huge, but cut me a break-- it’s my first post!

More to come!
-DipDuo

4 Likes

Just a tip, in your server file, you did this:

    local players = GetPlayers()
    for _,player in pairs(players) do
        TriggerClientEvent('codeOne', player, vehicle)
    end

To send an event to all players, all you need to do is put -1 in place of the player’s source, for example:

RegisterServerEvent('codeOne')
AddEventHandler('codeOne', function(vehicle)
    TriggerClientEvent('codeOne', -1, vehicle)
end)

Haven’t tested the resource in-game, but it looks interesting; good job :+1:

1 Like

WHy not use lux? o.O

WHy not? o.O

@MrDaGree @J.Manlet My background is in web application development. I have been looking for a way to dive into game modding. I love GTA & it seems like a great platform to start learning more about this subgenre of coding.

I’m not trying to make the next “big” server, just learn as much as I can about the scripting behind it.

If re-inventing the wheel makes me a better developer, then i’m all in!

1 Like

Just tried it out, seems like a much better solution.

Thanks for filling me in!

(updated release code)

This is a good release in my opinion and the keybindings seem pretty good. Better than lux, this is more of an els style of lights keybindings so yeah. Good job mate :slight_smile:

Also lux veh control is flawed in too many ways. It’s old and outdated. I re-did mine but i might add this too.

Looking good, will use it instead of Lux if it has siren selection like lux do