Skip to content

Commit

Permalink
FRAMEWORK v1.1_f
Browse files Browse the repository at this point in the history
Added Config.lua
Added GPS markers (optional) on map
Updated files for devs/players

and mostly: started working on the ressource again

note: removing blip dosn't seem to work just yet. Still working on it.
  • Loading branch information
Pyth3rEx committed Aug 16, 2019
1 parent 2e9f8cf commit 7cc5e26
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 38 deletions.
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,30 @@ Fire script for RP servers in FiveM

This script intorduces a fully-functional Fire Departement System with Fire Callouts

Features:
- Fire Calls
- Dynamic Fires
- Fire Particles Management System
- Fire Alarm System
- Server-sided calculations (all clients see the same thing)

Check the Wiki for all infos on how to setup this script for your server, help us out in the development, or just more data I don't really know how to fit here ;)
**FEATURES:**
- *Fire Calls*
- *Dynamic Fires*
- *Fire Particles Management System*
- *Fire Alarm System*
- *Server-sided calculations (all clients see the same thing)*

Check the Wiki for all infos on how to setup this script for your server, help us out in the development, or just more data I don't really know how to fit here ;)

**STRUCTURE:**
in _ThingsForThePeople you will find files containing data on how thigns work and will be changing. This is mainly aimed to devs as the 'how to install' section should be enought for regular server owner to use. The flowcharts for example are a pseudocode version of the script for people with low lua knowledge or devs who may not understand my way of commenting

in _ThingsForTheMachine you will find all the files you'll have to put in your server folder, follow install instructions for us

**HOW TO INSTALL:**

1 - Head to the [releases](https://github.com/Pyth3rEx/esx_fireDispatch/releases) tab to download the version of your choice (don't be stupid, take the last one... unless it's broken... then don't take it...)
2 - Put the content of `_ThingsForTheMachine` into your [ESX] folder on your FiveM server
3 - Go to your server's server.cfg and add `start esx_fireDispatch` *(try and put it pretty high up as this script requires to be started quite early, I recomend right below the 'required' ESX ressources and above any player-related plugins)*

**REQUEST TO PEOPLE UPDATING MY SCRIPT:**
PLEASE COMMENT YOUR SHIT!!! Myself (and others) are tired of finding script that have trouble but due to lack of commenting it's impossible to understand, please comment your work.

_*P.S Attribute all work to their original author... don't be that dude*_

**SUPPORT ME:**
I have recently started taking care of my script again, and I belive I am in a position where I can allow myself to ask for support. Feel free to support my gaming network (ZeFrench) via Tipeee. You can even watch videos for small tips that won't cost you a cent! https://en.tipeee.com/zefrench
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 7 additions & 2 deletions todo.txt → _ThingsForPeople/todo.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
- FIND A WAY TO REMOVE VALUE FROM TABLE // scriptData.fires
- Automaticaly gt the script to handle fires (eg. Whn a car blows up, the script needs to find it, add it to the variables and handle it like a spawned fire)

- Fire spreading
- Attach the fire to the vehicle <= Kinda done (overided by "bug")
- Add a choice in vehicles to spawn / pick random vehicle from list
- Do not spawn fires while it rains.... caus it's stupid looking...
- Add custom alarm sound

To be done soon:
- Move every piece of data to config.lua (at least anything that needs to be accessed by server devs)
- Update the flowcharts

DONE:
- Added GPS Option to config.lua
- Added config.lua

- Fix PlaySoundFromCoords
- Added Rythm to the alarm
- Removable fires
Expand Down
4 changes: 3 additions & 1 deletion __resource.lua → _ThingsForTheMachine/__resource.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ resource_manifest_version "77731fab-63ca-442c-a67b-abc70f28dfa5"

client_scripts {
"vars/variables.lua",
"config.lua",
"client.lua",
}


server_scripts {
"server.lua",
"vars/variables.lua",
"config.lua",
"server.lua",
}
89 changes: 62 additions & 27 deletions client.lua → _ThingsForTheMachine/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ local fireSpawnLocation = {
{ x = 1161.0, y = -1440.53, z = 34.72, name = "El Burro Station - Testing Fire 2", id = 1, isFuel = false}, --fire // id = type of fire
}

local fireBlips = { -- Blips used to show fire location
}

------------------------------ ------------------------------
------------------------------ Dispatch ------------------------------
------------------------------ ------------------------------
Expand Down Expand Up @@ -62,10 +65,36 @@ end)
------------------------------ ------------------------------
------------------------------ Fire ------------------------------
------------------------------ ------------------------------

---------------------------- Commands ----------------------------
RegisterCommand("startFire", function(source, args, rawCommand)
TriggerServerEvent("fireManager:syncFire", source); -- sends sync requests
end, false)

RegisterCommand("stopFires", function()
TriggerServerEvent("fireManager:removeFire", source);
end, false)

RegisterCommand("stopCallout", function()
TriggerServerEvent("fireManager:remvoeBlip", source);
end,false)

RegisterNetEvent("fireRemover")
AddEventHandler("fireRemover", function()
for i = 1, #scriptData.firePositionsX, 1 do
RemoveScriptFire(scriptData.fires[i])
RemoveParticleFx(scriptData.particles[i], true)
end
end)
------------------------------ END ------------------------------

RegisterNetEvent("blipRemover") -- Hides blip byu putting their alpha to 0 (temporary solution)
AddEventHandler("blipRemover", function()
for i = 1, #fireBlips, 1 do
SetBlipAlpha(fireBlips[i], 0)
end
end)

RegisterNetEvent("syncCallback")
AddEventHandler("syncCallback", function()
TriggerServerEvent("potato:syncedAlarm") -- Starts fire alarm
Expand All @@ -90,39 +119,45 @@ AddEventHandler("syncCallback", function()
end
SetPtfxAssetNextCall("core")

if(fireSpawnLocation[i].id == 0) then
--Car fire
else
scriptData.fires = StartScriptFire(fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z-1, 25, fireSpawnLocation[i].isFuel) --spawn fire

local rmd = math.random(2) -- Gets random number between 1 and 2
if rmd == 1 then
table.insert(scriptData.particles, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
table.insert(scriptData.firePositionsX, fireSpawnLocation[i].x) -- stores X
table.insert(scriptData.firePositionsY, fireSpawnLocation[i].y) -- stores Y
table.insert(scriptData.firePositionsZ, fireSpawnLocation[i].z-0.7) -- stores Z

-- Makes fire
if(fireSpawnLocation[i].id == 0) then
--Add car fire here
else
table.insert(scriptData.particles, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
table.insert(scriptData.firePositionsX, fireSpawnLocation[i].x) -- stores X
table.insert(scriptData.firePositionsY, fireSpawnLocation[i].y) -- stores Y
table.insert(scriptData.firePositionsZ, fireSpawnLocation[i].z-0.7) -- stores Z
--Make non-car fire
scriptData.fires = StartScriptFire(fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z-1, 25, fireSpawnLocation[i].isFuel) --spawn fire

local rmd = math.random(2) -- Gets random number between 1 and 2
if rmd == 1 then
table.insert(scriptData.particles, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
table.insert(scriptData.firePositionsX, fireSpawnLocation[i].x) -- stores X
table.insert(scriptData.firePositionsY, fireSpawnLocation[i].y) -- stores Y
table.insert(scriptData.firePositionsZ, fireSpawnLocation[i].z-0.7) -- stores Z
else
table.insert(scriptData.particles, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
table.insert(scriptData.firePositionsX, fireSpawnLocation[i].x) -- stores X
table.insert(scriptData.firePositionsY, fireSpawnLocation[i].y) -- stores Y
table.insert(scriptData.firePositionsZ, fireSpawnLocation[i].z-0.7) -- stores Z
end
end
end
end)
-- Stops making fires

-- Create marker on map
if(Config.Display["allowGPS"] == true) then
local newFireBlip = AddBlipForCoord(fireSpawnLocation[i].x, fireSpawnLocation[i].y, fireSpawnLocation[i].z) -- Makes the blip

RegisterCommand("stopFires", function()
TriggerServerEvent("fireManager:removeFire", source);
end, false)
fireBlips[i] = newFireBlip -- 'create' blip to array

RegisterNetEvent("fireRemover")
AddEventHandler("fireRemover", function()
for i = 1, #scriptData.firePositionsX, 1 do
RemoveScriptFire(scriptData.fires[i])
RemoveParticleFx(scriptData.particles[i], true)
end
end)
SetBlipAlpha(fireBlips[i], 10000)
SetBlipSprite(fireBlips[i], 648)
SetBlipColour(fireBlips[i], 1)
blipName = "Fire Callout"
SetBlipNameFromTextFile(blip, blipName)
SetBlipAsShortRange(blip, false)

fireBlips[i] = newFireBlip -- Save blip to array
end
end)

Citizen.CreateThread(function()

Expand Down
7 changes: 7 additions & 0 deletions _ThingsForTheMachine/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Config = {}

Config.Display = {

allowGPS = true -- Display callouts on the GPS

}
5 changes: 5 additions & 0 deletions server.lua → _ThingsForTheMachine/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ AddEventHandler("fireManager:removeFire", function()
TriggerClientEvent("fireRemover", -1)
end)

RegisterServerEvent("fireManager:remvoeBlip")
AddEventHandler("fireManager:remvoeBlip", function()
TriggerClientEvent("blipRemover", -1)
end)

RegisterServerEvent("potato:syncedAlarm")
AddEventHandler("potato:syncedAlarm", function()
TriggerClientEvent("triggerSound", source)
Expand Down
File renamed without changes.

0 comments on commit 7cc5e26

Please sign in to comment.