[Release] WM-ServerSirens - FiveM Server Side Siren Resource - Walshey & Marcus

Okay, can you upload the rest of the code as a script so formatting doesn’t take place please?

Fixed.
Restarting the PC helped :smiley:

But i have a new problem, how to check car model like this code

local vehicle = GetVehiclePedIsUsing(PlayerPedId())
local model = GetEntityModel(vehicle)
if (model == GetHashKey(‘police2’) then
PlaySoundFromEntity(-1, “SIREN_ALPHA”, veh, “DLC_WMSIRENS_SOUNDSET”, 0, 0)
end

I have error with using this code in my code

Error parsing script @lux_vehcontrol/client.lua in resource lux_vehcontrol: @lux_vehcontrol/client.lua:187: ‘)’ unexpected symbol near ‘then’

my code

function SetLxSirenStateForVeh(veh, newstate)
if DoesEntityExist(veh) and not IsEntityDead(veh) then
if newstate ~= state_lxsiren[veh] then
if snd_lxsiren[veh] ~= nil then
StopSound(snd_lxsiren[veh])
ReleaseSoundId(snd_lxsiren[veh])
snd_lxsiren[veh] = nil
end
if newstate == 1 then
if useFiretruckSiren(veh) then
TogMuteDfltSrnForVeh(veh, false)
else
local vehicle = GetVehiclePedIsUsing(PlayerPedId())
local model = GetEntityModel(vehicle)
if (model == GetHashKey(‘police2’) then
PlaySoundFromEntity(-1, “SIREN_ALPHA”, veh, “DLC_WMSIRENS_SOUNDSET”, 0, 0)
end
elseif newstate == 2 then
snd_lxsiren[veh] = GetSoundId()
PlaySoundFromEntity(snd_lxsiren[veh], “SIREN_BRAVO”, veh, “DLC_WMSIRENS_SOUNDSET”, 0, 0)
TogMuteDfltSrnForVeh(veh, true)
elseif newstate == 3 then
snd_lxsiren[veh] = GetSoundId()
if useFiretruckSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], “SIREN_CHARLIE”, veh, “DLC_WMSIRENS_SOUNDSET”, 0, 0)
else
PlaySoundFromEntity(snd_lxsiren[veh], “SIREN_CHARLIE”, veh, “DLC_WMSIRENS_SOUNDSET”, 0, 0)
end
TogMuteDfltSrnForVeh(veh, true)
else
TogMuteDfltSrnForVeh(veh, true)
end
state_lxsiren[veh] = newstate
end
end
end

Hi Scania01,
May I know how u modified your ELS script to make it work with WM-ServerSirens?
I can’t seem to get it to work.

Why would you comment out your solution when it could help other users???

1 Like

Because it wasn’t the solution. It was the code which was not working. And I think nobody needs to know that now.

If you’re attempting to run something like different sirens for different sets of vehicles, I went ahead and did that today using post 44 from Walsheyy2 responding to Lutton. Basically, I used what he posted but modified it so I don’t have to use whats already in the script. Instead of checking for individual vehicles like how you are

I just use what’s used to set the sirens to fire trucks, but I add an elseif statement to play the siren onto the vehicles listed in a function I added.
Near like 54 you can locate this,

local eModelsWithFireSrn =
{
	"FIRETRUK",
}

Basically, Copy that and paste it below. For me, I now have

local eModelsWithFireSrn =
{
	"FIRETRUK",
}

-- models listed below will use AMBULANCE_WARNING as auxiliary siren
-- unlisted models will instead use the default wail as the auxiliary siren
local eModelsWithPcall =
{	
	"AMBULANCE",
	"FIRETRUK",
	"LGUARD",
}

local eModelsWithSet2 =
{	
	"BPD1",
	"BPD2",
	"BPD3",
}

with the “eModelsWithSet2” being my new list with all the cars I want to run my second set of sirens. Now, go down to around line 84 and copy paste the useFiretruckSiren(veh) function, or just copy the following and put it as a separate function in that area. You can then rename the function to whatever you want (The “useSecondSrn” part) and then add in your list’s name where it says “eModelsWithSet2” if you have a different name.

function useSecondSrn(veh)
	local model = GetEntityModel(veh)
	for i = 1, #eModelsWithSet2, 1 do
		if model == GetHashKey(eModelsWithSet2[i]) then
			return true
		end
	end
	return false
end

That will be the function being checked to find whether or not the vehicle will use different sirens. Now we move down to where you change the audios, so around line 199. By default, you may have

if useFiretruckSiren(veh) then
					TogMuteDfltSrnForVeh(veh, false)
				else
					snd_lxsiren[veh] = GetSoundId()	
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_ALPHA", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
					TogMuteDfltSrnForVeh(veh, true)
				end

for newstate 1. For the rest of the states below, you want to add an if (or elseif statement if an if is already present) above the standard siren to be played (so the wrong one isn’t played). This statement is basically a copy of the useFiretruckSiren(veh) statement but actually plays a sound. If you wish to copy everything below and replace the newstate if statements then go ahead.

if newstate == 1 then
				if useFiretruckSiren(veh) then
					TogMuteDfltSrnForVeh(veh, false)
				elseif useSecondSrn(veh) then
					snd_lxsiren[veh] = GetSoundId()	
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_ECHO", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
					TogMuteDfltSrnForVeh(veh, true)
				else
					snd_lxsiren[veh] = GetSoundId()	
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_ALPHA", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
					TogMuteDfltSrnForVeh(veh, true)
				end
				
			elseif newstate == 2 then
				if useSecondSrn(veh) then
					snd_lxsiren[veh] = GetSoundId()	
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_FOXTROT", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
					TogMuteDfltSrnForVeh(veh, true)
				else
					snd_lxsiren[veh] = GetSoundId()
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_BRAVO", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
					TogMuteDfltSrnForVeh(veh, true)
				end
			elseif newstate == 3 then
				snd_lxsiren[veh] = GetSoundId()
				if useFiretruckSiren(veh) then
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_CHARLIE", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
				elseif useSecondSrn(veh) then
					snd_lxsiren[veh] = GetSoundId()	
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_GOLF", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
					TogMuteDfltSrnForVeh(veh, true)
				else
					PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_CHARLIE", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
				end
				TogMuteDfltSrnForVeh(veh, true)
				
			else
				TogMuteDfltSrnForVeh(veh, true)
				
			end

This will now allow for all cars listed in the set2 list to play sirens listed in Echo-Golf, or different if you have the rest of the sirens elsewhere. Moving on from here, you basically do the same thing in the TogPowercallStateForVeh function (Secondary Siren Active) and SetAirManuStateForVeh Function (Standard Manual)

5 Likes

Frindly question :slight_smile: is there any status on the update ?

any one have els for this

does this work for non els

Yes, it does. It’s made to work with Luxart’s vehicle controller from what I know.

People shoudln’t have to pay for more than 8 sirens! I understand you would like to have some support, but that’s not the way it should be done!

Nowhere does it say you have to pay for more than 8? (By what I can see)

where do you even get the 8 sirens at ?

1 Like

Amazing release

1 Like

Nowhere in public. But they do, if you ask them on their discord.

any one got the els script

@Walsheyy2 Is there a way to add more sirens besides the ones that are already there? For example siren_india, siren_juliett, siren_kilo, etc.

I exported the .rel file to .xml with codewalker’s program, but I couldn’t make sense of it or how to add more.

I made my attempts but they didn’t work. There are definitely ways but I’m not that good in coding and such so I didn’t get it to work with more. I can keep trying but I know there’s a few files I may need to edit that don’t show up correctly. I tried making a new audio folder so i’d have two files to draw from instead of one, I tried to add additional sirens into the original one, etc. but none of it worked during my attempts.

hi guy’s I do not know something about code, i’m just wondering to have two siren’s the Wail, yelp and of course the airhorn for the fire truck can you help please me it’s bugging me bad, thank you

Some way to define the volume of the sirens, they sound very loud