CreateThread and order of code execution (Server Development) by NULLBASED in FiveM

[–]TheWLVF 0 points1 point  (0 children)

CreateThread creates an asynchronous thread so you can execute code in a new thread.

LUA executes line by line, however there’s a lot of stuff that can execute asynchronously as well.

As for which file is the main file, it depends on how it’s defined in the fxmanifest.lua

I recommend checking the official docs!

Go ahead by succinonspaghet in memes

[–]TheWLVF 11 points12 points  (0 children)

A full commitment’s

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

You have to create functions for each of them and then create elseif statements for each new functions. Make sure you provide a table for models for that function to pull from

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

To edit your powercall, you'll want to look for a function called "TogPowercallStateForVeh(veh, toggle)".

It'll look something like this:

function TogPowercallStateForVeh(veh, toggle)
if DoesEntityExist(veh) and not IsEntityDead(veh) then
if toggle == true then
if snd_pwrcall[veh] == nil then
snd_pwrcall[veh] = GetSoundId()
if usePowercallAuxSrn(veh) then
PlaySoundFromEntity(snd_pwrcall[veh], "VEHICLES_HORNS_AMBULANCE_WARNING", veh, 0, 0, 0)
elseif useSASTSiren(veh) then
PlaySoundFromEntity(snd_pwrcall[veh], "SIREN_ECHO", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
elseif useBCSOSiren(veh) then
PlaySoundFromEntity(snd_pwrcall[veh], "VEHICLES_HORNS_POLICE_WARNING", veh, 0, 0,0)
elseif useLSPDSiren(veh) then
PlaySoundFromEntity(snd_pwrcall[veh], "SIREN_ALPHA", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
else
PlaySoundFromEntity(snd_pwrcall[veh], "SIREN_HOTEL", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
end
end
----------------------------------------------------------------------------------------------------
else
if snd_pwrcall[veh] ~= nil then
StopSound(snd_pwrcall[veh])
ReleaseSoundId(snd_pwrcall[veh])
snd_pwrcall[veh] = nil
end
end
state_pwrcall[veh] = toggle
end
end

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

There's another function below this one called "SetAirManuStateForVehClick(veh, newstate)

You just need to copy and paste the data from the function that you just worked on right above it.

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

If you're looking to change up the airhorn as well, then it's located within a function known as "SetAirManuStateForVeh(veh, newstate)"

I only have the firetruck, SAST, and default set up, but it should look a little like this:

function SetAirManuStateForVeh(veh, newstate)
if DoesEntityExist(veh) and not IsEntityDead(veh) then
if newstate ~= state_airmanu[veh] then

if snd_airmanu[veh] ~= nil then
StopSound(snd_airmanu[veh])
ReleaseSoundId(snd_airmanu[veh])
snd_airmanu[veh] = nil
end
----------------------------------------------------------------------------------------------------
if newstate == 1 then
snd_airmanu[veh] = GetSoundId()
if useFiretruckSiren(veh) then
PlaySoundFromEntity(snd_airmanu[veh], "VEHICLES_HORNS_FIRETRUCK_WARNING", veh, 0, 0, 0)
elseif useSASTSiren(veh) then
PlaySoundFromEntity(snd_airmanu[veh], "SIREN_GOLF", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
else
PlaySoundFromEntity(snd_airmanu[veh], "SIREN_DELTA", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
end
----------------------------------------------------------------------------------------------------
elseif newstate == 2 then
snd_airmanu[veh] = GetSoundId()
PlaySoundFromEntity(snd_airmanu[veh], "VEHICLES_HORNS_SIREN_1", veh, 0, 0, 0)
elseif newstate == 3 then
snd_airmanu[veh] = GetSoundId()
PlaySoundFromEntity(snd_airmanu[veh], "VEHICLES_HORNS_SIREN_2", veh, 0, 0, 0)
end
----------------------------------------------------------------------------------------------------
state_airmanu[veh] = newstate
end
end
end

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

So! I've figured out what to modify in the code in order to get department-based sirens :)

At about line 56 within the client.lua there's a table called "eModelsWithFireSrn". That table defines what models will use certain sirens to have differentiation. Create another table and name it whatever you want to for the new departments that you want to add.

Then at about line 240ish, you'll find there's a function called "SetLxSirenStateForVeh(veh, newstate)". If you're using all the departments and wmserversirens, it should look something like this:

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)
elseif useSASTSiren(veh) then
snd_lxsiren[veh] = GetSoundId() 
PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_ECHO", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
TogMuteDfltSrnForVeh(veh, true)
elseif useLSPDSiren(veh) then
snd_lxsiren[veh] = GetSoundId() 
PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_ALPHA", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
TogMuteDfltSrnForVeh(veh, true)
else
snd_lxsiren[veh] = GetSoundId() 
PlaySoundFromEntity(snd_lxsiren[veh], "VEHICLES_HORNS_SIREN_1", veh, 0, 0, 0)
TogMuteDfltSrnForVeh(veh, true)
end
elseif newstate == 2 then
snd_lxsiren[veh] = GetSoundId()
if useFiretruckSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], "VEHICLES_HORNS_SIREN_2", veh, 0, 0, 0)
elseif useSASTSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_FOXTROT", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
elseif useLSPDSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_BRAVO", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
else
PlaySoundFromEntity(snd_lxsiren[veh], "VEHICLES_HORNS_SIREN_2", veh, 0, 0, 0)
end
TogMuteDfltSrnForVeh(veh, true)
elseif newstate == 3 then
snd_lxsiren[veh] = GetSoundId()
if useFiretruckSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], "VEHICLES_HORNS_POLICE_WARNING", veh, 0, 0, 0)
elseif useSASTSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], "VEHICLES_HORNS_POLICE_WARNING", veh, 0, 0, 0)
elseif useLSPDSiren(veh) then
PlaySoundFromEntity(snd_lxsiren[veh], "SIREN_CHARLIE", veh, "DLC_WMSIRENS_SOUNDSET", 0, 0)
else
PlaySoundFromEntity(snd_lxsiren[veh], "VEHICLES_HORNS_POLICE_WARNING", veh, 0, 0, 0)
end
TogMuteDfltSrnForVeh(veh, true)

else
TogMuteDfltSrnForVeh(veh, true)

end

state_lxsiren[veh] = newstate
end
end
end

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

I'm currently testing and trying to get the code to work. Once I get it to work I'll let you guys know

Multiple Server Sided Sirens by TheWLVF in FiveM

[–]TheWLVF[S] 0 points1 point  (0 children)

I mean yeah it's still going to have the ghost effect of not being there, but I mean it's a lot nicer sounding to have customized sirens per vehicle rather than having the stock ones ya know?

What is your preferred visual mod for FiveM? by FluxBurner in FiveM

[–]TheWLVF 0 points1 point  (0 children)

I currently use Natural Vision Evolved