Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Display markers
- Citizen.CreateThread(function()
- while true do
- Wait(800)
- if PlayerData.job ~= nil and PlayerData.job.name == 'gang' then
- local playerPed = GetPlayerPed(-1)
- local coords = GetEntityCoords(playerPed)
- for k,v in pairs(Config.GangStations) do
- for i=1, #v.Cloakrooms, 1 do
- if GetDistanceBetweenCoords(coords, v.Cloakrooms[i].x, v.Cloakrooms[i].y, v.Cloakrooms[i].z, true) < Config.DrawDistance then
- 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)
- end
- end
- if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and PlayerData.job.grade_name == 'boss' then
- for i=1, #v.BossActions, 1 do
- 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
- 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)
- end
- end
- end
- end
- end
- end
- end)
- -- Enter / Exit marker events
- Citizen.CreateThread(function()
- while true do
- Wait(1000)
- if PlayerData.job ~= nil and PlayerData.job.name == 'gang' then
- local playerPed = GetPlayerPed(-1)
- local coords = GetEntityCoords(playerPed)
- local isInMarker = false
- local currentStation = nil
- local currentPart = nil
- local currentPartNum = nil
- for k,v in pairs(Config.GangStations) do
- for i=1, #v.Cloakrooms, 1 do
- if GetDistanceBetweenCoords(coords, v.Cloakrooms[i].x, v.Cloakrooms[i].y, v.Cloakrooms[i].z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'Cloakroom'
- currentPartNum = i
- end
- end
- for i=1, #v.Armories, 1 do
- if GetDistanceBetweenCoords(coords, v.Armories[i].x, v.Armories[i].y, v.Armories[i].z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'Armory'
- currentPartNum = i
- end
- end
- for i=1, #v.Vehicles, 1 do
- if GetDistanceBetweenCoords(coords, v.Vehicles[i].Spawner.x, v.Vehicles[i].Spawner.y, v.Vehicles[i].Spawner.z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'VehicleSpawner'
- currentPartNum = i
- end
- if GetDistanceBetweenCoords(coords, v.Vehicles[i].SpawnPoint.x, v.Vehicles[i].SpawnPoint.y, v.Vehicles[i].SpawnPoint.z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'VehicleSpawnPoint'
- currentPartNum = i
- end
- end
- for i=1, #v.Helicopters, 1 do
- if GetDistanceBetweenCoords(coords, v.Helicopters[i].Spawner.x, v.Helicopters[i].Spawner.y, v.Helicopters[i].Spawner.z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'HelicopterSpawner'
- currentPartNum = i
- end
- if GetDistanceBetweenCoords(coords, v.Helicopters[i].SpawnPoint.x, v.Helicopters[i].SpawnPoint.y, v.Helicopters[i].SpawnPoint.z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'HelicopterSpawnPoint'
- currentPartNum = i
- end
- end
- for i=1, #v.VehicleDeleters, 1 do
- if GetDistanceBetweenCoords(coords, v.VehicleDeleters[i].x, v.VehicleDeleters[i].y, v.VehicleDeleters[i].z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'VehicleDeleter'
- currentPartNum = i
- end
- end
- if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and PlayerData.job.grade_name == 'boss' then
- for i=1, #v.BossActions, 1 do
- if GetDistanceBetweenCoords(coords, v.BossActions[i].x, v.BossActions[i].y, v.BossActions[i].z, true) < Config.MarkerSize.x then
- isInMarker = true
- currentStation = k
- currentPart = 'BossActions'
- currentPartNum = i
- end
- end
- end
- end
- local hasExited = false
- if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastStation ~= currentStation or LastPart ~= currentPart or LastPartNum ~= currentPartNum) ) then
- if
- (LastStation ~= nil and LastPart ~= nil and LastPartNum ~= nil) and
- (LastStation ~= currentStation or LastPart ~= currentPart or LastPartNum ~= currentPartNum)
- then
- TriggerEvent('esx_gangjob:hasExitedMarker', LastStation, LastPart, LastPartNum)
- hasExited = true
- end
- HasAlreadyEnteredMarker = true
- LastStation = currentStation
- LastPart = currentPart
- LastPartNum = currentPartNum
- TriggerEvent('esx_gangjob:hasEnteredMarker', currentStation, currentPart, currentPartNum)
- end
- if not hasExited and not isInMarker and HasAlreadyEnteredMarker then
- HasAlreadyEnteredMarker = false
- TriggerEvent('esx_gangjob:hasExitedMarker', LastStation, LastPart, LastPartNum)
- end
- end
- end
- end)
- -- Key Controls
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(1700)
- if CurrentAction ~= nil then
- SetTextComponentFormat('STRING')
- AddTextComponentString(CurrentActionMsg)
- DisplayHelpTextFromStringLabel(0, 0, 1, -1)
- if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'gang' and (GetGameTimer() - GUI.Time) > 150 then
- if CurrentAction == 'menu_cloakroom' then
- OpenCloakroomMenu()
- end
- if CurrentAction == 'menu_armory' then
- OpenArmoryMenu(CurrentActionData.station)
- end
- if CurrentAction == 'menu_vehicle_spawner' then
- OpenVehicleSpawnerMenu(CurrentActionData.station, CurrentActionData.partNum)
- end
- if CurrentAction == 'delete_vehicle' then
- if Config.EnableSocietyOwnedVehicles then
- local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle)
- --TriggerServerEvent('esx_society:putVehicleInGarage', 'gang', vehicleProps)
- else
- if
- GetEntityModel(vehicle) == GetHashKey('schafter5') or
- GetEntityModel(vehicle) == GetHashKey('Akuma') or
- GetEntityModel(vehicle) == GetHashKey('Granger') or
- GetEntityModel(vehicle) == GetHashKey('mule3')
- then
- TriggerServerEvent('esx_service:disableService', 'gang')
- end
- end
- ESX.Game.DeleteVehicle(CurrentActionData.vehicle)
- end
- if CurrentAction == 'menu_boss_actions' then
- ESX.UI.Menu.CloseAll()
- TriggerEvent('esx_society:openBossMenu', 'gang', function(data, menu)
- menu.close()
- CurrentAction = 'menu_boss_actions'
- CurrentActionMsg = _U('open_bossmenu')
- CurrentActionData = {}
- end)
- end
- if CurrentAction == 'remove_entity' then
- DeleteEntity(CurrentActionData.entity)
- end
- CurrentAction = nil
- GUI.Time = GetGameTimer()
- end
- end
- 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
- OpenGangActionsMenu()
- GUI.Time = GetGameTimer()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement