Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fireremover = {}
- fireremoverParticles = {}
- streetnames = {}
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------- CONFIG AREA -------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- local chatStreetAlerts = true
- local chanceForSpread = 800 -- basically a thousand sided dice is rolled and if it gets above this number then the fire spreads once
- local spawnRandomFires = true -- set to true and put x,y,z locations and amount of time before their is a chance of a fire spawning
- local spawnRandomFireChance = 500 -- basically a thousand sided dice is rolled and if it gets above this number then a fire spawns at one of the locations specified
- local randomSpawnTime = 1200000 -- time to wait before trying ot spawn another random fire in milliseconds 1,200,000 is 20 minutes this is per player.
- local randomFireLocations = { -- this is the format you need to put in for your possible locations.
- { ['x'] = -2125.2465820313, ['y'] = 3227.9423828125, ['z'] = 32.810272216797 }, -- militærbase
- { ['x'] = 1974.7619628906, ['y'] = 5168.2524414063, ['z'] = 47.639114379883 }, -- garasje
- { ['x'] = -324.30276489258, ['y'] = 2817.9509277344, ['z'] = 59.449714660645 }, -- kirke
- { ['x'] = -1184.7526855469, ['y'] = -2916.9453125, ['z'] = 16.340362548828 }, -- flyplass
- { ['x'] = 1911.8255615234, ['y'] = 5101.62890625, ['z'] = 44.19255065918 }, -- hasjplantasjen
- { ['x'] = -144.15065002441, ['y'] = -1031.8363037109, ['z'] = 27.273225784302 }, -- constructionsite
- { ['x'] = 2135.9177246094, ['y'] = 4783.0009765625, ['z'] = 40.970287322998 }, -- flyplasshangar lørenskog
- { ['x'] = 135.07022094727, ['y'] = -1047.7298583984, ['z'] = 29.151817321777 }, -- garasje2
- { ['x'] = 2515.7746582031, ['y'] = 4199.3876953125, ['z'] = 40.005928039551 }, -- nedlagt bensinstasjon
- { ['x'] = 612.51690673828, ['y'] = -3083.1735839844, ['z'] = 6.0692610740662 }, -- lagerbygning furusetveien
- { ['x'] = -294.27368164063, ['y'] = -322.60372924805, ['z'] = 10.063150405884 }, -- t-bane
- { ['x'] = 2740.7580566406, ['y'] = 1537.6781005859, ['z'] = 57.562355041504 }, -- gassanlegg
- { ['x'] = 1718.5220947266, ['y'] = -1621.4730224609, ['z'] = 112.47638702393 }, -- oljerafinneri
- { ['x'] = -1781.9605712891, ['y'] = -7.2708868980408, ['z'] = 76.503372192383 }, -- skogbrann
- { ['x'] = 2003.9211425781, ['y'] = 3773.48828125, ['z'] = 32.097644805908 }, -- bensinstasjon lørenskog
- { ['x'] = -594.46502685547, ['y'] = 530.6513671875, ['z'] = 107.96501922607 }, -- husbrann
- { ['x'] = 3530.2900390625, ['y'] = 3672.9086914063, ['z'] = 20.99178314209 }, -- anleggsbrann granveien
- { ['x'] = 1632.2204589844, ['y'] = 3654.2551269531, ['z'] = 35.375030517578 }, -- ruin lørenskog
- { ['x'] = -367.00271606445, ['y'] = 277.67916870117, ['z'] = 86.421974182129 }, -- restaurant
- { ['x'] = 1943.25, ['y'] = 3803.8957519531, ['z'] = 32.037155151367 }, -- hus lørenskog
- { ['x'] = 1592.3221435547, ['y'] = 3581.8349609375, ['z'] = 35.419017791748 }, -- motell lørenskog
- { ['x'] = 2079.7961425781, ['y'] = 2952.1394042969, ['z'] = 49.921787261963 }, -- satelitt
- { ['x'] = 2093.0078125, ['y'] = 2326.2414550781, ['z'] = 94.285247802734 }, -- vindmølle
- { ['x'] = 1991.6885986328, ['y'] = 3048.0285644531, ['z'] = 47.215137481689 }, -- bar lørenskog
- { ['x'] = -806.16943359375, ['y'] = 185.41775512695, ['z'] = 72.361778259277 }, -- michael
- { ['x'] = 1216.2164306641, ['y'] = 1846.537109375, ['z'] = 78.38330078125 }, -- Fridtjof Nansens Vei
- { ['x'] = -331.76629638672, ['y'] = 6082.7612304688, ['z'] = 31.454782485962 }, -- våpenbutikk
- { ['x'] = 772.05145263672, ['y'] = 1278.0921630859, ['z'] = 359.76986694336 }, -- Nedre Slottsgate
- { ['x'] = -9.6668758392334, ['y'] = -1428.5266113281, ['z'] = 32.090026855469 }, -- Franklin tante
- { ['x'] = -43.882583618164, ['y'] = -1749.1540527344, ['z'] = 29.421016693115 }, -- bensinstasjon bakrom
- { ['x'] = -808.25994873047, ['y'] = 167.83444213867, ['z'] = 76.213180541992 }, -- Michael andre etasje
- { ['x'] = 294.841796875, ['y'] = -1448.3198242188, ['z'] = 29.966617584229 }, -- akkuten
- { ['x'] = -9.3113622665405, ['y'] = 521.69006347656, ['z'] = 174.62789916992 }, -- Franklin
- { ['x'] = 383.21377563477, ['y'] = 792.38513183594, ['z'] = 187.70574951172 }, -- buskebrann
- { ['x'] = -2284.7314453125, ['y'] = 353.40316772461, ['z'] = 174.60159301758 }, -- fbi
- { ['x'] = -1636.5318603516, ['y'] = 180.8108215332, ['z'] = 61.757270812988 }, -- skole
- { ['x'] = 981.18426513672, ['y'] = -96.728797912598, ['z'] = 74.324821472168 }, -- mc klubb
- { ['x'] = -147.63400268555, ['y'] = 1902.1677246094, ['z'] = 197.23432922363 }, -- grisebinge
- { ['x'] = 246.98278808594, ['y'] = 229.41761779785, ['z'] = 106.28726196289 }, -- bank
- { ['x'] = -75.440742492676, ['y'] = 1891.087890625, ['z'] = 198.10313415527 }, -- traktorhenger
- { ['x'] = 804.85003662109, ['y'] = -490.83276367188, ['z'] = 30.02071762085 }, -- trafostasjon Arendalsgata
- { ['x'] = -562.03887939453, ['y'] = 286.41510009766, ['z'] = 82.17643737793 }, -- bar sentrum
- { ['x'] = -579.80694580078, ['y'] = 191.43849182129, ['z'] = 71.347160339355 }, -- søppel
- { ['x'] = -64.704696655273, ['y'] = 1948.7521972656, ['z'] = 192.82746887207 }, -- gassanlegg2
- { ['x'] = 366.17932128906, ['y'] = 2572.9404296875, ['z'] = 43.519527435303 }, -- trailer
- { ['x'] = -227.18383789063, ['y'] = -1999.6853027344, ['z'] = 24.685426712036 }, -- FameOrShame
- { ['x'] = 684.34912109375, ['y'] = 579.08636474609, ['z'] = 130.4613494873 }, -- konsert
- { ['x'] = -480.53015136719, ['y'] = -2682.7790527344, ['z'] = 8.7611312866211 }, -- båt
- { ['x'] = -1695.4001464844, ['y'] = -1072.044921875, ['z'] = 13.042688369751 }, -- pølsekiosk
- { ['x'] = -105.54790496826, ['y'] = -2686.1103515625, ['z'] = 6.0046763420105 }, -- harbour
- { ['x'] = 938.01647949219, ['y'] = -1205.9440917969, ['z'] = 25.780965805054 }, -- container
- { ['x'] = 706.82647705078, ['y'] = 116.54632568359, ['z'] = 80.956413269043 }, -- strøm sentrum
- { ['x'] = 1906.9803466797, ['y'] = 4921.5576171875, ['z'] = 48.94556427002 }, -- låve
- { ['x'] = 2196.3347167969, ['y'] = 5593.5131835938, ['z'] = 53.780456542969 }, -- methlab
- { ['x'] = 2433.5712890625, ['y'] = 4968.1904296875, ['z'] = 42.347606658936 }, -- methlab2
- { ['x'] = -299.99279785156, ['y'] = 1445.4071044922, ['z'] = 337.66955566406 }, -- observatorie skog
- { ['x'] = -449.03213500977, ['y'] = 1115.8165283203, ['z'] = 325.85415649414 }, -- observatorie
- { ['x'] = 2672.400390625, ['y'] = 2865.5090332031, ['z'] = 45.676414489746 }, -- steinbrudd
- { ['x'] = 298.0188293457, ['y'] = -906.51586914063, ['z'] = 29.292921066284 }, -- sentrum
- { ['x'] = 312.36166381836, ['y'] = -1645.3015136719, ['z'] = 32.531322479248 }, -- Grønland
- { ['x'] = 145.95579528809, ['y'] = -743.77166748047, ['z'] = 254.15216064453 }, -- fbi2
- { ['x'] = 6.6683206558228, ['y'] = -663.32250976563, ['z'] = 34.304737091064 }, -- bank
- { ['x'] = -1055.6663818359, ['y'] = -230.32911682129, ['z'] = 44.092220306396 }, -- facebook
- }
- if spawnRandomFires == true then
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(randomSpawnTime)
- local randomNumber = math.random(1,1000)
- if randomNumber > spawnRandomFireChance then
- local possibleLocations = #randomFireLocations
- local LocationID = math.random(1, possibleLocations)
- local location = randomFireLocations[LocationID]
- local x = location.x
- local y = location.y
- local z = location.z
- FSData.originalfiremaker = tostring(GetPlayerPed(-1))
- if not HasNamedPtfxAssetLoaded("core") then
- RequestNamedPtfxAsset("core")
- while not HasNamedPtfxAssetLoaded("core") do
- Wait(1)
- end
- end
- SetPtfxAssetNextCall("core")
- table.insert(FSData.lastamnt, 20)
- local rand = math.random(1, 200)
- if rand > 100 then
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", x, y, z-0.8, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- else
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", x, y, z-0.8, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- end
- table.insert(FSData.lastamnt, x)
- table.insert(FSData.lastamnt, y)
- table.insert(FSData.lastamnt, z-0.8)
- table.insert(fireremover, StartScriptFire (x, y, z-0.8, 25, false))
- table.insert(fireremover, x)
- table.insert(fireremover, y)
- table.insert(fireremover, z-0.8)
- local firec = {}
- local lastamnt = {}
- local deletedfires = {}
- for i=1,#FSData.firecoords do
- firec[i] = FSData.firecoords[i]
- end
- for i=1,#FSData.lastamnt do
- lastamnt[i] = FSData.lastamnt[i]
- end
- for i=1,#FSData.deletedfires do
- deletedfires[i] = FSData.deletedfires[i]
- end
- local original = tostring(FSData.originalfiremaker)
- if chatStreetAlerts == true then
- chatAlerts(x, y, z)
- end
- TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
- Citizen.Wait(2000)
- end
- end
- end)
- end
- function chatAlerts(x, y, z)
- Citizen.CreateThread(function()
- local text = "this"
- local streetA, streetB = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, x, y, z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
- table.insert( streetnames, GetStreetNameFromHashKey( streetA ) )
- if tostring(streetB) ~= "0" then
- table.insert( streetnames, GetStreetNameFromHashKey( streetB ) )
- end
- if tostring(streetB) ~= "0" then
- text = table.concat( streetnames, " & " )
- else
- text = GetStreetNameFromHashKey( streetA )
- end
- TriggerServerEvent("fire:chatAlert", text)
- streetnames = {}
- end)
- end
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- --------------------------------------------------------------- Handles the use of /fire -----------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:firethings")
- AddEventHandler("lol:firethings", function()
- local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
- FSData.removeallfires = false
- local coordis = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
- local count = math.random(3, 6)
- FSData.originalfiremaker = tostring(GetPlayerPed(-1))
- while (count > 0) do
- x = x + math.random(-5, 5)
- y = y + math.random(-5, 5)
- if not HasNamedPtfxAssetLoaded("core") then
- RequestNamedPtfxAsset("core")
- while not HasNamedPtfxAssetLoaded("core") do
- Wait(1)
- end
- end
- SetPtfxAssetNextCall("core")
- table.insert(FSData.lastamnt, 20)
- local rand = math.random(1, 200)
- if rand > 100 then
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", x+5, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- else
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", x+5, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- end
- table.insert(FSData.lastamnt, x+5)
- table.insert(FSData.lastamnt, y)
- table.insert(FSData.lastamnt, z-0.7)
- table.insert(fireremover, StartScriptFire (x+5, y, z-0.8, 24, false))
- table.insert(fireremover, x+5)
- table.insert(fireremover, y)
- table.insert(fireremover, z-0.8)
- count = count - 1
- end
- local firec = {}
- local lastamnt = {}
- local deletedfires = {}
- for i=1,#FSData.firecoords do
- firec[i] = FSData.firecoords[i]
- end
- for i=1,#FSData.lastamnt do
- lastamnt[i] = FSData.lastamnt[i]
- end
- for i=1,#FSData.deletedfires do
- deletedfires[i] = FSData.deletedfires[i]
- end
- local original = tostring(FSData.originalfiremaker)
- TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
- if chatStreetAlerts == false then
- chatAlerts(x, y, z)
- end
- --firehelper(fireremover)
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------- Remove all fires currently not working ----------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:firestop")
- AddEventHandler("lol:firestop", function()
- for i=1,#fireremover do
- RemoveScriptFire(fireremover[i])
- end
- for i=1,#fireremoverParticles do
- RemoveParticleFx(fireremoverParticles[i], true)
- end
- for i=1,#FSData.lastamnt do
- RemoveParticleFx(FSData.lastamnt[i], true)
- end
- fireremoverParticles = {}
- fireremover = {}
- end)
- RegisterNetEvent("lol:fireremovesync")
- AddEventHandler("lol:fireremovesync", function( firec, lastamnt, deletedfires, original )
- FSData.originalfiremaker = original
- for i=1,#firec do
- FSData.firecoords[i] = firec[i]
- end
- for i=1,#lastamnt do
- FSData.lastamnt[i] = lastamnt[i]
- end
- for i=1,#deletedfires do
- FSData.deletedfires[i] = deletedfires[i]
- end
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ------------------------------------------------------------- Thread to handle fire syncing --------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:firesyncs2")
- AddEventHandler("lol:firesyncs2", function( firec, lastamnt, deletedfires, original )
- FSData.originalfiremaker = original
- for i=1,#firec do
- FSData.firecoords[i] = firec[i]
- end
- for i=1,#lastamnt do
- FSData.lastamnt[i] = lastamnt[i]
- end
- for i=1,#deletedfires do
- FSData.deletedfires[i] = deletedfires[i]
- end
- TriggerServerEvent("lol:firesyncs60")
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------------------- just a debug function ------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:test2")
- AddEventHandler("lol:test2", function( test )
- TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"test string: " .. tostring(test))
- end)
- function firehelper(fireremover)
- for i=1,#fireremover do
- PlaceObjectOnGroundProperly(fireremover[i])
- end
- end
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- --------------------------------------------------------- Produces players coordinates in chat -----------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:coords")
- AddEventHandler("lol:coords", function()
- local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
- TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"X: " .. tostring(x) .. " Y: " .. tostring(y) .. " Z: " .. tostring(z))
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- --------------------------------------- Produces a count of all fires spawned sense last script restart --------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:firecounter")
- AddEventHandler("lol:firecounter", function()
- local counter = 0
- for i=1,#FSData.lastamnt do
- if FSData.lastamnt[i-1] == 20 or FSData.lastamnt[i-1] == 1 then
- counter = counter + 1
- end
- end
- TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"Det var " .. counter .. " branner i dag!")
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------------- Spawns all fires synced to client ------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:firesync3")
- AddEventHandler("lol:firesync3", function()
- for i=1,#FSData.lastamnt do
- if FSData.lastamnt[i-1] == 20 then
- local x = FSData.lastamnt[i+1]
- local y = FSData.lastamnt[i+2]
- local z = FSData.lastamnt[i+3]
- SetPtfxAssetNextCall("core")
- if FSData.originalfiremaker ~= tostring(GetPlayerPed(-1)) then
- local rand = math.random(1, 200)
- if rand > 100 then
- table.insert(fireremoverParticles, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", x, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- else
- table.insert(fireremoverParticles, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", x, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- end
- table.insert(fireremover, StartScriptFire (x, y, z-0.1, 25, false))
- end
- end
- end
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ---------------------------------------------------- Sets fires under the last vehicle ped was in --------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:carbomb")
- AddEventHandler("lol:carbomb", function()
- FSData.removeallfires = false
- local vehicle = GetPlayersLastVehicle()
- if (vehicle == nil) then
- return
- end
- FSData.originalfiremaker = tostring(GetPlayerPed(-1))
- local x, y, z = table.unpack(GetEntityCoords(vehicle, true))
- TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"Bilen din eksploderte!")
- local count = math.random(2,10)
- while (count > 0) do
- x = x + math.random(-1, 1)
- y = y + math.random(-1, 1)
- if not HasNamedPtfxAssetLoaded("core") then
- RequestNamedPtfxAsset("core")
- while not HasNamedPtfxAssetLoaded("core") do
- Wait(1)
- end
- end
- SetPtfxAssetNextCall("core")
- table.insert(FSData.lastamnt, 20)
- local rand = math.random(1, 200)
- if rand > 100 then
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", x, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- else
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", x, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- end
- table.insert(FSData.lastamnt, x)
- table.insert(FSData.lastamnt, y)
- table.insert(FSData.lastamnt, z)
- table.insert(fireremover, StartScriptFire (x, y, z-0.8, 24, false))
- table.insert(fireremover, x)
- table.insert(fireremover, y)
- table.insert(fireremover, z)
- count = count - 1
- end
- local firec = {}
- local lastamnt = {}
- local deletedfires = {}
- for i=1,#FSData.firecoords do
- firec[i] = FSData.firecoords[i]
- end
- for i=1,#FSData.lastamnt do
- lastamnt[i] = FSData.lastamnt[i]
- end
- for i=1,#FSData.deletedfires do
- deletedfires[i] = FSData.deletedfires[i]
- end
- local original = tostring(FSData.originalfiremaker)
- TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
- if chatStreetAlerts == false then
- chatAlerts(x, y, z)
- end
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ------------------------------------------- Responsible for syncing fires to all clients (deprecated) ----------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:firesync")
- AddEventHandler("lol:firesync", function()
- local removedFires = FSData.removeallfires
- local fireCoords = FSData.firecoords
- if removedFires == true then
- for i=1,#fireremover do
- RemoveScriptFire(fireremover[i])
- end
- for i=1,#fireremoverParticles do
- RemoveParticleFx(fireremoverParticles[i], true)
- end
- fireremoverParticles = {}
- fireremover = {}
- removedFires = false
- FSData.originalfiremaker = nil
- local firec = {}
- local lastamnt = {}
- local deletedfires = {}
- for i=1,#FSData.firecoords do
- firec[i] = FSData.firecoords[i]
- end
- for i=1,#FSData.lastamnt do
- lastamnt[i] = FSData.lastamnt[i]
- end
- for i=1,#FSData.deletedfires do
- deletedfires[i] = FSData.deletedfires[i]
- end
- local original = tostring(FSData.originalfiremaker)
- TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
- end
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------- Mostly unused but still here for debuging ----------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- RegisterNetEvent("lol:fireremovess")
- AddEventHandler("lol:fireremovess", function( x, y, z, test )
- local l = test
- for i=1,#fireremoverParticles do
- if fireremoverParticles[l+1] == fireremoverParticles[i+1] then
- RemoveParticleFxInRange(fireremoverParticles[i+1], fireremoverParticles[i+2], fireremoverParticles[i+3], 1.5)
- end
- end
- for i=1,#FSData.lastamnt do
- if FSData.lastamnt[i+1] == FSData.lastamnt[l+1] then
- RemoveParticleFxInRange(FSData.lastamnt[i+1], FSData.lastamnt[i+2], FSData.lastamnt[i+3], 1.5)
- FSData.lastamnt[i-1] = 1
- end
- end
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- --------------------------------------------------------- Thread to handle spawning initial fire ---------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- if IsControlJustPressed(1, 168) then -- button f7
- FSData.originalfiremaker = tostring(GetPlayerPed(-1))
- local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
- local coords = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
- if not HasNamedPtfxAssetLoaded("core") then
- RequestNamedPtfxAsset("core")
- while not HasNamedPtfxAssetLoaded("core") do
- Wait(1)
- end
- end
- SetPtfxAssetNextCall("core")
- table.insert(FSData.lastamnt, 20)
- local rand = math.random(1, 200)
- if rand > 100 then
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", x+5, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- else
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", x+5, y, z-0.7, 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- end
- table.insert(FSData.lastamnt, x+5)
- table.insert(FSData.lastamnt, y)
- table.insert(FSData.lastamnt, z-0.7)
- table.insert(fireremover, StartScriptFire (x+5, y, z-0.8, 25, false))
- table.insert(fireremover, x+5)
- table.insert(fireremover, y)
- table.insert(fireremover, z-0.8)
- local firec = {}
- local lastamnt = {}
- local deletedfires = {}
- for i=1,#FSData.firecoords do
- firec[i] = FSData.firecoords[i]
- end
- for i=1,#FSData.lastamnt do
- lastamnt[i] = FSData.lastamnt[i]
- end
- for i=1,#FSData.deletedfires do
- deletedfires[i] = FSData.deletedfires[i]
- end
- local original = tostring(FSData.originalfiremaker)
- if chatStreetAlerts == false then
- chatAlerts(x, y, z)
- end
- TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
- Citizen.Wait(2000)
- end
- end
- end)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ---------------------------------------------------------- Thread to handle spreading of fires -----------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- Citizen.CreateThread(function()
- while true do
- Wait(1000)
- for i=1,#FSData.lastamnt do
- Wait(50)
- if FSData.lastamnt[i-1] == 20 then
- if not HasNamedPtfxAssetLoaded("core") then
- RequestNamedPtfxAsset("core")
- while not HasNamedPtfxAssetLoaded("core") do
- Wait(1)
- end
- end
- SetPtfxAssetNextCall("core")
- if DoesEntityExist(FSData.lastamnt[i]) then
- PlaceObjectOnGroundProperly(FSData.lastamnt[i])
- end
- local x = FSData.lastamnt[i+1]
- local y = FSData.lastamnt[i+2]
- local z = FSData.lastamnt[i+3]
- --if FSData.originalfiremaker == tostring(GetPlayerPed(-1)) then
- if GetNumberOfFiresInRange(x, y, z, 1) == 0 then
- if GetNumberOfFiresInRange(x, y, z, 1) == 0 then
- TriggerServerEvent("lol:removefires", x, y, z, i)
- end
- end
- --end
- local chances = math.random(1, 1000)
- if chances > chanceForSpread then
- if FSData.originalfiremaker == tostring(GetPlayerPed(-1)) then
- local xrand = FSData.lastamnt[i+1] + math.random(-6, 6)
- local yrand = FSData.lastamnt[i+2] + math.random(-6, 6)
- while xrand > -1 and xrand < 2 do
- xrand = xrand + math.random(2, 6)
- end
- while yrand > -1 and yrand < 2 do
- yrand = yrand + math.random(2, 6)
- end
- table.insert(FSData.lastamnt, 20)
- local rand = math.random(1, 200)
- if rand > 100 then
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_l_fire", xrand, yrand, FSData.lastamnt[i+3], 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- else
- table.insert(FSData.lastamnt, StartParticleFxLoopedAtCoord("ent_ray_heli_aprtmnt_h_fire", xrand, yrand, FSData.lastamnt[i+3], 0.0, 0.0, 0.0, 1.0, false, false, false, false))
- end
- table.insert(FSData.lastamnt, xrand)
- table.insert(FSData.lastamnt, yrand)
- table.insert(FSData.lastamnt, FSData.lastamnt[i+3])
- table.insert(fireremover, StartScriptFire (xrand, yrand, FSData.lastamnt[i+3]-0.1, 25, false))
- table.insert(fireremover, xrand)
- table.insert(fireremover, yrand)
- table.insert(fireremover, FSData.lastamnt[i+3]-0.1)
- local firec = {}
- local lastamnt = {}
- local deletedfires = {}
- for i=1,#FSData.firecoords do
- firec[i] = FSData.firecoords[i]
- end
- for i=1,#FSData.lastamnt do
- lastamnt[i] = FSData.lastamnt[i]
- end
- for i=1,#FSData.deletedfires do
- deletedfires[i] = FSData.deletedfires[i]
- end
- local original = tostring(FSData.originalfiremaker)
- TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
- end
- end
- end
- end
- Citizen.Wait(50)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement