daily pastebin goal
11%
SHARE
TWEET

Fire Script

a guest Sep 14th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fireremover = {}
  2. fireremoverParticles = {}
  3. streetnames = {}
  4.  
  5.  
  6. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  7.  
  8. -------------------------------------------------------------------- CONFIG AREA -------------------------------------------------------------------------
  9.  
  10. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  11. local chatStreetAlerts = true
  12. local chanceForSpread = 900 -- basically a thousand sided dice is rolled and if it gets above this number then the fire spreads once
  13. 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
  14. local spawnRandomFireChance = 400 -- basically a thousand sided dice is rolled and if it gets above this number then a fire spawns at one of the locations specified
  15. 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.
  16. local randomFireLocations = { --  this is the format you need to put in for your possible locations.
  17.     -- { ['x'] = 644.9803, ['y'] = 2792.7102, ['z'] = 41.9462 }, -example
  18.     { ['x'] = 2005.68, ['y'] = 3772.54, ['z'] = 32.18 }, -- Gas Sandy
  19.     { ['x'] = 1960.55, ['y'] = 3748.84, ['z'] = 32.34 }, -- 24/7 Sandy
  20.     { ['x'] = 1178.15, ['y'] = 2636.08, ['z'] = 37.75 }, -- LS Customs Sandy
  21.     { ['x'] = 1852.82, ['y'] = 3692.04, ['z'] = 34.27 }, -- PD Station Sandy   
  22.     { ['x'] = 1601.08, ['y'] = 3593.71, ['z'] = 38.73 }, -- Motel Sandy
  23.     { ['x'] = 2435.41, ['y'] = 4966.20, ['z'] = 42.35 }, -- O'Neils Farm Sandy 
  24.     { ['x'] = 1739.34, ['y'] = 3319.26, ['z'] = 41.22 }, -- Airport Hanger Sandy
  25.    
  26.     { ['x'] = 1758.21, ['y'] = 2612.20, ['z'] = 45.56 }, -- Prison Power
  27.     { ['x'] = 1627.91, ['y'] = 2616.84, ['z'] = 45.58 }, -- Prison Yard Propane
  28.    
  29.     { ['x'] = -79.79, ['y'] = 6226.46, ['z'] = 31.09 }, -- Chicken Plant Paleto
  30.     { ['x'] = 174.51, ['y'] = 6603.06, ['z'] = 31.85 }, -- Ron's Gas Station Paleto
  31.     { ['x'] = -450.81, ['y'] = 6011.66, ['z'] = 31.72 }, -- PD Station Paleto
  32.     { ['x'] = -102.71, ['y'] = 6464.55 , ['z'] = 31.63 }, -- Bank Paleto
  33.    
  34. }
  35.  
  36. if spawnRandomFires == true then
  37.     Citizen.CreateThread(function()
  38.  
  39.         while true do
  40.             Citizen.Wait(randomSpawnTime)
  41.             local randomNumber = math.random(1,1000)
  42.  
  43.             if randomNumber > spawnRandomFireChance then
  44.                 local possibleLocations = #randomFireLocations
  45.                 local LocationID = math.random(1, possibleLocations)
  46.                 local location = randomFireLocations[LocationID]
  47.                 local x = location.x
  48.                 local y = location.y
  49.                 local z = location.z
  50.                 FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  51.                    
  52.                
  53.                
  54.                                              
  55.                    
  56.                 if not HasNamedPtfxAssetLoaded("core") then
  57.                     RequestNamedPtfxAsset("core")
  58.                     while not HasNamedPtfxAssetLoaded("core") do
  59.                         Wait(1)
  60.                     end
  61.                 end
  62.                 SetPtfxAssetNextCall("core")
  63.                
  64.                
  65.            
  66.                 table.insert(FSData.lastamnt, 20)
  67.            
  68.                 local rand = math.random(1, 200)
  69.                 if rand > 100 then
  70.                     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))
  71.                 else
  72.                     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))
  73.                 end
  74.                 table.insert(FSData.lastamnt, x)
  75.                 table.insert(FSData.lastamnt, y)
  76.                 table.insert(FSData.lastamnt, z-0.8)
  77.            
  78.                 table.insert(fireremover, StartScriptFire (x, y, z-0.8, 25, false))
  79.                 table.insert(fireremover, x)
  80.                 table.insert(fireremover, y)
  81.                 table.insert(fireremover, z-0.8)
  82.                 local firec = {}
  83.                 local lastamnt = {}
  84.                 local deletedfires = {}
  85.                 for i=1,#FSData.firecoords do
  86.                     firec[i] = FSData.firecoords[i]
  87.                 end
  88.                 for i=1,#FSData.lastamnt do
  89.                     lastamnt[i] = FSData.lastamnt[i]
  90.                 end
  91.                 for i=1,#FSData.deletedfires do
  92.                     deletedfires[i] = FSData.deletedfires[i]
  93.                 end
  94.                 local original = tostring(FSData.originalfiremaker)
  95.                 if chatStreetAlerts == true then
  96.                     chatAlerts(x, y, z)
  97.                 end
  98.                 TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  99.                 Citizen.Wait(2000)
  100.  
  101.  
  102.             end
  103.         end
  104.  
  105.     end)
  106. end
  107. function chatAlerts(x, y, z)
  108.     Citizen.CreateThread(function()
  109.         local text = "this"
  110.         local streetA, streetB = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, x, y, z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
  111.        
  112.         table.insert( streetnames, GetStreetNameFromHashKey( streetA ) )
  113.         if tostring(streetB) ~= "0" then
  114.             table.insert( streetnames, GetStreetNameFromHashKey( streetB ) )
  115.         end
  116.         if tostring(streetB) ~= "0" then
  117.             text = table.concat( streetnames, " & " )
  118.         else
  119.             text = GetStreetNameFromHashKey( streetA )
  120.         end
  121.         TriggerServerEvent("fire:chatAlert", text)
  122.         streetnames = {}
  123.     end)
  124. end
  125.  
  126.  
  127. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  128.  
  129. --------------------------------------------------------------- Handles the use of /fire -----------------------------------------------------------------
  130.  
  131. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  132.  
  133. RegisterNetEvent("lol:firethings")
  134. AddEventHandler("lol:firethings", function()
  135.     local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  136.     FSData.removeallfires = false
  137.     local coordis = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  138.     local count = math.random(3, 6)
  139.     FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  140.     while (count > 0) do
  141.         x = x + math.random(-5, 5)
  142.         y = y + math.random(-5, 5)
  143.         if not HasNamedPtfxAssetLoaded("core") then
  144.             RequestNamedPtfxAsset("core")
  145.             while not HasNamedPtfxAssetLoaded("core") do
  146.                 Wait(1)
  147.             end
  148.         end
  149.         SetPtfxAssetNextCall("core")
  150.  
  151.         table.insert(FSData.lastamnt, 20)
  152.         local rand = math.random(1, 200)
  153.         if rand > 100 then
  154.             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))
  155.         else
  156.             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))
  157.         end
  158.         table.insert(FSData.lastamnt, x+5)
  159.         table.insert(FSData.lastamnt, y)
  160.         table.insert(FSData.lastamnt, z-0.7)
  161.         table.insert(fireremover, StartScriptFire (x+5, y, z-0.8, 24, false))
  162.         table.insert(fireremover, x+5)
  163.         table.insert(fireremover, y)
  164.         table.insert(fireremover, z-0.8)
  165.         count = count - 1
  166.     end
  167.     local firec = {}
  168.         local lastamnt = {}
  169.         local deletedfires = {}
  170.         for i=1,#FSData.firecoords do
  171.             firec[i] = FSData.firecoords[i]
  172.         end
  173.         for i=1,#FSData.lastamnt do
  174.             lastamnt[i] = FSData.lastamnt[i]
  175.         end
  176.         for i=1,#FSData.deletedfires do
  177.             deletedfires[i] = FSData.deletedfires[i]
  178.         end
  179.         local original = tostring(FSData.originalfiremaker)
  180.         TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  181.                
  182.        
  183.         if chatStreetAlerts == true then
  184.             chatAlerts(x, y, z)
  185.         end
  186.     --firehelper(fireremover)      
  187. end)
  188.  
  189. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  190.  
  191. -------------------------------------------------------- Remove all fires currently not working ----------------------------------------------------------
  192.  
  193. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  194.  
  195. RegisterNetEvent("lol:firestop")
  196. AddEventHandler("lol:firestop", function()
  197.         for i=1,#fireremover do
  198.              RemoveScriptFire(fireremover[i])
  199.         end
  200.         for i=1,#fireremoverParticles do
  201.            
  202.             RemoveParticleFx(fireremoverParticles[i], true)
  203.         end
  204.         for i=1,#FSData.lastamnt do
  205.             RemoveParticleFx(FSData.lastamnt[i], true)
  206.            
  207.         end
  208.         fireremoverParticles = {}
  209.         fireremover = {}
  210. end)
  211. RegisterNetEvent("lol:fireremovesync")
  212. AddEventHandler("lol:fireremovesync", function( firec, lastamnt, deletedfires, original )
  213.        
  214.             FSData.originalfiremaker = original
  215.            
  216.             for i=1,#firec do
  217.                     FSData.firecoords[i] = firec[i]
  218.             end
  219.             for i=1,#lastamnt do
  220.                     FSData.lastamnt[i] = lastamnt[i]
  221.             end
  222.             for i=1,#deletedfires do
  223.                     FSData.deletedfires[i] = deletedfires[i]
  224.             end
  225.            
  226. end)
  227.  
  228. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  229.  
  230. ------------------------------------------------------------- Thread to handle fire syncing --------------------------------------------------------------
  231.  
  232. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  233.  
  234. RegisterNetEvent("lol:firesyncs2")
  235. AddEventHandler("lol:firesyncs2", function( firec, lastamnt, deletedfires, original )
  236.        
  237.             FSData.originalfiremaker = original
  238.            
  239.             for i=1,#firec do
  240.                     FSData.firecoords[i] = firec[i]
  241.             end
  242.             for i=1,#lastamnt do
  243.                     FSData.lastamnt[i] = lastamnt[i]
  244.             end
  245.             for i=1,#deletedfires do
  246.                     FSData.deletedfires[i] = deletedfires[i]
  247.             end
  248.                 TriggerServerEvent("lol:firesyncs60")
  249. end)
  250.  
  251. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  252.  
  253. ----------------------------------------------------------------- just a debug function ------------------------------------------------------------------
  254.  
  255. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  256.  
  257. RegisterNetEvent("lol:test2")
  258. AddEventHandler("lol:test2", function( test )
  259.         TriggerEvent("chatMessage", "FIRE", {255, 0, 0},"test string: " .. tostring(test))
  260. end)
  261. function firehelper(fireremover)
  262. for i=1,#fireremover do
  263.              PlaceObjectOnGroundProperly(fireremover[i])
  264.         end
  265.  
  266. end
  267.  
  268. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  269.  
  270. --------------------------------------------------------- Produces players coordinates in chat -----------------------------------------------------------
  271.  
  272. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  273.  
  274. RegisterNetEvent("lol:coords")
  275. AddEventHandler("lol:coords", function()
  276.         local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  277.                 TriggerEvent("chatMessage", "Coords", {255, 0, 0},"X: " .. tostring(x) .. " Y: " .. tostring(y) .. " Z: " .. tostring(z))
  278.                
  279.                
  280. end)
  281.  
  282. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  283.  
  284. --------------------------------------- Produces a count of all fires spawned sense last script restart --------------------------------------------------
  285.  
  286. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  287.  
  288. RegisterNetEvent("lol:firecounter")
  289. AddEventHandler("lol:firecounter", function()
  290.         local counter = 0
  291.         for i=1,#FSData.lastamnt do
  292.             if FSData.lastamnt[i-1] == 20 or  FSData.lastamnt[i-1] == 1 then
  293.                 counter = counter + 1
  294.             end
  295.         end
  296.         TriggerEvent("chatMessage", "Coords", {255, 0, 0},"There was " .. counter .. " fires today so far.")
  297.                
  298. end)
  299.  
  300. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  301.  
  302. ----------------------------------------------------------- Spawns all fires synced to client ------------------------------------------------------------
  303.  
  304. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  305.  
  306. RegisterNetEvent("lol:firesync3")
  307. AddEventHandler("lol:firesync3", function()
  308.     for i=1,#FSData.lastamnt do
  309.         if FSData.lastamnt[i-1] == 20 then
  310.    
  311.             local x = FSData.lastamnt[i+1]
  312.             local y = FSData.lastamnt[i+2]
  313.             local z = FSData.lastamnt[i+3]
  314.             SetPtfxAssetNextCall("core")
  315.             if FSData.originalfiremaker ~= tostring(GetPlayerPed(-1)) then
  316.                 local rand = math.random(1, 200)
  317.                 if rand > 100 then
  318.                     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))
  319.                 else
  320.                     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))
  321.                 end
  322.                 table.insert(fireremover, StartScriptFire (x, y, z-0.1, 25, false))
  323.             end
  324.         end
  325.     end
  326. end)
  327.  
  328. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  329.  
  330. ---------------------------------------------------- Sets fires under the last vehicle ped was in --------------------------------------------------------
  331.  
  332. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  333.  
  334. RegisterNetEvent("lol:carbomb")
  335. AddEventHandler("lol:carbomb", function()
  336.     FSData.removeallfires = false
  337.        
  338.     local vehicle = GetPlayersLastVehicle()
  339.     if (vehicle == nil) then
  340.         return
  341.     end
  342.     FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  343.     local x, y, z = table.unpack(GetEntityCoords(vehicle, true))
  344.     TriggerEvent("chatMessage", "FIRE", {255, 0, 0},"You made that car go BOOM!")
  345.        
  346.     local count = math.random(2,10)
  347.     while (count > 0) do
  348.         x = x + math.random(-1, 1)
  349.         y = y + math.random(-1, 1)
  350.         if not HasNamedPtfxAssetLoaded("core") then
  351.             RequestNamedPtfxAsset("core")
  352.             while not HasNamedPtfxAssetLoaded("core") do
  353.                 Wait(1)
  354.             end
  355.         end
  356.         SetPtfxAssetNextCall("core")
  357.         table.insert(FSData.lastamnt, 20)
  358.                
  359.                
  360.         local rand = math.random(1, 200)
  361.         if rand > 100 then
  362.             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))
  363.         else
  364.             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))
  365.         end
  366.         table.insert(FSData.lastamnt, x)
  367.         table.insert(FSData.lastamnt, y)
  368.         table.insert(FSData.lastamnt, z)
  369.         table.insert(fireremover, StartScriptFire (x, y, z-0.8, 24, false))
  370.         table.insert(fireremover, x)
  371.         table.insert(fireremover, y)
  372.         table.insert(fireremover, z)
  373.         count = count - 1
  374.     end
  375.     local firec = {}
  376.     local lastamnt = {}
  377.     local deletedfires = {}
  378.     for i=1,#FSData.firecoords do
  379.         firec[i] = FSData.firecoords[i]
  380.     end
  381.     for i=1,#FSData.lastamnt do
  382.         lastamnt[i] = FSData.lastamnt[i]
  383.     end
  384.     for i=1,#FSData.deletedfires do
  385.         deletedfires[i] = FSData.deletedfires[i]
  386.     end
  387.     local original = tostring(FSData.originalfiremaker)
  388.     TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  389.     if chatStreetAlerts == true then
  390.         chatAlerts(x, y, z)
  391.     end
  392.  
  393. end)
  394.  
  395. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  396.  
  397. ------------------------------------------- Responsible for syncing fires to all clients (deprecated) ----------------------------------------------------
  398.  
  399. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  400.  
  401. RegisterNetEvent("lol:firesync")
  402. AddEventHandler("lol:firesync", function()
  403.  
  404.         local removedFires = FSData.removeallfires
  405.         local fireCoords = FSData.firecoords
  406.  
  407.         if removedFires == true then
  408.             for i=1,#fireremover do
  409.                 RemoveScriptFire(fireremover[i])
  410.             end
  411.             for i=1,#fireremoverParticles do
  412.                 RemoveParticleFx(fireremoverParticles[i], true)
  413.             end
  414.             fireremoverParticles = {}
  415.             fireremover = {}
  416.             removedFires = false
  417.             FSData.originalfiremaker = nil
  418.             local firec = {}
  419.             local lastamnt = {}
  420.             local deletedfires = {}
  421.             for i=1,#FSData.firecoords do
  422.                     firec[i] = FSData.firecoords[i]
  423.             end
  424.             for i=1,#FSData.lastamnt do
  425.                     lastamnt[i] = FSData.lastamnt[i]
  426.             end
  427.             for i=1,#FSData.deletedfires do
  428.                     deletedfires[i] = FSData.deletedfires[i]
  429.             end
  430.            
  431.                 local original = tostring(FSData.originalfiremaker)
  432.                 TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  433.         end
  434.        
  435.        
  436.    
  437.        
  438.        
  439. end)
  440.  
  441. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  442.  
  443. ----------------------------------------------------- Mostly unused but still here for debuging ----------------------------------------------------------
  444.  
  445. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  446.  
  447. RegisterNetEvent("lol:fireremovess")
  448. AddEventHandler("lol:fireremovess", function( x, y, z, test )
  449.        
  450.     local l = test
  451.        
  452.     for i=1,#fireremoverParticles do
  453.         if fireremoverParticles[l+1] == fireremoverParticles[i+1] then
  454.             RemoveParticleFxInRange(fireremoverParticles[i+1], fireremoverParticles[i+2], fireremoverParticles[i+3], 1.5)
  455.         end
  456.     end
  457.     for i=1,#FSData.lastamnt do
  458.         if FSData.lastamnt[i+1] == FSData.lastamnt[l+1] then
  459.             RemoveParticleFxInRange(FSData.lastamnt[i+1], FSData.lastamnt[i+2], FSData.lastamnt[i+3], 1.5)
  460.             FSData.lastamnt[i-1] = 1
  461.         end
  462.     end
  463.        
  464. end)
  465.  
  466. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  467.  
  468. --------------------------------------------------------- Thread to handle spawning initial fire ---------------------------------------------------------
  469.  
  470. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  471.  
  472. Citizen.CreateThread(function()
  473.     while true do
  474.         Citizen.Wait(0)
  475.         if IsControlJustPressed(1, 168) then -- button f7
  476.             FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  477.                
  478.             local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  479.             local coords = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  480.                                          
  481.                
  482.             if not HasNamedPtfxAssetLoaded("core") then
  483.                 RequestNamedPtfxAsset("core")
  484.                 while not HasNamedPtfxAssetLoaded("core") do
  485.                     Wait(1)
  486.                 end
  487.             end
  488.             SetPtfxAssetNextCall("core")
  489.            
  490.            
  491.        
  492.             table.insert(FSData.lastamnt, 20)
  493.        
  494.             local rand = math.random(1, 200)
  495.             if rand > 100 then
  496.                 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))
  497.             else
  498.                 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))
  499.             end
  500.             table.insert(FSData.lastamnt, x+5)
  501.             table.insert(FSData.lastamnt, y)
  502.             table.insert(FSData.lastamnt, z-0.7)
  503.        
  504.             table.insert(fireremover, StartScriptFire (x+5, y, z-0.8, 25, false))
  505.             table.insert(fireremover, x+5)
  506.             table.insert(fireremover, y)
  507.             table.insert(fireremover, z-0.8)
  508.             local firec = {}
  509.             local lastamnt = {}
  510.             local deletedfires = {}
  511.             for i=1,#FSData.firecoords do
  512.                 firec[i] = FSData.firecoords[i]
  513.             end
  514.             for i=1,#FSData.lastamnt do
  515.                 lastamnt[i] = FSData.lastamnt[i]
  516.             end
  517.             for i=1,#FSData.deletedfires do
  518.                 deletedfires[i] = FSData.deletedfires[i]
  519.             end
  520.             local original = tostring(FSData.originalfiremaker)
  521.             if chatStreetAlerts == true then
  522.                 chatAlerts(x, y, z)
  523.             end
  524.             TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  525.             Citizen.Wait(2000)
  526.         end
  527.     end
  528. end)
  529.  
  530. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  531.  
  532. ---------------------------------------------------------- Thread to handle spreading of fires -----------------------------------------------------------
  533.  
  534. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  535.  
  536. Citizen.CreateThread(function()
  537.  
  538.     while true do
  539.                
  540.                 Wait(1000)
  541.                 for i=1,#FSData.lastamnt do
  542.                     Wait(50)
  543.                    
  544.                     if FSData.lastamnt[i-1] == 20 then
  545.                        
  546.                    
  547.                     if not HasNamedPtfxAssetLoaded("core") then
  548.                         RequestNamedPtfxAsset("core")
  549.                         while not HasNamedPtfxAssetLoaded("core") do
  550.                             Wait(1)
  551.                         end
  552.                     end
  553.                    
  554.                     SetPtfxAssetNextCall("core")
  555.                     if DoesEntityExist(FSData.lastamnt[i]) then
  556.                        
  557.                         PlaceObjectOnGroundProperly(FSData.lastamnt[i])
  558.                     end
  559.                    
  560.                         local x = FSData.lastamnt[i+1]
  561.                         local y = FSData.lastamnt[i+2]
  562.                         local z = FSData.lastamnt[i+3]
  563.                        
  564.                     --if FSData.originalfiremaker == tostring(GetPlayerPed(-1)) then                   
  565.                         if GetNumberOfFiresInRange(x, y, z, 1) == 0 then
  566.                             if GetNumberOfFiresInRange(x, y, z, 1) == 0 then
  567.                                 TriggerServerEvent("lol:removefires", x, y, z, i)                          
  568.                             end
  569.                         end
  570.                     --end
  571.                                                                    
  572.                         local chances = math.random(1, 1000)
  573.                         if chances > chanceForSpread then
  574.                         if FSData.originalfiremaker == tostring(GetPlayerPed(-1)) then
  575.                        
  576.                             local xrand = FSData.lastamnt[i+1] + math.random(-6, 6)
  577.                             local yrand = FSData.lastamnt[i+2] + math.random(-6, 6)
  578.                             while xrand > -1 and xrand < 2 do
  579.                                 xrand = xrand + math.random(2, 6)
  580.                             end
  581.                             while yrand > -1 and yrand < 2 do
  582.                                 yrand = yrand + math.random(2, 6)
  583.                             end
  584.                            
  585.                             table.insert(FSData.lastamnt, 20)
  586.                            
  587.                            
  588.                             local rand = math.random(1, 200)
  589.                             if rand > 100 then
  590.                                 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))
  591.                             else
  592.                                 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))
  593.                             end
  594.                             table.insert(FSData.lastamnt, xrand)
  595.                             table.insert(FSData.lastamnt, yrand)
  596.                             table.insert(FSData.lastamnt, FSData.lastamnt[i+3])
  597.                             table.insert(fireremover, StartScriptFire (xrand, yrand, FSData.lastamnt[i+3]-0.1, 25, false))
  598.                             table.insert(fireremover, xrand)
  599.                             table.insert(fireremover, yrand)
  600.                             table.insert(fireremover, FSData.lastamnt[i+3]-0.1)
  601.             local firec = {}
  602.             local lastamnt = {}
  603.             local deletedfires = {}
  604.             for i=1,#FSData.firecoords do
  605.                     firec[i] = FSData.firecoords[i]
  606.             end
  607.             for i=1,#FSData.lastamnt do
  608.                     lastamnt[i] = FSData.lastamnt[i]
  609.             end
  610.             for i=1,#FSData.deletedfires do
  611.                     deletedfires[i] = FSData.deletedfires[i]
  612.             end
  613.    
  614.                 local original = tostring(FSData.originalfiremaker)
  615.                 TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  616.                 end
  617.                         end
  618.                    
  619.         end
  620.                 end
  621.                
  622.         Citizen.Wait(50)
  623.            
  624.     end
  625. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top