Advertisement
Guest User

client

a guest
Apr 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.02 KB | None | 0 0
  1. fireremover = {}
  2. fireremoverParticles = {}
  3. streetnames = {}
  4.  
  5.  
  6. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  7.  
  8. -------------------------------------------------------------------- CONFIG AREA -------------------------------------------------------------------------
  9.  
  10. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  11. local chatStreetAlerts = true
  12. local chanceForSpread = 800 -- 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 = 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
  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'] = -2125.2465820313, ['y'] = 3227.9423828125, ['z'] = 32.810272216797 }, -- militærbase
  18. { ['x'] = 1974.7619628906, ['y'] = 5168.2524414063, ['z'] = 47.639114379883 }, -- garasje
  19. { ['x'] = -324.30276489258, ['y'] = 2817.9509277344, ['z'] = 59.449714660645 }, -- kirke
  20. { ['x'] = -1184.7526855469, ['y'] = -2916.9453125, ['z'] = 16.340362548828 }, -- flyplass
  21. { ['x'] = 1911.8255615234, ['y'] = 5101.62890625, ['z'] = 44.19255065918 }, -- hasjplantasjen
  22. { ['x'] = -144.15065002441, ['y'] = -1031.8363037109, ['z'] = 27.273225784302 }, -- constructionsite
  23. { ['x'] = 2135.9177246094, ['y'] = 4783.0009765625, ['z'] = 40.970287322998 }, -- flyplasshangar lørenskog
  24. { ['x'] = 135.07022094727, ['y'] = -1047.7298583984, ['z'] = 29.151817321777 }, -- garasje2
  25. { ['x'] = 2515.7746582031, ['y'] = 4199.3876953125, ['z'] = 40.005928039551 }, -- nedlagt bensinstasjon
  26. { ['x'] = 612.51690673828, ['y'] = -3083.1735839844, ['z'] = 6.0692610740662 }, -- lagerbygning furusetveien
  27. { ['x'] = -294.27368164063, ['y'] = -322.60372924805, ['z'] = 10.063150405884 }, -- t-bane
  28. { ['x'] = 2740.7580566406, ['y'] = 1537.6781005859, ['z'] = 57.562355041504 }, -- gassanlegg
  29. { ['x'] = 1718.5220947266, ['y'] = -1621.4730224609, ['z'] = 112.47638702393 }, -- oljerafinneri
  30. { ['x'] = -1781.9605712891, ['y'] = -7.2708868980408, ['z'] = 76.503372192383 }, -- skogbrann
  31. { ['x'] = 2003.9211425781, ['y'] = 3773.48828125, ['z'] = 32.097644805908 }, -- bensinstasjon lørenskog
  32. { ['x'] = -594.46502685547, ['y'] = 530.6513671875, ['z'] = 107.96501922607 }, -- husbrann
  33. { ['x'] = 3530.2900390625, ['y'] = 3672.9086914063, ['z'] = 20.99178314209 }, -- anleggsbrann granveien
  34. { ['x'] = 1632.2204589844, ['y'] = 3654.2551269531, ['z'] = 35.375030517578 }, -- ruin lørenskog
  35. { ['x'] = -367.00271606445, ['y'] = 277.67916870117, ['z'] = 86.421974182129 }, -- restaurant
  36. { ['x'] = 1943.25, ['y'] = 3803.8957519531, ['z'] = 32.037155151367 }, -- hus lørenskog
  37. { ['x'] = 1592.3221435547, ['y'] = 3581.8349609375, ['z'] = 35.419017791748 }, -- motell lørenskog
  38. { ['x'] = 2079.7961425781, ['y'] = 2952.1394042969, ['z'] = 49.921787261963 }, -- satelitt
  39. { ['x'] = 2093.0078125, ['y'] = 2326.2414550781, ['z'] = 94.285247802734 }, -- vindmølle
  40. { ['x'] = 1991.6885986328, ['y'] = 3048.0285644531, ['z'] = 47.215137481689 }, -- bar lørenskog
  41. { ['x'] = -806.16943359375, ['y'] = 185.41775512695, ['z'] = 72.361778259277 }, -- michael
  42. { ['x'] = 1216.2164306641, ['y'] = 1846.537109375, ['z'] = 78.38330078125 }, -- Fridtjof Nansens Vei
  43. { ['x'] = -331.76629638672, ['y'] = 6082.7612304688, ['z'] = 31.454782485962 }, -- våpenbutikk
  44. { ['x'] = 772.05145263672, ['y'] = 1278.0921630859, ['z'] = 359.76986694336 }, -- Nedre Slottsgate
  45. { ['x'] = -9.6668758392334, ['y'] = -1428.5266113281, ['z'] = 32.090026855469 }, -- Franklin tante
  46. { ['x'] = -43.882583618164, ['y'] = -1749.1540527344, ['z'] = 29.421016693115 }, -- bensinstasjon bakrom
  47. { ['x'] = -808.25994873047, ['y'] = 167.83444213867, ['z'] = 76.213180541992 }, -- Michael andre etasje
  48. { ['x'] = 294.841796875, ['y'] = -1448.3198242188, ['z'] = 29.966617584229 }, -- akkuten
  49. { ['x'] = -9.3113622665405, ['y'] = 521.69006347656, ['z'] = 174.62789916992 }, -- Franklin
  50. { ['x'] = 383.21377563477, ['y'] = 792.38513183594, ['z'] = 187.70574951172 }, -- buskebrann
  51. { ['x'] = -2284.7314453125, ['y'] = 353.40316772461, ['z'] = 174.60159301758 }, -- fbi
  52. { ['x'] = -1636.5318603516, ['y'] = 180.8108215332, ['z'] = 61.757270812988 }, -- skole
  53. { ['x'] = 981.18426513672, ['y'] = -96.728797912598, ['z'] = 74.324821472168 }, -- mc klubb
  54. { ['x'] = -147.63400268555, ['y'] = 1902.1677246094, ['z'] = 197.23432922363 }, -- grisebinge
  55. { ['x'] = 246.98278808594, ['y'] = 229.41761779785, ['z'] = 106.28726196289 }, -- bank
  56. { ['x'] = -75.440742492676, ['y'] = 1891.087890625, ['z'] = 198.10313415527 }, -- traktorhenger
  57. { ['x'] = 804.85003662109, ['y'] = -490.83276367188, ['z'] = 30.02071762085 }, -- trafostasjon Arendalsgata
  58. { ['x'] = -562.03887939453, ['y'] = 286.41510009766, ['z'] = 82.17643737793 }, -- bar sentrum
  59. { ['x'] = -579.80694580078, ['y'] = 191.43849182129, ['z'] = 71.347160339355 }, -- søppel
  60. { ['x'] = -64.704696655273, ['y'] = 1948.7521972656, ['z'] = 192.82746887207 }, -- gassanlegg2
  61. { ['x'] = 366.17932128906, ['y'] = 2572.9404296875, ['z'] = 43.519527435303 }, -- trailer
  62. { ['x'] = -227.18383789063, ['y'] = -1999.6853027344, ['z'] = 24.685426712036 }, -- FameOrShame
  63. { ['x'] = 684.34912109375, ['y'] = 579.08636474609, ['z'] = 130.4613494873 }, -- konsert
  64. { ['x'] = -480.53015136719, ['y'] = -2682.7790527344, ['z'] = 8.7611312866211 }, -- båt
  65. { ['x'] = -1695.4001464844, ['y'] = -1072.044921875, ['z'] = 13.042688369751 }, -- pølsekiosk
  66. { ['x'] = -105.54790496826, ['y'] = -2686.1103515625, ['z'] = 6.0046763420105 }, -- harbour
  67. { ['x'] = 938.01647949219, ['y'] = -1205.9440917969, ['z'] = 25.780965805054 }, -- container
  68. { ['x'] = 706.82647705078, ['y'] = 116.54632568359, ['z'] = 80.956413269043 }, -- strøm sentrum
  69. { ['x'] = 1906.9803466797, ['y'] = 4921.5576171875, ['z'] = 48.94556427002 }, -- låve
  70. { ['x'] = 2196.3347167969, ['y'] = 5593.5131835938, ['z'] = 53.780456542969 }, -- methlab
  71. { ['x'] = 2433.5712890625, ['y'] = 4968.1904296875, ['z'] = 42.347606658936 }, -- methlab2
  72. { ['x'] = -299.99279785156, ['y'] = 1445.4071044922, ['z'] = 337.66955566406 }, -- observatorie skog
  73. { ['x'] = -449.03213500977, ['y'] = 1115.8165283203, ['z'] = 325.85415649414 }, -- observatorie
  74. { ['x'] = 2672.400390625, ['y'] = 2865.5090332031, ['z'] = 45.676414489746 }, -- steinbrudd
  75. { ['x'] = 298.0188293457, ['y'] = -906.51586914063, ['z'] = 29.292921066284 }, -- sentrum
  76. { ['x'] = 312.36166381836, ['y'] = -1645.3015136719, ['z'] = 32.531322479248 }, -- Grønland
  77. { ['x'] = 145.95579528809, ['y'] = -743.77166748047, ['z'] = 254.15216064453 }, -- fbi2
  78. { ['x'] = 6.6683206558228, ['y'] = -663.32250976563, ['z'] = 34.304737091064 }, -- bank
  79. { ['x'] = -1055.6663818359, ['y'] = -230.32911682129, ['z'] = 44.092220306396 }, -- facebook
  80. }
  81.  
  82. if spawnRandomFires == true then
  83. Citizen.CreateThread(function()
  84.  
  85. while true do
  86. Citizen.Wait(randomSpawnTime)
  87. local randomNumber = math.random(1,1000)
  88.  
  89. if randomNumber > spawnRandomFireChance then
  90. local possibleLocations = #randomFireLocations
  91. local LocationID = math.random(1, possibleLocations)
  92. local location = randomFireLocations[LocationID]
  93. local x = location.x
  94. local y = location.y
  95. local z = location.z
  96. FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  97.  
  98.  
  99.  
  100.  
  101.  
  102. if not HasNamedPtfxAssetLoaded("core") then
  103. RequestNamedPtfxAsset("core")
  104. while not HasNamedPtfxAssetLoaded("core") do
  105. Wait(1)
  106. end
  107. end
  108. SetPtfxAssetNextCall("core")
  109.  
  110.  
  111.  
  112. table.insert(FSData.lastamnt, 20)
  113.  
  114. local rand = math.random(1, 200)
  115. if rand > 100 then
  116. 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))
  117. else
  118. 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))
  119. end
  120. table.insert(FSData.lastamnt, x)
  121. table.insert(FSData.lastamnt, y)
  122. table.insert(FSData.lastamnt, z-0.8)
  123.  
  124. table.insert(fireremover, StartScriptFire (x, y, z-0.8, 25, false))
  125. table.insert(fireremover, x)
  126. table.insert(fireremover, y)
  127. table.insert(fireremover, z-0.8)
  128. local firec = {}
  129. local lastamnt = {}
  130. local deletedfires = {}
  131. for i=1,#FSData.firecoords do
  132. firec[i] = FSData.firecoords[i]
  133. end
  134. for i=1,#FSData.lastamnt do
  135. lastamnt[i] = FSData.lastamnt[i]
  136. end
  137. for i=1,#FSData.deletedfires do
  138. deletedfires[i] = FSData.deletedfires[i]
  139. end
  140. local original = tostring(FSData.originalfiremaker)
  141. if chatStreetAlerts == true then
  142. chatAlerts(x, y, z)
  143. end
  144. TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  145. Citizen.Wait(2000)
  146.  
  147.  
  148. end
  149. end
  150.  
  151. end)
  152. end
  153. function chatAlerts(x, y, z)
  154. Citizen.CreateThread(function()
  155. local text = "this"
  156. local streetA, streetB = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, x, y, z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
  157.  
  158. table.insert( streetnames, GetStreetNameFromHashKey( streetA ) )
  159. if tostring(streetB) ~= "0" then
  160. table.insert( streetnames, GetStreetNameFromHashKey( streetB ) )
  161. end
  162. if tostring(streetB) ~= "0" then
  163. text = table.concat( streetnames, " & " )
  164. else
  165. text = GetStreetNameFromHashKey( streetA )
  166. end
  167. TriggerServerEvent("fire:chatAlert", text)
  168. streetnames = {}
  169. end)
  170. end
  171.  
  172.  
  173. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  174.  
  175. --------------------------------------------------------------- Handles the use of /fire -----------------------------------------------------------------
  176.  
  177. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  178.  
  179. RegisterNetEvent("lol:firethings")
  180. AddEventHandler("lol:firethings", function()
  181. local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  182. FSData.removeallfires = false
  183. local coordis = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  184. local count = math.random(3, 6)
  185. FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  186. while (count > 0) do
  187. x = x + math.random(-5, 5)
  188. y = y + math.random(-5, 5)
  189. if not HasNamedPtfxAssetLoaded("core") then
  190. RequestNamedPtfxAsset("core")
  191. while not HasNamedPtfxAssetLoaded("core") do
  192. Wait(1)
  193. end
  194. end
  195. SetPtfxAssetNextCall("core")
  196.  
  197. table.insert(FSData.lastamnt, 20)
  198. local rand = math.random(1, 200)
  199. if rand > 100 then
  200. 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))
  201. else
  202. 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))
  203. end
  204. table.insert(FSData.lastamnt, x+5)
  205. table.insert(FSData.lastamnt, y)
  206. table.insert(FSData.lastamnt, z-0.7)
  207. table.insert(fireremover, StartScriptFire (x+5, y, z-0.8, 24, false))
  208. table.insert(fireremover, x+5)
  209. table.insert(fireremover, y)
  210. table.insert(fireremover, z-0.8)
  211. count = count - 1
  212. end
  213. local firec = {}
  214. local lastamnt = {}
  215. local deletedfires = {}
  216. for i=1,#FSData.firecoords do
  217. firec[i] = FSData.firecoords[i]
  218. end
  219. for i=1,#FSData.lastamnt do
  220. lastamnt[i] = FSData.lastamnt[i]
  221. end
  222. for i=1,#FSData.deletedfires do
  223. deletedfires[i] = FSData.deletedfires[i]
  224. end
  225. local original = tostring(FSData.originalfiremaker)
  226. TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  227.  
  228.  
  229. if chatStreetAlerts == false then
  230. chatAlerts(x, y, z)
  231. end
  232. --firehelper(fireremover)
  233. end)
  234.  
  235. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  236.  
  237. -------------------------------------------------------- Remove all fires currently not working ----------------------------------------------------------
  238.  
  239. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  240.  
  241. RegisterNetEvent("lol:firestop")
  242. AddEventHandler("lol:firestop", function()
  243. for i=1,#fireremover do
  244. RemoveScriptFire(fireremover[i])
  245. end
  246. for i=1,#fireremoverParticles do
  247.  
  248. RemoveParticleFx(fireremoverParticles[i], true)
  249. end
  250. for i=1,#FSData.lastamnt do
  251. RemoveParticleFx(FSData.lastamnt[i], true)
  252.  
  253. end
  254. fireremoverParticles = {}
  255. fireremover = {}
  256. end)
  257. RegisterNetEvent("lol:fireremovesync")
  258. AddEventHandler("lol:fireremovesync", function( firec, lastamnt, deletedfires, original )
  259.  
  260. FSData.originalfiremaker = original
  261.  
  262. for i=1,#firec do
  263. FSData.firecoords[i] = firec[i]
  264. end
  265. for i=1,#lastamnt do
  266. FSData.lastamnt[i] = lastamnt[i]
  267. end
  268. for i=1,#deletedfires do
  269. FSData.deletedfires[i] = deletedfires[i]
  270. end
  271.  
  272. end)
  273.  
  274. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  275.  
  276. ------------------------------------------------------------- Thread to handle fire syncing --------------------------------------------------------------
  277.  
  278. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  279.  
  280. RegisterNetEvent("lol:firesyncs2")
  281. AddEventHandler("lol:firesyncs2", function( firec, lastamnt, deletedfires, original )
  282.  
  283. FSData.originalfiremaker = original
  284.  
  285. for i=1,#firec do
  286. FSData.firecoords[i] = firec[i]
  287. end
  288. for i=1,#lastamnt do
  289. FSData.lastamnt[i] = lastamnt[i]
  290. end
  291. for i=1,#deletedfires do
  292. FSData.deletedfires[i] = deletedfires[i]
  293. end
  294. TriggerServerEvent("lol:firesyncs60")
  295. end)
  296.  
  297. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  298.  
  299. ----------------------------------------------------------------- just a debug function ------------------------------------------------------------------
  300.  
  301. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  302.  
  303. RegisterNetEvent("lol:test2")
  304. AddEventHandler("lol:test2", function( test )
  305. TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"test string: " .. tostring(test))
  306. end)
  307. function firehelper(fireremover)
  308. for i=1,#fireremover do
  309. PlaceObjectOnGroundProperly(fireremover[i])
  310. end
  311.  
  312. end
  313.  
  314. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  315.  
  316. --------------------------------------------------------- Produces players coordinates in chat -----------------------------------------------------------
  317.  
  318. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  319.  
  320. RegisterNetEvent("lol:coords")
  321. AddEventHandler("lol:coords", function()
  322. local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  323. TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"X: " .. tostring(x) .. " Y: " .. tostring(y) .. " Z: " .. tostring(z))
  324.  
  325.  
  326. end)
  327.  
  328. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  329.  
  330. --------------------------------------- Produces a count of all fires spawned sense last script restart --------------------------------------------------
  331.  
  332. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  333.  
  334. RegisterNetEvent("lol:firecounter")
  335. AddEventHandler("lol:firecounter", function()
  336. local counter = 0
  337. for i=1,#FSData.lastamnt do
  338. if FSData.lastamnt[i-1] == 20 or FSData.lastamnt[i-1] == 1 then
  339. counter = counter + 1
  340. end
  341. end
  342. TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"Det var " .. counter .. " branner i dag!")
  343.  
  344. end)
  345.  
  346. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  347.  
  348. ----------------------------------------------------------- Spawns all fires synced to client ------------------------------------------------------------
  349.  
  350. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  351.  
  352. RegisterNetEvent("lol:firesync3")
  353. AddEventHandler("lol:firesync3", function()
  354. for i=1,#FSData.lastamnt do
  355. if FSData.lastamnt[i-1] == 20 then
  356.  
  357. local x = FSData.lastamnt[i+1]
  358. local y = FSData.lastamnt[i+2]
  359. local z = FSData.lastamnt[i+3]
  360. SetPtfxAssetNextCall("core")
  361. if FSData.originalfiremaker ~= tostring(GetPlayerPed(-1)) then
  362. local rand = math.random(1, 200)
  363. if rand > 100 then
  364. 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))
  365. else
  366. 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))
  367. end
  368. table.insert(fireremover, StartScriptFire (x, y, z-0.1, 25, false))
  369. end
  370. end
  371. end
  372. end)
  373.  
  374. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  375.  
  376. ---------------------------------------------------- Sets fires under the last vehicle ped was in --------------------------------------------------------
  377.  
  378. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  379.  
  380. RegisterNetEvent("lol:carbomb")
  381. AddEventHandler("lol:carbomb", function()
  382. FSData.removeallfires = false
  383.  
  384. local vehicle = GetPlayersLastVehicle()
  385. if (vehicle == nil) then
  386. return
  387. end
  388. FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  389. local x, y, z = table.unpack(GetEntityCoords(vehicle, true))
  390. TriggerEvent("chatMessage", "OBRE", {255, 0, 0},"Bilen din eksploderte!")
  391.  
  392. local count = math.random(2,10)
  393. while (count > 0) do
  394. x = x + math.random(-1, 1)
  395. y = y + math.random(-1, 1)
  396. if not HasNamedPtfxAssetLoaded("core") then
  397. RequestNamedPtfxAsset("core")
  398. while not HasNamedPtfxAssetLoaded("core") do
  399. Wait(1)
  400. end
  401. end
  402. SetPtfxAssetNextCall("core")
  403. table.insert(FSData.lastamnt, 20)
  404.  
  405.  
  406. local rand = math.random(1, 200)
  407. if rand > 100 then
  408. 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))
  409. else
  410. 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))
  411. end
  412. table.insert(FSData.lastamnt, x)
  413. table.insert(FSData.lastamnt, y)
  414. table.insert(FSData.lastamnt, z)
  415. table.insert(fireremover, StartScriptFire (x, y, z-0.8, 24, false))
  416. table.insert(fireremover, x)
  417. table.insert(fireremover, y)
  418. table.insert(fireremover, z)
  419. count = count - 1
  420. end
  421. local firec = {}
  422. local lastamnt = {}
  423. local deletedfires = {}
  424. for i=1,#FSData.firecoords do
  425. firec[i] = FSData.firecoords[i]
  426. end
  427. for i=1,#FSData.lastamnt do
  428. lastamnt[i] = FSData.lastamnt[i]
  429. end
  430. for i=1,#FSData.deletedfires do
  431. deletedfires[i] = FSData.deletedfires[i]
  432. end
  433. local original = tostring(FSData.originalfiremaker)
  434. TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  435. if chatStreetAlerts == false then
  436. chatAlerts(x, y, z)
  437. end
  438.  
  439. end)
  440.  
  441. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  442.  
  443. ------------------------------------------- Responsible for syncing fires to all clients (deprecated) ----------------------------------------------------
  444.  
  445. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  446.  
  447. RegisterNetEvent("lol:firesync")
  448. AddEventHandler("lol:firesync", function()
  449.  
  450. local removedFires = FSData.removeallfires
  451. local fireCoords = FSData.firecoords
  452.  
  453. if removedFires == true then
  454. for i=1,#fireremover do
  455. RemoveScriptFire(fireremover[i])
  456. end
  457. for i=1,#fireremoverParticles do
  458. RemoveParticleFx(fireremoverParticles[i], true)
  459. end
  460. fireremoverParticles = {}
  461. fireremover = {}
  462. removedFires = false
  463. FSData.originalfiremaker = nil
  464. local firec = {}
  465. local lastamnt = {}
  466. local deletedfires = {}
  467. for i=1,#FSData.firecoords do
  468. firec[i] = FSData.firecoords[i]
  469. end
  470. for i=1,#FSData.lastamnt do
  471. lastamnt[i] = FSData.lastamnt[i]
  472. end
  473. for i=1,#FSData.deletedfires do
  474. deletedfires[i] = FSData.deletedfires[i]
  475. end
  476.  
  477. local original = tostring(FSData.originalfiremaker)
  478. TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  479. end
  480.  
  481.  
  482.  
  483.  
  484.  
  485. end)
  486.  
  487. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  488.  
  489. ----------------------------------------------------- Mostly unused but still here for debuging ----------------------------------------------------------
  490.  
  491. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  492.  
  493. RegisterNetEvent("lol:fireremovess")
  494. AddEventHandler("lol:fireremovess", function( x, y, z, test )
  495.  
  496. local l = test
  497.  
  498. for i=1,#fireremoverParticles do
  499. if fireremoverParticles[l+1] == fireremoverParticles[i+1] then
  500. RemoveParticleFxInRange(fireremoverParticles[i+1], fireremoverParticles[i+2], fireremoverParticles[i+3], 1.5)
  501. end
  502. end
  503. for i=1,#FSData.lastamnt do
  504. if FSData.lastamnt[i+1] == FSData.lastamnt[l+1] then
  505. RemoveParticleFxInRange(FSData.lastamnt[i+1], FSData.lastamnt[i+2], FSData.lastamnt[i+3], 1.5)
  506. FSData.lastamnt[i-1] = 1
  507. end
  508. end
  509.  
  510. end)
  511.  
  512. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  513.  
  514. --------------------------------------------------------- Thread to handle spawning initial fire ---------------------------------------------------------
  515.  
  516. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  517.  
  518. Citizen.CreateThread(function()
  519. while true do
  520. Citizen.Wait(0)
  521. if IsControlJustPressed(1, 168) then -- button f7
  522. FSData.originalfiremaker = tostring(GetPlayerPed(-1))
  523.  
  524. local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  525. local coords = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  526.  
  527.  
  528. if not HasNamedPtfxAssetLoaded("core") then
  529. RequestNamedPtfxAsset("core")
  530. while not HasNamedPtfxAssetLoaded("core") do
  531. Wait(1)
  532. end
  533. end
  534. SetPtfxAssetNextCall("core")
  535.  
  536.  
  537.  
  538. table.insert(FSData.lastamnt, 20)
  539.  
  540. local rand = math.random(1, 200)
  541. if rand > 100 then
  542. 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))
  543. else
  544. 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))
  545. end
  546. table.insert(FSData.lastamnt, x+5)
  547. table.insert(FSData.lastamnt, y)
  548. table.insert(FSData.lastamnt, z-0.7)
  549.  
  550. table.insert(fireremover, StartScriptFire (x+5, y, z-0.8, 25, false))
  551. table.insert(fireremover, x+5)
  552. table.insert(fireremover, y)
  553. table.insert(fireremover, z-0.8)
  554. local firec = {}
  555. local lastamnt = {}
  556. local deletedfires = {}
  557. for i=1,#FSData.firecoords do
  558. firec[i] = FSData.firecoords[i]
  559. end
  560. for i=1,#FSData.lastamnt do
  561. lastamnt[i] = FSData.lastamnt[i]
  562. end
  563. for i=1,#FSData.deletedfires do
  564. deletedfires[i] = FSData.deletedfires[i]
  565. end
  566. local original = tostring(FSData.originalfiremaker)
  567. if chatStreetAlerts == false then
  568. chatAlerts(x, y, z)
  569. end
  570. TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  571. Citizen.Wait(2000)
  572. end
  573. end
  574. end)
  575.  
  576. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  577.  
  578. ---------------------------------------------------------- Thread to handle spreading of fires -----------------------------------------------------------
  579.  
  580. ----------------------------------------------------------------------------------------------------------------------------------------------------------
  581.  
  582. Citizen.CreateThread(function()
  583.  
  584. while true do
  585.  
  586. Wait(1000)
  587. for i=1,#FSData.lastamnt do
  588. Wait(50)
  589.  
  590. if FSData.lastamnt[i-1] == 20 then
  591.  
  592.  
  593. if not HasNamedPtfxAssetLoaded("core") then
  594. RequestNamedPtfxAsset("core")
  595. while not HasNamedPtfxAssetLoaded("core") do
  596. Wait(1)
  597. end
  598. end
  599.  
  600. SetPtfxAssetNextCall("core")
  601. if DoesEntityExist(FSData.lastamnt[i]) then
  602.  
  603. PlaceObjectOnGroundProperly(FSData.lastamnt[i])
  604. end
  605.  
  606. local x = FSData.lastamnt[i+1]
  607. local y = FSData.lastamnt[i+2]
  608. local z = FSData.lastamnt[i+3]
  609.  
  610. --if FSData.originalfiremaker == tostring(GetPlayerPed(-1)) then
  611. if GetNumberOfFiresInRange(x, y, z, 1) == 0 then
  612. if GetNumberOfFiresInRange(x, y, z, 1) == 0 then
  613. TriggerServerEvent("lol:removefires", x, y, z, i)
  614. end
  615. end
  616. --end
  617.  
  618. local chances = math.random(1, 1000)
  619. if chances > chanceForSpread then
  620. if FSData.originalfiremaker == tostring(GetPlayerPed(-1)) then
  621.  
  622. local xrand = FSData.lastamnt[i+1] + math.random(-6, 6)
  623. local yrand = FSData.lastamnt[i+2] + math.random(-6, 6)
  624. while xrand > -1 and xrand < 2 do
  625. xrand = xrand + math.random(2, 6)
  626. end
  627. while yrand > -1 and yrand < 2 do
  628. yrand = yrand + math.random(2, 6)
  629. end
  630.  
  631. table.insert(FSData.lastamnt, 20)
  632.  
  633.  
  634. local rand = math.random(1, 200)
  635. if rand > 100 then
  636. 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))
  637. else
  638. 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))
  639. end
  640. table.insert(FSData.lastamnt, xrand)
  641. table.insert(FSData.lastamnt, yrand)
  642. table.insert(FSData.lastamnt, FSData.lastamnt[i+3])
  643. table.insert(fireremover, StartScriptFire (xrand, yrand, FSData.lastamnt[i+3]-0.1, 25, false))
  644. table.insert(fireremover, xrand)
  645. table.insert(fireremover, yrand)
  646. table.insert(fireremover, FSData.lastamnt[i+3]-0.1)
  647. local firec = {}
  648. local lastamnt = {}
  649. local deletedfires = {}
  650. for i=1,#FSData.firecoords do
  651. firec[i] = FSData.firecoords[i]
  652. end
  653. for i=1,#FSData.lastamnt do
  654. lastamnt[i] = FSData.lastamnt[i]
  655. end
  656. for i=1,#FSData.deletedfires do
  657. deletedfires[i] = FSData.deletedfires[i]
  658. end
  659.  
  660. local original = tostring(FSData.originalfiremaker)
  661. TriggerServerEvent("lol:firesyncs", firec, lastamnt, deletedfires, original)
  662. end
  663. end
  664.  
  665. end
  666. end
  667.  
  668. Citizen.Wait(50)
  669.  
  670. end
  671. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement