Guest User

Untitled

a guest
Mar 13th, 2020
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.05 KB | None | 0 0
  1. local mLibs = exports["meta_libs"]
  2. local progBar = (Config.UseProgBars and exports["progbars"] or false)
  3. local Vector = mLibs:Vector()
  4. local Scenes = mLibs:SynchronisedScene()
  5. local sceneObjects = {}
  6. local SlingNextFrame = false
  7. local MarketAccess = false
  8. local StopInfluence = false
  9.  
  10. local _print = print
  11. local print = function(...)
  12. if Config.Debug then
  13. _print(...)
  14. end
  15. end
  16.  
  17. vDist = function(v1,v2)
  18. if not v1 or not v2 or not v1.x or not v2.x or not v1.z or not v2.z then return 0; end
  19. return math.sqrt( ((v1.x - v2.x)*(v1.x-v2.x)) + ((v1.y - v2.y)*(v1.y-v2.y)) + ((v1.z-v2.z)*(v1.z-v2.z)) )
  20. end
  21.  
  22. HelpNotification = function(msg)
  23. AddTextEntry('TerritoriesHelp', msg)
  24. BeginTextCommandDisplayHelp('TerritoriesHelp')
  25. EndTextCommandDisplayHelp(0, false, true, -1)
  26. end
  27.  
  28. ShowNotification = function(msg)
  29. AddTextEntry('TerritoriesNotify', msg)
  30. SetNotificationTextEntry('TerritoriesNotify')
  31. DrawNotification(false, true)
  32. end
  33.  
  34. Start = function()
  35. GetFramework()
  36. PlayerData = GetPlayerData()
  37. Wait(1000)
  38. TriggerServerEvent('Territories:PlayerLogin')
  39. while not ModStart do Wait(0); end
  40. for k,v in pairs(Territories) do
  41. local count = 0
  42. Territories[k].blips = {}
  43. for _,area in pairs(Territories[k].areas) do
  44. local blipHandle = mLibs:AddAreaBlip(area.location.x,area.location.y,area.location.z,area.height,area.width,area.heading,BlipColors[v.control],math.floor(v.influence),true,area.display)
  45. local blip = TableCopy(mLibs:GetBlip(blipHandle))
  46. Territories[k].blips[blipHandle] = blip
  47. end
  48. end
  49. Update()
  50. end
  51.  
  52. TableCopy = function(tab)
  53. local r = {}
  54. for k,v in pairs(tab) do
  55. if type(v) == "table" then
  56. r[k] = TableCopy(v)
  57. else
  58. r[k] = v
  59. end
  60. end
  61. return r
  62. end
  63.  
  64. Update = function()
  65. if Config.ShowDebugText then
  66. testText = Utils.drawTextTemplate()
  67. testText.x = 0.95
  68. testText.y = 0.90
  69. end
  70.  
  71. while true do
  72. local closest = GetClosestZone()
  73. local area = Territories[closest]
  74. local dead = DeathCheck(lastZone)
  75.  
  76. if not dead then
  77. CheckLocation(closest)
  78. UpdateBlips()
  79.  
  80. if Config.ShowDebugText and area then
  81. testText.colour1 = colorsRGB[TextColors[area.control]][1]
  82. testText.colour2 = colorsRGB[TextColors[area.control]][2]
  83. testText.colour3 = colorsRGB[TextColors[area.control]][3]
  84. testText.colour4 = math.floor(area.influence*2.5)
  85. testText.text = "Zone: "..closest.."\nControl: "..area.control:sub(1,1):upper()..area.control:sub(2).."\nInfluence: "..math.floor(area.influence).."%"
  86. Utils.drawText(testText)
  87. end
  88. end
  89.  
  90. Wait(0)
  91. end
  92. end
  93.  
  94. local GetKeyUp = function(key) return IsControlJustReleased(0,key); end
  95.  
  96. CheckLocation = function(closest)
  97. local area = Territories[closest]
  98. local plyPed = GetPlayerPed(-1)
  99. local plyPos = GetEntityCoords(plyPed)
  100. if closest then
  101. if not lastZone or lastZone ~= closest then
  102. if lastZone then
  103. TriggerServerEvent('Territories:LeaveZone',lastZone, PlayerData.job.name)
  104. end
  105. if not StopInfluence then
  106. lastZone = closest
  107. if PlayerData.job and PlayerData.job.name and GangLookup[PlayerData.job.name] then
  108. TriggerServerEvent('Territories:EnterZone',closest,PlayerData.job.name)
  109. elseif PlayerData.job2 and PlayerData.job2.name and GangLookup[PlayerData.job2.name] then
  110. TriggerServerEvent('Territories:EnterZone',closest,PlayerData.job2.name)
  111. end
  112. end
  113. else
  114. if lastZone and StopInfluence then
  115. if PlayerData.job and PlayerData.job.name and GangLookup[PlayerData.job.name] then
  116. TriggerServerEvent('Territories:LeaveZone',lastZone,PlayerData.job.name)
  117. elseif PlayerData.job2 and PlayerData.job2.name and GangLookup[PlayerData.job2.name] then
  118. TriggerServerEvent('Territories:LeaveZone',lastZone,PlayerData.job2.name)
  119. end
  120. end
  121. end
  122.  
  123. if area.control == PlayerData.job.name or (PlayerData.job2 and PlayerData.job2.name == area.control) then
  124. if area.actions and area.actions.entry then
  125. if vDist(plyPos,area.actions.entry.location) < Config.InteractDist then
  126. HelpNotification(area.actions.entry.helpText)
  127. if GetKeyUp(Config.InteractControl) then
  128. InsideInterior = area
  129. mLibs:TeleportPlayer(InsideInterior.actions.exit.location)
  130. end
  131. end
  132. end
  133.  
  134. if ((Config.SlingByHotkey and GetKeyUp(Config.SlingDrugsControl)) or SlingNextFrame) and not CurSlinging then
  135. SlingNextFrame = false
  136. SlingDrugs(area,closest)
  137. end
  138. end
  139.  
  140. if not InsideInterior then
  141. if vDist(plyPos,area.actions.exit.location) < Config.InteractDist then
  142. HelpNotification(area.actions.exit.helpText)
  143. if GetKeyUp(Config.InteractControl) then
  144. InsideInterior = area
  145. mLibs:TeleportPlayer(InsideInterior.actions.entry.location)
  146. end
  147. end
  148. end
  149. else
  150. if lastZone then
  151. if PlayerData.job and PlayerData.job.name and GangLookup[PlayerData.job.name] then
  152. TriggerServerEvent('Territories:LeaveZone',lastZone,PlayerData.job.name)
  153. elseif PlayerData.job2 and PlayerData.job2.name and GangLookup[PlayerData.job2.name] then
  154. TriggerServerEvent('Territories:LeaveZone',lastZone,PlayerData.job2.name)
  155. end
  156. lastZone = false
  157. end
  158. if not InsideInterior then
  159. local closestExit,exitDist
  160. for k,v in pairs(Territories) do
  161. local exit = v.actions.exit.location
  162. local dist = vDist(plyPos,exit)
  163. if not exitDist or dist < exitDist then
  164. closestExit = k
  165. exitDist = dist
  166. end
  167. end
  168.  
  169. if exitDist and exitDist < Config.InteractDist then
  170. HelpNotification(Territories[closestExit].actions.exit.helpText)
  171. if GetKeyUp(Config.InteractControl) then
  172. mLibs:TeleportPlayer(Territories[closestExit].actions.entry.location)
  173. InsideInterior = nil
  174. end
  175. end
  176. end
  177. end
  178.  
  179. if InsideInterior then
  180. local exitDist = vDist(plyPos,InsideInterior.actions.exit.location)
  181. if exitDist and exitDist < Config.InteractDist then
  182. HelpNotification(InsideInterior.actions.exit.helpText)
  183. if GetKeyUp(Config.InteractControl) then
  184. mLibs:TeleportPlayer(InsideInterior.actions.entry.location)
  185. InsideInterior = nil
  186. end
  187. else
  188. local closestAct,actDist = GetClosestAction(InsideInterior)
  189. if actDist < Config.InteractDist then
  190. HelpNotification(InsideInterior.actions[closestAct].helpText)
  191. if GetKeyUp(Config.InteractControl) then
  192. SceneHandler(InsideInterior.actions[closestAct])
  193. end
  194. end
  195. end
  196. end
  197. end
  198.  
  199. local soldPeds = {}
  200. SlingDrugs = function(area,key)
  201. if CurSlinging then return; end
  202. CurSlinging = true
  203. Wait(0)
  204. local allPeds
  205. local lastEntCheck = false
  206.  
  207. local playerSellables = {}
  208. local sellableDrugs = area.canSell
  209.  
  210. if not sellableDrugs then
  211. ShowNotification(_U["cant_sell_here"])
  212. CurSlinging = false
  213. return
  214. end
  215.  
  216. local sellableLookup = {}; for k,v in pairs(sellableDrugs) do sellableLookup[v] = true; end
  217. local plyInventory = ESX.GetPlayerData().inventory
  218. local hasSellable = 0
  219. for k,v in pairs(plyInventory) do
  220. if sellableLookup[v.name] and v.count and v.count > Config.MinSellAmount then
  221. playerSellables[v.name] = v.count
  222. hasSellable = hasSellable + 1
  223. end
  224. end
  225.  
  226. if hasSellable == 0 then
  227. ShowNotification(_U["no_drugs"])
  228. CurSlinging = false
  229. return
  230. end
  231.  
  232. mLibs:LoadAnimDict('amb@world_human_drug_dealer_hard@male@base')
  233.  
  234. TaskPlayAnim(GetPlayerPed(-1),'amb@world_human_drug_dealer_hard@male@base','base',8.0,8.0,-1,1,1.0,false,false,false)
  235. while CurSlinging do
  236. for i=30,35,1 do
  237. DisableControlAction(0,i,true)
  238. end
  239.  
  240. local plyPed = GetPlayerPed(-1)
  241. local now = GetGameTimer()
  242. if not lastEntCheck or (now - lastEntCheck) > 5000 then
  243. lastEntCheck = now
  244. allPeds = ESX.Game.GetPeds({plyPed})
  245. end
  246.  
  247. local plyPos = GetEntityCoords(plyPed)
  248. if not curSelling then
  249. local closestPed,closestDist
  250. for k,v in pairs(allPeds) do
  251. if not IsPedInAnyVehicle(v,false) and GetPedType(v) ~= 28 then
  252. local dist = vDist(plyPos,GetEntityCoords(v))
  253. if not closestDist or dist < closestDist then
  254. closestDist = dist
  255. closestPed = v
  256. end
  257. end
  258. end
  259. if closestDist and closestDist < Config.DrugSellDist and not soldPeds[closestPed] then
  260. math.randomseed(GetGameTimer())
  261. if math.random(100) <= Config.DrugBuyChance then
  262. curSelling = closestPed
  263. else
  264. soldPeds[closestPed] = true
  265. if math.random(100) <= Config.SalesReportChance then
  266. TaskTurnPedToFaceEntity(closestPed,plyPed,3000)
  267. SetPedKeepTask(closestPed,true)
  268. ShowNotification(_U["being_reported"])
  269. Citizen.CreateThread(function()
  270. local _closest = closestPed
  271. Wait(3000)
  272. local hp = GetEntityHealth(_closest)
  273. if hp > 100 then
  274. TriggerServerEvent("Territories:Reported",GetEntityCoords(_closest))
  275. end
  276. end)
  277. end
  278. end
  279. TaskTurnPedToFaceEntity(plyPed,closestPed,3000)
  280. end
  281. else
  282. if not soldPeds[curSelling] then
  283. local sellItem = false
  284. local inventory = ESX.GetPlayerData().inventory
  285. for k,v in pairs(inventory) do
  286. if sellableLookup[v.name] and v.count > Config.MinSellAmount then
  287. sellItem = v
  288. end
  289. end
  290.  
  291. if sellItem then
  292. ClearPedTasksImmediately(plyPed)
  293. TaskTurnPedToFaceEntity(plyPed,curSelling,5000)
  294. TaskTurnPedToFaceEntity(curSelling,plyPed,5000)
  295. SetPedKeepTask(curSelling,true)
  296. soldPeds[curSelling] = true
  297. SetPedTalk(curSelling)
  298. SetPedTalk(plyPed)
  299.  
  300. if progBar then
  301. progBar:StartProg(Config.SellDrugsTimer,_U["selling_drugs"])
  302. else
  303. ShowNotification(_U["selling_drugs"])
  304. end
  305.  
  306. Wait(Config.SellDrugsTimer)
  307. TaskPlayAnim(plyPed,'amb@world_human_drug_dealer_hard@male@base','base',8.0,8.0,-1,1,1.0,false,false,false)
  308.  
  309. local amountToSell = math.random(math.min(Config.MinSellAmount,math.max(Config.MinSellAmount,sellItem.count)))
  310. TriggerServerEvent("Territories:SoldDrugs",sellItem.name,amountToSell,key)
  311. else
  312. ShowNotification(_U["no_drugs"])
  313. break
  314. end
  315. else
  316. curSelling = false
  317. end
  318. end
  319.  
  320. HelpNotification(_U["cancel_selling"])
  321. if GetKeyUp(Config.SlingDrugsControl) then
  322. ClearPedTasksImmediately(plyPed)
  323. break
  324. end
  325.  
  326. Wait(0)
  327. end
  328. CurSlinging = false
  329. end
  330.  
  331. local startTime
  332. SceneHandler = function(action)
  333. local hasItem,itemLabel = not action.requireItem,''
  334. if action.requireItem then
  335. local plyData = ESX.GetPlayerData()
  336. for k,v in pairs(plyData.inventory) do
  337. if v.name == action.requireItem then
  338. hasItem = (v.count >= action.requireRate)
  339. itemLabel = v.label
  340. end
  341. end
  342. elseif action.requireCash then
  343. hasItem = false
  344. itemLabel = "Dirty Money"
  345. local plyData = ESX.GetPlayerData()
  346. for k,v in pairs(plyData.accounts) do
  347. if v.name == Config.DirtyAccount then
  348. hasItem = (v.money and v.money >= action.requireCash)
  349. end
  350. end
  351. end
  352.  
  353. if hasItem then
  354. local plyPed = GetPlayerPed(-1)
  355.  
  356. local sceneType = action.act
  357. local doScene = action.scene
  358. local actPos = action.location - action.offset
  359. local actRot = action.rotation
  360.  
  361. local animDict = SceneDicts[sceneType][doScene]
  362. local actItems = SceneItems[sceneType][doScene]
  363. local actAnims = SceneAnims[sceneType][doScene]
  364. local plyAnim = PlayerAnims[sceneType][doScene]
  365.  
  366. while not HasAnimDictLoaded(animDict) do RequestAnimDict(animDict); Wait(0); end
  367.  
  368.  
  369. local count = 1
  370. local objectCount = 0
  371. for k,v in pairs(actItems) do
  372. local hash = GetHashKey(v)
  373. while not HasModelLoaded(hash) do RequestModel(hash); Wait(0); end
  374. sceneObjects[k] = CreateObject(hash,actPos,true)
  375. SetModelAsNoLongerNeeded(hash)
  376. objectCount = objectCount + 1
  377. while not DoesEntityExist(sceneObjects[k]) do Wait(0); end
  378. SetEntityCollision(sceneObjects[k],false,false)
  379. end
  380.  
  381. local scenes = {}
  382. local sceneConfig = Scenes.SceneConfig(actPos,actRot,2,false,false,1.0,0,1.0)
  383.  
  384. for i=1,math.max(1,math.ceil(objectCount/3)),1 do
  385. scenes[i] = Scenes.Create(sceneConfig)
  386. end
  387.  
  388. local pedConfig = Scenes.PedConfig(plyPed,scenes[1],animDict,plyAnim)
  389. Scenes.AddPed(pedConfig)
  390.  
  391. for k,animation in pairs(actAnims) do
  392. local targetScene = scenes[math.ceil(count/3)]
  393. local entConfig = Scenes.EntityConfig(sceneObjects[k],targetScene,animDict,animation)
  394. Scenes.AddEntity(entConfig)
  395. count = count + 1
  396. end
  397.  
  398. local extras = {}
  399. if action.extraProps then
  400. for k,v in pairs(action.extraProps) do
  401. mLibs:LoadModel(v.model)
  402. local obj = CreateObject(GetHashKey(v.model), actPos + v.pos, true,true,true)
  403. while not DoesEntityExist(obj) do Wait(0); end
  404. SetEntityRotation(obj,v.rot)
  405. FreezeEntityPosition(obj,true)
  406. extras[#extras+1] = obj
  407. end
  408. end
  409.  
  410. startTime = GetGameTimer()
  411.  
  412. for i=1,#scenes,1 do
  413. Scenes.Start(scenes[i])
  414. end
  415.  
  416. if progBar then
  417. progBar:StartProg(action.time,action.progText)
  418. else
  419. ShowNotification(action.progText)
  420. end
  421.  
  422. Wait(action.time)
  423.  
  424. for i=1,#scenes,1 do
  425. Scenes.Stop(scenes[i])
  426. end
  427.  
  428. for k,v in pairs(extras) do
  429. DeleteObject(v)
  430. end
  431.  
  432. TriggerServerEvent('Territories:RewardPlayer',action)
  433. for k,v in pairs(sceneObjects) do NetworkFadeOutEntity(v,false,false); end
  434. else
  435. local str = _U["not_enough"]
  436. local label = (itemLabel:len() > 0 and itemLabel or 'UNKNOWN')
  437. local amount = (action.requireRate or (action.requireCash and "$"..action.requireCash or 'UNKNOWN'))
  438. ShowNotification(string.format(str,label,amount))
  439. end
  440. end
  441.  
  442. GetClosestAction = function(interior)
  443. local plyPos = GetEntityCoords(GetPlayerPed(-1))
  444. local closest,closestDist
  445. for k,v in pairs(interior.actions) do
  446. if k ~= "entry" and k ~= "exit" then
  447. local dist = vDist(plyPos,v.location)
  448. if not closestDist or dist < closestDist then
  449. closestDist = dist
  450. closest = k
  451. end
  452. end
  453. end
  454. return (closest or false),(closestDist or 9999)
  455. end
  456.  
  457. DeathCheck = function(zone)
  458. local plyPed = GetPlayerPed(-1)
  459. local plyHp = GetEntityHealth(plyPed)
  460. local dead = IsPedFatallyInjured(plyPed)
  461. if isDead then
  462. if not dead then
  463. isDead = false
  464. end
  465. else
  466. if dead and zone then
  467. isDead = true
  468. local killer = NetworkGetEntityKillerOfPlayer(PlayerId())
  469. local killerId = GetPlayerByEntityID(killer)
  470. if killer ~= plyPed and killerId ~= nil and NetworkIsPlayerActive(killerId) then
  471. local serverId = GetPlayerServerId(killerId)
  472. if serverId and serverId ~= -1 then
  473. TriggerServerEvent('Territories:GotMurdered',serverId,zone)
  474. end
  475. end
  476. end
  477. end
  478. return isDead
  479. end
  480.  
  481. Switch = function(cond,...)
  482. local args = {...}
  483. local even = (#args%2 == 0)
  484. for i=1,#args-(even and 0 or 1),2 do
  485. if cond == args[i] then
  486. return args[i+1]((even and nil or args[#args]))
  487. end
  488. end
  489. end
  490.  
  491. UpdateBlips = function()
  492. for k,v in pairs(Territories) do
  493. if Config.DrugProcessBlip then
  494. if not v.blip and PlayerData and (PlayerData.job and PlayerData.job.name and PlayerData.job.name == v.control or PlayerData.job2 and PlayerData.job2.name and PlayerData.job2.name == v.control) then
  495. v.blip = mLibs:AddBlip(v.blipData.pos.x,v.blipData.pos.y,v.blipData.pos.z,v.blipData.sprite,v.blipData.color,v.blipData.text,v.blipData.scale,v.blipData.display,v.blipData.shortRange,true)
  496. elseif v.blip then
  497. local inControl = false
  498. inControl = (PlayerData and PlayerData.job and PlayerData.job.name and PlayerData.job.name == v.control)
  499. inControl = (inControl == false and PlayerData.job2 and PlayerData.job2.name and PlayerData.job2.name == v.control or true)
  500. if not inControl then
  501. mLibs:RemoveBlip(v.blip)
  502. v.blip = false
  503. end
  504. end
  505. end
  506. if v.blips then
  507. for handle,blip in pairs(v.blips) do
  508. if Config.DisplayZoneForAll or PlayerInGang() then
  509. if blip.color ~= BlipColors[v.control] or blip.alpha ~= math.floor(v.influence) then
  510. mLibs:SetBlip(handle,"alpha",math.floor(v.influence))
  511. mLibs:SetBlip(handle,"color",BlipColors[v.control])
  512.  
  513. local b = TableCopy(mLibs:GetBlip(handle))
  514. Territories[k].blips[handle] = b
  515. end
  516. else
  517. if blip.alpha ~= 0 then
  518. mLibs:SetBlip(handle,"alpha",0)
  519. local b = TableCopy(mLibs:GetBlip(handle))
  520. Territories[k].blips[handle] = b
  521. end
  522. end
  523. end
  524. end
  525. end
  526. end
  527.  
  528. GetClosestZone = function()
  529. local closest
  530. local thisZone = GetNameOfZone(GetEntityCoords(GetPlayerPed(-1)))
  531. for k,v in pairs(Territories) do
  532. if v.zone == thisZone then
  533. closest = k
  534. end
  535. end
  536. return (closest or false)
  537. end
  538.  
  539. Sync = function(tab)
  540. for k,v in pairs(tab) do
  541. Territories[k].influence = v.influence
  542. Territories[k].control = v.control
  543. end
  544. end
  545.  
  546. GetPlayerByEntityID = function(id)
  547. for i=0,Config.MaxPlayerCount do
  548. if(NetworkIsPlayerActive(i) and GetPlayerPed(i) == id) then return i end
  549. end
  550. return nil
  551. end
  552.  
  553. PlayerInGang = function()
  554. if not PlayerData or (not PlayerData.job and not PlayerData.job2) or (not PlayerData.job.name and not PlayerData.job2.name) then return false; end
  555. if GangLookup[PlayerData.job.name] then
  556. return true
  557. else
  558. if PlayerData.job2 and PlayerData.job2.name and GangLookup[PlayerData.job2.name] then
  559. return true
  560. else
  561. return false
  562. end
  563. end
  564. end
  565.  
  566. if Config.StartEvent == "Thread" then
  567. Citizen.CreateThread(Start)
  568. else
  569. AddEventHandler(Config.StartEvent,Start)
  570. end
  571.  
  572. local isCuffed = false
  573. GotCuffed = function()
  574. isCuffed = not isCuffed
  575. local zone = (isCuffed and GetClosestZone())
  576. if zone then
  577. TriggerServerEvent('Territories:CuffSuccess',zone)
  578. end
  579. end
  580.  
  581. PlayerReported = function(pos)
  582. local job = ESX.GetPlayerData().job
  583. if job and job.name and PoliceLookup[job.name] then
  584. local started = GetGameTimer()
  585. ShowNotification(_U["drug_deal_reported"])
  586. while (GetGameTimer() - started) < 8000 do
  587. if IsControlJustReleased(0, 101) or IsDisabledControlJustReleased(0, 101) then
  588. SetNewWaypoint(pos.x,pos.y)
  589. return
  590. end
  591. Wait(0)
  592. end
  593. else
  594. local job2 = ESX.GetPlayerData().job2
  595. if job2 and job2.name and PoliceLookup[job2.name] then
  596. local started = GetGameTimer()
  597. ShowNotification(_U["drug_deal_reported"])
  598. while (GetGameTimer() - started) < 8000 do
  599. if IsControlJustReleased(0, 101) or IsDisabledControlJustReleased(0, 101) then
  600. SetNewWaypoint(pos.x,pos.y)
  601. return
  602. end
  603. Wait(0)
  604. end
  605. end
  606. end
  607. end
  608.  
  609. EnterHouse = function(...)
  610. if not Config.InfluenceInHouse then
  611. StopInfluence = true
  612. end
  613. end
  614.  
  615. LeaveHouse = function(...)
  616. if not Config.InfluenceInHouse then
  617. lastZone = false
  618. StopInfluence = false
  619. end
  620. end
  621.  
  622. StartRet = function(start,territories)
  623. ModStart = start
  624. Territories = territories
  625. end
  626.  
  627. RegisterCommand('slingdrugs', function(...) if not CurSlinging then SlingNextFrame = true; end; end)
  628.  
  629.  
  630. -- THINGS YOU MIGHT WANT TO CHANGE
  631. GetFramework = function()
  632. while not ESX do Wait(0) end
  633. while not ESX.IsPlayerLoaded() do Citizen.Wait(0); end
  634. end
  635.  
  636. GetPlayerData = function()
  637. return ESX.GetPlayerData()
  638. end
  639.  
  640. SetJob = function(job)
  641. PlayerData.job = job
  642.  
  643. if lastZone then
  644. TriggerServerEvent('Territories:LeaveZone',lastZone,PlayerData.job.name)
  645. lastZone = false
  646. end
  647. end
  648.  
  649. SetJob2 = function(job2)
  650. PlayerData.job2 = job2
  651. if lastZone then
  652. TriggerServerEvent('Territories:LeaveZone',lastZone,PlayerData.job2.name)
  653. lastZone = false
  654. end
  655. end
  656.  
  657. Utils.event(1,Sync,'Territories:Sync')
  658. Utils.event(1,StartRet,'Territories:StartRet')
  659. Utils.event(1,SetJob,Config.SetJobEvent)
  660. Utils.event(1,SetJob2,Config.SetJob2Event)
  661. Utils.event(1,GotCuffed,'Territories:GotCuffed')
  662. Utils.event(1,PlayerReported,'Territories:PlayerReported')
  663. Utils.event(1,GotMarketAccess,'Territories:GotMarketAccess')
  664. Utils.event(1,LostMarketAccess,'Territories:LostMarketAccess')
  665. Utils.event(1,EnterHouse,'playerhousing:Entered')
  666. Utils.event(1,LeaveHouse,'playerhousing:Leave')
Advertisement
Add Comment
Please, Sign In to add comment