Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.58 KB | None | 0 0
  1. -- Display markers
  2. Citizen.CreateThread(function()
  3. while true do
  4.  
  5. Wait(800)
  6.  
  7. if PlayerData.job ~= nil and PlayerData.job.name == 'gang' then
  8.  
  9. local playerPed = GetPlayerPed(-1)
  10. local coords = GetEntityCoords(playerPed)
  11.  
  12. for k,v in pairs(Config.GangStations) do
  13.  
  14. for i=1, #v.Cloakrooms, 1 do
  15. if GetDistanceBetweenCoords(coords, v.Cloakrooms[i].x, v.Cloakrooms[i].y, v.Cloakrooms[i].z, true) < Config.DrawDistance then
  16. DrawMarker(20, v.Cloakrooms[i].x, v.Cloakrooms[i].y, v.Cloakrooms[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
  17. end
  18. end
  19.  
  20. if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and PlayerData.job.grade_name == 'boss' then
  21.  
  22. for i=1, #v.BossActions, 1 do
  23. if not v.BossActions[i].disabled and GetDistanceBetweenCoords(coords, v.BossActions[i].x, v.BossActions[i].y, v.BossActions[i].z, true) < Config.DrawDistance then
  24. DrawMarker(22, v.BossActions[i].x, v.BossActions[i].y, v.BossActions[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
  25. end
  26. end
  27.  
  28. end
  29.  
  30. end
  31.  
  32. end
  33.  
  34. end
  35. end)
  36.  
  37. -- Enter / Exit marker events
  38. Citizen.CreateThread(function()
  39.  
  40. while true do
  41.  
  42. Wait(1000)
  43.  
  44. if PlayerData.job ~= nil and PlayerData.job.name == 'gang' then
  45.  
  46. local playerPed = GetPlayerPed(-1)
  47. local coords = GetEntityCoords(playerPed)
  48. local isInMarker = false
  49. local currentStation = nil
  50. local currentPart = nil
  51. local currentPartNum = nil
  52.  
  53. for k,v in pairs(Config.GangStations) do
  54.  
  55. for i=1, #v.Cloakrooms, 1 do
  56. if GetDistanceBetweenCoords(coords, v.Cloakrooms[i].x, v.Cloakrooms[i].y, v.Cloakrooms[i].z, true) < Config.MarkerSize.x then
  57. isInMarker = true
  58. currentStation = k
  59. currentPart = 'Cloakroom'
  60. currentPartNum = i
  61. end
  62. end
  63.  
  64. for i=1, #v.Armories, 1 do
  65. if GetDistanceBetweenCoords(coords, v.Armories[i].x, v.Armories[i].y, v.Armories[i].z, true) < Config.MarkerSize.x then
  66. isInMarker = true
  67. currentStation = k
  68. currentPart = 'Armory'
  69. currentPartNum = i
  70. end
  71. end
  72.  
  73. for i=1, #v.Vehicles, 1 do
  74.  
  75. if GetDistanceBetweenCoords(coords, v.Vehicles[i].Spawner.x, v.Vehicles[i].Spawner.y, v.Vehicles[i].Spawner.z, true) < Config.MarkerSize.x then
  76. isInMarker = true
  77. currentStation = k
  78. currentPart = 'VehicleSpawner'
  79. currentPartNum = i
  80. end
  81.  
  82. if GetDistanceBetweenCoords(coords, v.Vehicles[i].SpawnPoint.x, v.Vehicles[i].SpawnPoint.y, v.Vehicles[i].SpawnPoint.z, true) < Config.MarkerSize.x then
  83. isInMarker = true
  84. currentStation = k
  85. currentPart = 'VehicleSpawnPoint'
  86. currentPartNum = i
  87. end
  88.  
  89. end
  90.  
  91. for i=1, #v.Helicopters, 1 do
  92.  
  93. if GetDistanceBetweenCoords(coords, v.Helicopters[i].Spawner.x, v.Helicopters[i].Spawner.y, v.Helicopters[i].Spawner.z, true) < Config.MarkerSize.x then
  94. isInMarker = true
  95. currentStation = k
  96. currentPart = 'HelicopterSpawner'
  97. currentPartNum = i
  98. end
  99.  
  100. if GetDistanceBetweenCoords(coords, v.Helicopters[i].SpawnPoint.x, v.Helicopters[i].SpawnPoint.y, v.Helicopters[i].SpawnPoint.z, true) < Config.MarkerSize.x then
  101. isInMarker = true
  102. currentStation = k
  103. currentPart = 'HelicopterSpawnPoint'
  104. currentPartNum = i
  105. end
  106.  
  107. end
  108.  
  109. for i=1, #v.VehicleDeleters, 1 do
  110. if GetDistanceBetweenCoords(coords, v.VehicleDeleters[i].x, v.VehicleDeleters[i].y, v.VehicleDeleters[i].z, true) < Config.MarkerSize.x then
  111. isInMarker = true
  112. currentStation = k
  113. currentPart = 'VehicleDeleter'
  114. currentPartNum = i
  115. end
  116. end
  117.  
  118. if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and PlayerData.job.grade_name == 'boss' then
  119.  
  120. for i=1, #v.BossActions, 1 do
  121. if GetDistanceBetweenCoords(coords, v.BossActions[i].x, v.BossActions[i].y, v.BossActions[i].z, true) < Config.MarkerSize.x then
  122. isInMarker = true
  123. currentStation = k
  124. currentPart = 'BossActions'
  125. currentPartNum = i
  126. end
  127. end
  128.  
  129. end
  130.  
  131. end
  132.  
  133. local hasExited = false
  134.  
  135. if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastStation ~= currentStation or LastPart ~= currentPart or LastPartNum ~= currentPartNum) ) then
  136.  
  137. if
  138. (LastStation ~= nil and LastPart ~= nil and LastPartNum ~= nil) and
  139. (LastStation ~= currentStation or LastPart ~= currentPart or LastPartNum ~= currentPartNum)
  140. then
  141. TriggerEvent('esx_gangjob:hasExitedMarker', LastStation, LastPart, LastPartNum)
  142. hasExited = true
  143. end
  144.  
  145. HasAlreadyEnteredMarker = true
  146. LastStation = currentStation
  147. LastPart = currentPart
  148. LastPartNum = currentPartNum
  149.  
  150. TriggerEvent('esx_gangjob:hasEnteredMarker', currentStation, currentPart, currentPartNum)
  151. end
  152.  
  153. if not hasExited and not isInMarker and HasAlreadyEnteredMarker then
  154.  
  155. HasAlreadyEnteredMarker = false
  156.  
  157. TriggerEvent('esx_gangjob:hasExitedMarker', LastStation, LastPart, LastPartNum)
  158. end
  159.  
  160. end
  161.  
  162. end
  163. end)
  164.  
  165.  
  166. -- Key Controls
  167. Citizen.CreateThread(function()
  168. while true do
  169.  
  170. Citizen.Wait(1700)
  171.  
  172. if CurrentAction ~= nil then
  173.  
  174. SetTextComponentFormat('STRING')
  175. AddTextComponentString(CurrentActionMsg)
  176. DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  177.  
  178. if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and (GetGameTimer() - GUI.Time) > 150 then
  179.  
  180. if CurrentAction == 'menu_cloakroom' then
  181. OpenCloakroomMenu()
  182. end
  183.  
  184. if CurrentAction == 'menu_armory' then
  185. OpenArmoryMenu(CurrentActionData.station)
  186. end
  187.  
  188. if CurrentAction == 'menu_vehicle_spawner' then
  189. OpenVehicleSpawnerMenu(CurrentActionData.station, CurrentActionData.partNum)
  190. end
  191.  
  192. if CurrentAction == 'delete_vehicle' then
  193.  
  194. if Config.EnableSocietyOwnedVehicles then
  195.  
  196. local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle)
  197. --TriggerServerEvent('esx_society:putVehicleInGarage', 'gang', vehicleProps)
  198.  
  199. else
  200.  
  201. if
  202. GetEntityModel(vehicle) == GetHashKey('schafter5') or
  203. GetEntityModel(vehicle) == GetHashKey('Akuma') or
  204. GetEntityModel(vehicle) == GetHashKey('Granger') or
  205. GetEntityModel(vehicle) == GetHashKey('mule3')
  206. then
  207. TriggerServerEvent('esx_service:disableService', 'gang')
  208. end
  209.  
  210. end
  211.  
  212. ESX.Game.DeleteVehicle(CurrentActionData.vehicle)
  213. end
  214.  
  215. if CurrentAction == 'menu_boss_actions' then
  216.  
  217. ESX.UI.Menu.CloseAll()
  218.  
  219. TriggerEvent('esx_society:openBossMenu', 'gang', function(data, menu)
  220.  
  221. menu.close()
  222.  
  223. CurrentAction = 'menu_boss_actions'
  224. CurrentActionMsg = _U('open_bossmenu')
  225. CurrentActionData = {}
  226.  
  227. end)
  228.  
  229. end
  230.  
  231. if CurrentAction == 'remove_entity' then
  232. DeleteEntity(CurrentActionData.entity)
  233. end
  234.  
  235. CurrentAction = nil
  236. GUI.Time = GetGameTimer()
  237.  
  238. end
  239.  
  240. end
  241.  
  242. if IsControlPressed(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'gang_actions') and (GetGameTimer() - GUI.Time) > 150 and GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)),vector3(221.29,-798.61,34.47),true) >= 60 then
  243. OpenGangActionsMenu()
  244. GUI.Time = GetGameTimer()
  245. end
  246.  
  247. end
  248. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement