mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
Refactors and fixes
refactor: Remove Citizen. (Wait And CreateThread)(All resources) feat: Add KeyMapping to taxijob and sit (Removes pointless Threads) fix: vector coords bug feat : Add txAdmin support into basicneeds (server.lua) Change: ESX Whitelist config from 0 minimum to 10 fix: Start Changing IsDead to ESX.GetPlayerData().dead fix: Add a sleep to Identity
This commit is contained in:
@@ -312,7 +312,7 @@ ESX.Game.GetPedMugshot = function(ped, transparent)
|
||||
end
|
||||
|
||||
while not IsPedheadshotReady(mugshot) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
return mugshot, GetPedheadshotTxdString(mugshot)
|
||||
@@ -327,7 +327,7 @@ ESX.Game.Teleport = function(entity, coords, cb)
|
||||
if DoesEntityExist(entity) then
|
||||
RequestCollisionAtCoord(vector.xyz)
|
||||
while not HasCollisionLoadedAroundEntity(entity) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
SetEntityCoords(entity, vector.xyz, false, false, false, false)
|
||||
@@ -344,7 +344,7 @@ ESX.Game.SpawnObject = function(object, coords, cb, networked)
|
||||
local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
|
||||
networked = networked == nil and true or networked
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
ESX.Streaming.RequestModel(model)
|
||||
|
||||
local obj = CreateObject(model, vector.xyz, networked, false, true)
|
||||
@@ -372,7 +372,7 @@ ESX.Game.SpawnVehicle = function(vehicle, coords, heading, cb, networked)
|
||||
local model = (type(vehicle) == 'number' and vehicle or GetHashKey(vehicle))
|
||||
local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
|
||||
networked = networked == nil and true or networked
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
ESX.Streaming.RequestModel(model)
|
||||
|
||||
local vehicle = CreateVehicle(model, vector.xyz, heading, networked, false)
|
||||
@@ -389,7 +389,7 @@ ESX.Game.SpawnVehicle = function(vehicle, coords, heading, cb, networked)
|
||||
|
||||
RequestCollisionAtCoord(vector.xyz)
|
||||
while not HasCollisionLoadedAroundEntity(vehicle) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
if cb then
|
||||
@@ -915,7 +915,7 @@ ESX.ShowInventory = function()
|
||||
if type == 'item_weapon' then
|
||||
menu1.close()
|
||||
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('esx:removeInventoryItem', type, item)
|
||||
else
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'inventory_item_count_remove', {
|
||||
@@ -927,7 +927,7 @@ ESX.ShowInventory = function()
|
||||
menu2.close()
|
||||
menu1.close()
|
||||
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('esx:removeInventoryItem', type, item, quantity)
|
||||
else
|
||||
ESX.ShowNotification(_U('amount_invalid'))
|
||||
@@ -1010,7 +1010,7 @@ AddEventHandler('esx:showHelpNotification', function(msg, thisFrame, beep, durat
|
||||
end)
|
||||
|
||||
-- SetTimeout
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local sleep = 100
|
||||
if #Core.TimeoutCallbacks > 0 then
|
||||
@@ -1023,6 +1023,6 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
end
|
||||
Citizen.Wait(sleep)
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local pickups = {}
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while not Config.Multichar do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
if NetworkIsPlayerActive(PlayerId()) then
|
||||
exports.spawnmanager:setAutoSpawn(false)
|
||||
DoScreenFadeOut(0)
|
||||
@@ -20,7 +20,7 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
|
||||
FreezeEntityPosition(PlayerPedId(), true)
|
||||
|
||||
if Config.Multichar then
|
||||
Citizen.Wait(3000)
|
||||
Wait(3000)
|
||||
else
|
||||
exports.spawnmanager:spawnPlayer({
|
||||
x = ESX.PlayerData.coords.x,
|
||||
@@ -47,7 +47,7 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
|
||||
end)
|
||||
end
|
||||
|
||||
while ESX.PlayerData.ped == nil do Citizen.Wait(20) end
|
||||
while ESX.PlayerData.ped == nil do Wait(20) end
|
||||
-- enable PVP
|
||||
if Config.EnablePVP then
|
||||
SetCanAttackFriendly(ESX.PlayerData.ped, true, false)
|
||||
@@ -99,7 +99,7 @@ end)
|
||||
|
||||
AddEventHandler('skinchanger:modelLoaded', function()
|
||||
while not ESX.PlayerLoaded do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
end
|
||||
TriggerEvent('esx:restoreLoadout')
|
||||
end)
|
||||
@@ -323,7 +323,7 @@ AddEventHandler('esx:deleteVehicle', function(radius)
|
||||
local attempt = 0
|
||||
|
||||
while not NetworkHasControlOfEntity(entity) and attempt < 100 and DoesEntityExist(entity) do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
NetworkRequestControlOfEntity(entity)
|
||||
attempt = attempt + 1
|
||||
end
|
||||
@@ -340,7 +340,7 @@ AddEventHandler('esx:deleteVehicle', function(radius)
|
||||
end
|
||||
|
||||
while not NetworkHasControlOfEntity(vehicle) and attempt < 100 and DoesEntityExist(vehicle) do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
NetworkRequestControlOfEntity(vehicle)
|
||||
attempt = attempt + 1
|
||||
end
|
||||
@@ -353,11 +353,11 @@ end)
|
||||
|
||||
-- Pause menu disables HUD display
|
||||
if Config.EnableHud then
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local isPaused = false
|
||||
local time = 500
|
||||
while true do
|
||||
Citizen.Wait(time)
|
||||
Wait(time)
|
||||
|
||||
if IsPauseMenuActive() and not isPaused then
|
||||
time = 100
|
||||
@@ -378,7 +378,7 @@ end
|
||||
|
||||
function StartServerSyncLoops()
|
||||
-- keep track of ammo
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local currentWeapon = {timer=0}
|
||||
while ESX.PlayerLoaded do
|
||||
local sleep = 5
|
||||
@@ -405,12 +405,12 @@ function StartServerSyncLoops()
|
||||
else
|
||||
sleep = 200
|
||||
end
|
||||
Citizen.Wait(sleep)
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- sync current player coords with server
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local previousCoords = vector3(ESX.PlayerData.coords.x, ESX.PlayerData.coords.y, ESX.PlayerData.coords.z)
|
||||
|
||||
while ESX.PlayerLoaded do
|
||||
@@ -428,7 +428,7 @@ function StartServerSyncLoops()
|
||||
TriggerServerEvent('esx:updateCoords', formattedCoords)
|
||||
end
|
||||
end
|
||||
Citizen.Wait(1500)
|
||||
Wait(1500)
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -449,9 +449,9 @@ if not Config.EnableWantedLevel then
|
||||
SetMaxWantedLevel(0)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerCoords, letSleep = GetEntityCoords(ESX.PlayerData.ped), true
|
||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
|
||||
|
||||
@@ -470,7 +470,7 @@ Citizen.CreateThread(function()
|
||||
local dict, anim = 'weapons@first_person@aim_rng@generic@projectile@sticky_bomb@', 'plant_floor'
|
||||
ESX.Streaming.RequestAnimDict(dict)
|
||||
TaskPlayAnim(ESX.PlayerData.ped, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
|
||||
TriggerServerEvent('esx:onPickup', pickupId)
|
||||
PlaySoundFrontend(-1, 'PICK_UP', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false)
|
||||
@@ -491,7 +491,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -517,7 +517,7 @@ AddEventHandler("esx:tpm", function()
|
||||
break
|
||||
end
|
||||
|
||||
Citizen.Wait(5)
|
||||
Wait(5)
|
||||
end
|
||||
TriggerEvent('chatMessage', "Successfully Teleported")
|
||||
else
|
||||
@@ -551,9 +551,9 @@ AddEventHandler("esx:noclip", function(input)
|
||||
end)
|
||||
|
||||
local heading = 0
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if(noclip)then
|
||||
SetEntityCoordsNoOffset(ESX.PlayerData.ped, noclip_pos.x, noclip_pos.y, noclip_pos.z, 0, 0, 0)
|
||||
@@ -592,7 +592,7 @@ end)
|
||||
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, -1.0)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(200)
|
||||
Wait(200)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local isDead = false
|
||||
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local letSleep = 0
|
||||
local player = PlayerId()
|
||||
|
||||
@@ -28,7 +28,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -7,7 +7,7 @@ ESX.Scaleform.ShowFreemodeMessage = function(title, msg, sec)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -38,7 +38,7 @@ ESX.Scaleform.ShowBreakingNews = function(title, msg, bottom, sec)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -61,7 +61,7 @@ ESX.Scaleform.ShowPopupWarning = function(title, msg, bottom, sec)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -78,7 +78,7 @@ ESX.Scaleform.ShowTrafficMovie = function(sec)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -91,7 +91,7 @@ ESX.Scaleform.Utils.RequestScaleformMovie = function(movie)
|
||||
local scaleform = RequestScaleformMovie(movie)
|
||||
|
||||
while not HasScaleformMovieLoaded(scaleform) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
return scaleform
|
||||
|
||||
@@ -5,7 +5,7 @@ function ESX.Streaming.RequestModel(modelHash, cb)
|
||||
RequestModel(modelHash)
|
||||
|
||||
while not HasModelLoaded(modelHash) do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ function ESX.Streaming.RequestStreamedTextureDict(textureDict, cb)
|
||||
RequestStreamedTextureDict(textureDict)
|
||||
|
||||
while not HasStreamedTextureDictLoaded(textureDict) do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ function ESX.Streaming.RequestNamedPtfxAsset(assetName, cb)
|
||||
RequestNamedPtfxAsset(assetName)
|
||||
|
||||
while not HasNamedPtfxAssetLoaded(assetName) do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ function ESX.Streaming.RequestAnimSet(animSet, cb)
|
||||
RequestAnimSet(animSet)
|
||||
|
||||
while not HasAnimSetLoaded(animSet) do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ function ESX.Streaming.RequestAnimDict(animDict, cb)
|
||||
RequestAnimDict(animDict)
|
||||
|
||||
while not HasAnimDictLoaded(animDict) do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ function ESX.Streaming.RequestWeaponAsset(weaponHash, cb)
|
||||
RequestWeaponAsset(weaponHash)
|
||||
|
||||
while not HasWeaponAssetLoaded(weaponHash) do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ exports('getSharedObject', function()
|
||||
end)
|
||||
|
||||
local function StartDBSync()
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10 * 60 * 1000)
|
||||
Wait(10 * 60 * 1000)
|
||||
Core.SavePlayers()
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -571,8 +571,8 @@ end)
|
||||
|
||||
AddEventHandler('txAdmin:events:scheduledRestart', function(eventData)
|
||||
if eventData.secondsRemaining == 60 then
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(50000)
|
||||
CreateThread(function()
|
||||
Wait(50000)
|
||||
Core.SavePlayers()
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
StartPayCheck = function()
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(Config.PaycheckInterval)
|
||||
Wait(Config.PaycheckInterval)
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
for _, xPlayer in pairs(xPlayers) do
|
||||
local job = xPlayer.job.grade_name
|
||||
|
||||
@@ -3,7 +3,7 @@ local loadingScreenFinished = false
|
||||
RegisterNetEvent('esx_identity:alreadyRegistered')
|
||||
AddEventHandler('esx_identity:alreadyRegistered', function()
|
||||
while not loadingScreenFinished do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
TriggerEvent('esx_skin:playerRegistered')
|
||||
@@ -14,22 +14,14 @@ AddEventHandler('esx:loadingScreenOff', function()
|
||||
end)
|
||||
|
||||
if not Config.UseDeferrals then
|
||||
local guiEnabled, isDead = false, false
|
||||
|
||||
AddEventHandler('esx:onPlayerDeath', function(data)
|
||||
isDead = true
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:onPlayerSpawn', function(spawn)
|
||||
isDead = false
|
||||
end)
|
||||
local guiEnabled = false
|
||||
|
||||
function EnableGui(state)
|
||||
SetNuiFocus(state, state)
|
||||
guiEnabled = state
|
||||
--[[ Citizen.CreateThread(function()
|
||||
--[[ CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(20000) -- UNCOMMENT THIS METHOD IF YOU ARE EXPERIENCING ISSUES WITH THE UI ON LOCALHOST | IF YOU STILL EXPERIENCE ISSUES AFTER REMOVING COMMENTS, INCREASE THE TIME.
|
||||
Wait(20000) -- UNCOMMENT THIS METHOD IF YOU ARE EXPERIENCING ISSUES WITH THE UI ON LOCALHOST | IF YOU STILL EXPERIENCE ISSUES AFTER REMOVING COMMENTS, INCREASE THE TIME.
|
||||
end
|
||||
end)
|
||||
]]--
|
||||
@@ -43,7 +35,7 @@ if not Config.UseDeferrals then
|
||||
AddEventHandler('esx_identity:showRegisterIdentity', function()
|
||||
TriggerEvent('esx_skin:resetFirstSpawn')
|
||||
|
||||
if not isDead then
|
||||
if not ESX.GetPlayerData().dead then
|
||||
EnableGui(true)
|
||||
end
|
||||
end)
|
||||
@@ -60,9 +52,9 @@ if not Config.UseDeferrals then
|
||||
end, data)
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(5)
|
||||
Wait(0)
|
||||
|
||||
if guiEnabled then
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
@@ -84,6 +76,8 @@ if not Config.UseDeferrals then
|
||||
DisableControlAction(0, 143, true) -- disable melee
|
||||
DisableControlAction(0, 75, true) -- disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- disable exit vehicle
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -6,7 +6,7 @@ if Config.UseDeferrals then
|
||||
AddEventHandler('playerConnecting', function(playerName, setKickReason, deferrals)
|
||||
deferrals.defer()
|
||||
local playerId, identifier = source, ESX.GetIdentifier(source)
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
|
||||
if identifier then
|
||||
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {identifier},
|
||||
@@ -88,7 +88,7 @@ if Config.UseDeferrals then
|
||||
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
|
||||
end
|
||||
|
||||
Citizen.Wait(5)
|
||||
Wait(5)
|
||||
alreadyRegistered[xPlayer.identifier] = true
|
||||
TriggerClientEvent('esx_identity:alreadyRegistered', xPlayer.source)
|
||||
|
||||
@@ -103,7 +103,7 @@ elseif not Config.UseDeferrals then
|
||||
AddEventHandler('playerConnecting', function(playerName, setKickReason, deferrals)
|
||||
deferrals.defer()
|
||||
local playerId, identifier = source, ESX.GetIdentifier(source)
|
||||
Citizen.Wait(40)
|
||||
Wait(40)
|
||||
|
||||
if identifier then
|
||||
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {identifier},
|
||||
@@ -139,10 +139,10 @@ elseif not Config.UseDeferrals then
|
||||
|
||||
AddEventHandler('onResourceStart', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
Citizen.Wait(300)
|
||||
Wait(300)
|
||||
|
||||
while not ESX do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
end
|
||||
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
@@ -170,7 +170,7 @@ elseif not Config.UseDeferrals then
|
||||
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
|
||||
end
|
||||
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
TriggerClientEvent('esx_identity:alreadyRegistered', xPlayer.source)
|
||||
|
||||
playerIdentity[xPlayer.identifier] = nil
|
||||
@@ -282,7 +282,7 @@ if Config.EnableCommands then
|
||||
if xPlayer and xPlayer.getName() then
|
||||
if Config.UseDeferrals then
|
||||
xPlayer.kick(_U('deleted_identity'))
|
||||
Citizen.Wait(1500)
|
||||
Wait(1500)
|
||||
deleteIdentity(xPlayer)
|
||||
xPlayer.showNotification(_U('deleted_character'))
|
||||
playerIdentity[xPlayer.identifier] = nil
|
||||
|
||||
@@ -57,9 +57,9 @@ RegisterNUICallback('menu_change', function(data, cb)
|
||||
cb('OK')
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(15)
|
||||
Wait(15)
|
||||
|
||||
if IsControlPressed(0, 18) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'ENTER'})
|
||||
|
||||
@@ -81,9 +81,9 @@ AddEventHandler('esx_menu_dialog:message:menu_change', function(data)
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
|
||||
if ESX.Table.SizeOf(OpenedMenus) > 0 then
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
@@ -96,7 +96,7 @@ Citizen.CreateThread(function()
|
||||
DisableControlAction(0, 16, true) -- SelectNextWeapon
|
||||
DisableControlAction(0, 17, true) -- SelectPrevWeapon
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -1,4 +1,4 @@
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local MenuType = 'list'
|
||||
local OpenedMenus = {}
|
||||
|
||||
|
||||
@@ -141,9 +141,9 @@ function DeleteSkinCam()
|
||||
cam = nil
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isCameraActive then
|
||||
DisableControlAction(2, 30, true)
|
||||
@@ -192,16 +192,16 @@ Citizen.CreateThread(function()
|
||||
|
||||
ESX.ShowHelpNotification(_U('use_rotate_view'))
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(700)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local angle = 90
|
||||
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isCameraActive then
|
||||
if IsControlPressed(0, 108) then
|
||||
@@ -218,7 +218,7 @@ Citizen.CreateThread(function()
|
||||
|
||||
heading = angle + 0.0
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -248,20 +248,20 @@ AddEventHandler('esx_skin:resetFirstSpawn', function()
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_skin:playerRegistered', function()
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while not ESX.PlayerLoaded do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
if firstSpawn then
|
||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||
if skin == nil then
|
||||
TriggerEvent('skinchanger:loadSkin', {sex = 0}, OpenSaveableMenu)
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
skinLoaded = true
|
||||
else
|
||||
TriggerEvent('skinchanger:loadSkin', skin)
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
skinLoaded = true
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -118,10 +118,10 @@ function LoadDefaultModel(malePed, cb)
|
||||
|
||||
RequestModel(characterModel)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while not HasModelLoaded(characterModel) do
|
||||
RequestModel(characterModel)
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
if IsModelInCdimage(characterModel) and IsModelValid(characterModel) then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local HasAlreadyEnteredMarker, isDead = false, false
|
||||
local HasAlreadyEnteredMarker = false
|
||||
local LastZone, CurrentAction, CurrentActionMsg
|
||||
local CurrentActionData = {}
|
||||
|
||||
@@ -120,9 +120,6 @@ function OpenShopMenu(accessory)
|
||||
end, restrict)
|
||||
end
|
||||
|
||||
AddEventHandler('esx:onPlayerSpawn', function() isDead = false end)
|
||||
AddEventHandler('esx:onPlayerDeath', function() isDead = true end)
|
||||
|
||||
AddEventHandler('esx_accessories:hasEnteredMarker', function(zone)
|
||||
CurrentAction = 'shop_menu'
|
||||
CurrentActionMsg = _U('press_access')
|
||||
@@ -135,9 +132,9 @@ AddEventHandler('esx_accessories:hasExitedMarker', function(zone)
|
||||
end)
|
||||
|
||||
-- Create Blips --
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Config.ShopsBlips) do
|
||||
if v.Pos ~= nil then
|
||||
if v.Pos then
|
||||
for i=1, #v.Pos, 1 do
|
||||
local blip = AddBlipForCoord(v.Pos[i])
|
||||
|
||||
@@ -157,7 +154,7 @@ end)
|
||||
|
||||
local nearMarker = false
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local sleep = 500
|
||||
local coords = GetEntityCoords(ESX.PlayerData.ped)
|
||||
@@ -171,11 +168,11 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
if sleep == 0 then nearMarker = true else nearMarker = false end
|
||||
Citizen.Wait(sleep)
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local sleep = 500
|
||||
if nearMarker then
|
||||
@@ -204,14 +201,14 @@ Citizen.CreateThread(function()
|
||||
TriggerEvent('esx_accessories:hasExitedMarker', LastZone)
|
||||
end
|
||||
end
|
||||
Citizen.Wait(sleep)
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -221,11 +218,11 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
elseif CurrentAction and not Config.EnableControls then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
|
||||
if Config.EnableControls then
|
||||
if IsControlJustReleased(0, 311) and IsInputDisabled(0) and not isDead then
|
||||
if IsControlJustReleased(0, 311) and IsInputDisabled(0) and not ESX.PlayerData.dead then
|
||||
OpenAccessoryMenu()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ function OpenMobileAmbulanceActionsMenu()
|
||||
isBusy = true
|
||||
ESX.ShowNotification(_U('heal_inprogress'))
|
||||
TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
|
||||
Citizen.Wait(10000)
|
||||
Wait(10000)
|
||||
ClearPedTasks(playerPed)
|
||||
|
||||
TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage')
|
||||
@@ -100,7 +100,7 @@ function OpenMobileAmbulanceActionsMenu()
|
||||
isBusy = true
|
||||
ESX.ShowNotification(_U('heal_inprogress'))
|
||||
TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
|
||||
Citizen.Wait(10000)
|
||||
Wait(10000)
|
||||
ClearPedTasks(playerPed)
|
||||
|
||||
TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit')
|
||||
@@ -142,7 +142,7 @@ function revivePlayer(closestPlayer)
|
||||
ESX.ShowNotification(_U('revive_inprogress'))
|
||||
|
||||
for i=1, 15 do
|
||||
Citizen.Wait(900)
|
||||
Wait(900)
|
||||
|
||||
ESX.Streaming.RequestAnimDict(lib, function()
|
||||
TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0.0, false, false, false)
|
||||
@@ -167,7 +167,7 @@ function FastTravel(coords, heading)
|
||||
DoScreenFadeOut(800)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
|
||||
ESX.Game.Teleport(playerPed, coords, function()
|
||||
@@ -180,9 +180,9 @@ function FastTravel(coords, heading)
|
||||
end
|
||||
|
||||
-- Draw markers & Marker logic
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' then
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
@@ -282,18 +282,18 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Fast travels
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerCoords, letSleep = GetEntityCoords(PlayerPedId()), true
|
||||
|
||||
for hospitalNum,hospital in pairs(Config.Hospitals) do
|
||||
@@ -313,7 +313,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -353,9 +353,9 @@ AddEventHandler('esx_ambulancejob:hasExitedMarker', function(hospital, part, par
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -376,12 +376,12 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
|
||||
elseif ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' and not isDead then
|
||||
elseif ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' and not ESX.PlayerData.dead then
|
||||
if IsControlJustReleased(0, 167) then
|
||||
OpenMobileAmbulanceActionsMenu()
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -28,12 +28,12 @@ AddEventHandler('esx:onPlayerSpawn', function()
|
||||
|
||||
if Config.SaveDeathStatus then
|
||||
while not ESX.PlayerLoaded do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
|
||||
if shouldDie then
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
SetEntityHealth(PlayerPedId(), 0)
|
||||
end
|
||||
end)
|
||||
@@ -42,7 +42,7 @@ AddEventHandler('esx:onPlayerSpawn', function()
|
||||
end)
|
||||
|
||||
-- Create blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Config.Hospitals) do
|
||||
local blip = AddBlipForCoord(v.Blip.coords)
|
||||
|
||||
@@ -58,9 +58,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Disable most inputs when dead
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isDead then
|
||||
DisableAllControlActions(0)
|
||||
@@ -68,21 +68,21 @@ Citizen.CreateThread(function()
|
||||
EnableControlAction(0, 245, true)
|
||||
EnableControlAction(0, 38, true)
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
if isDead and isSearched then
|
||||
local playerPed = PlayerPedId()
|
||||
local ped = GetPlayerPed(GetPlayerFromServerId(medic))
|
||||
isSearched = false
|
||||
|
||||
AttachEntityToEntity(playerPed, ped, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
DetachEntity(playerPed, true, false)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
end
|
||||
@@ -130,9 +130,9 @@ AddEventHandler('esx_ambulancejob:useItem', function(itemName)
|
||||
ESX.Streaming.RequestAnimDict(lib, function()
|
||||
TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
|
||||
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
while IsEntityPlayingAnim(playerPed, lib, anim, 3) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
DisableAllControlActions(0)
|
||||
end
|
||||
|
||||
@@ -147,9 +147,9 @@ AddEventHandler('esx_ambulancejob:useItem', function(itemName)
|
||||
ESX.Streaming.RequestAnimDict(lib, function()
|
||||
TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
|
||||
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
while IsEntityPlayingAnim(playerPed, lib, anim, 3) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
DisableAllControlActions(0)
|
||||
end
|
||||
|
||||
@@ -160,11 +160,11 @@ AddEventHandler('esx_ambulancejob:useItem', function(itemName)
|
||||
end)
|
||||
|
||||
function StartDistressSignal()
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local timer = Config.BleedoutTimer
|
||||
|
||||
while timer > 0 and isDead do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
timer = timer - 30
|
||||
|
||||
SetTextFont(4)
|
||||
@@ -229,10 +229,10 @@ function StartDeathTimer()
|
||||
local earlySpawnTimer = ESX.Math.Round(Config.EarlyRespawnTimer / 1000)
|
||||
local bleedoutTimer = ESX.Math.Round(Config.BleedoutTimer / 1000)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- early respawn timer
|
||||
while earlySpawnTimer > 0 and isDead do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
|
||||
if earlySpawnTimer > 0 then
|
||||
earlySpawnTimer = earlySpawnTimer - 1
|
||||
@@ -241,7 +241,7 @@ function StartDeathTimer()
|
||||
|
||||
-- bleedout timer
|
||||
while bleedoutTimer > 0 and isDead do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
|
||||
if bleedoutTimer > 0 then
|
||||
bleedoutTimer = bleedoutTimer - 1
|
||||
@@ -249,12 +249,12 @@ function StartDeathTimer()
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local text, timeHeld
|
||||
|
||||
-- early respawn timer
|
||||
while earlySpawnTimer > 0 and isDead do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
text = _U('respawn_available_in', secondsToClock(earlySpawnTimer))
|
||||
|
||||
DrawGenericTextThisFrame()
|
||||
@@ -266,7 +266,7 @@ function StartDeathTimer()
|
||||
|
||||
-- bleedout timer
|
||||
while bleedoutTimer > 0 and isDead do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer))
|
||||
|
||||
if not Config.EarlyRespawnFine then
|
||||
@@ -308,11 +308,11 @@ end
|
||||
function RemoveItemsAfterRPDeath()
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
DoScreenFadeOut(800)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function()
|
||||
@@ -366,7 +366,7 @@ AddEventHandler('esx_ambulancejob:revive', function()
|
||||
DoScreenFadeOut(800)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(50)
|
||||
Wait(50)
|
||||
end
|
||||
|
||||
local formattedCoords = {
|
||||
|
||||
@@ -134,16 +134,16 @@ function StoreNearbyVehicle(playerCoords)
|
||||
ESX.Game.DeleteVehicle(vehicleId)
|
||||
isBusy = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while isBusy do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
drawLoadingText(_U('garage_storing'), 255, 255, 255, 255)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Workaround for vehicle not deleting when other players are near it.
|
||||
while DoesEntityExist(vehicleId) do
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
attempts = attempts + 1
|
||||
|
||||
-- Give up
|
||||
@@ -273,15 +273,15 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)
|
||||
end)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isInShopMenu then
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -305,7 +305,7 @@ function WaitForVehicleToLoad(modelHash)
|
||||
EndTextCommandBusyspinnerOn(4)
|
||||
|
||||
while not HasModelLoaded(modelHash) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
DisableAllControlActions(0)
|
||||
end
|
||||
|
||||
|
||||
@@ -129,8 +129,8 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(
|
||||
end
|
||||
|
||||
-- give back wepaons after a couple of seconds
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(5000)
|
||||
CreateThread(function()
|
||||
Wait(5000)
|
||||
for i=1, #playerLoadout, 1 do
|
||||
if playerLoadout[i].label ~= nil then
|
||||
xPlayer.addWeapon(playerLoadout[i].name, playerLoadout[i].ammo)
|
||||
@@ -269,7 +269,7 @@ ESX.RegisterUsableItem('medikit', function(source)
|
||||
playersHealing[source] = true
|
||||
TriggerClientEvent('esx_ambulancejob:useItem', source, 'medikit')
|
||||
|
||||
Citizen.Wait(10000)
|
||||
Wait(10000)
|
||||
playersHealing[source] = nil
|
||||
end
|
||||
end)
|
||||
@@ -282,7 +282,7 @@ ESX.RegisterUsableItem('bandage', function(source)
|
||||
playersHealing[source] = true
|
||||
TriggerClientEvent('esx_ambulancejob:useItem', source, 'bandage')
|
||||
|
||||
Citizen.Wait(10000)
|
||||
Wait(10000)
|
||||
playersHealing[source] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
local isDead = false
|
||||
local inAnim = false
|
||||
|
||||
AddEventHandler('esx:onPlayerDeath', function(data) isDead = true end)
|
||||
|
||||
AddEventHandler('esx:onPlayerSpawn', function(spawn) isDead = false end)
|
||||
|
||||
function startAttitude(lib, anim)
|
||||
ESX.Streaming.RequestAnimSet(lib, function()
|
||||
SetPedMovementClipset(PlayerPedId(), anim, true)
|
||||
@@ -82,17 +77,17 @@ function OpenAnimationsSubMenu(menu)
|
||||
end
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
|
||||
if IsControlJustReleased(0, 170) and IsInputDisabled(0) and not isDead then
|
||||
OpenAnimationsMenu()
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, 73) and IsInputDisabled(0) and not isDead then
|
||||
ClearPedTasks(PlayerPedId())
|
||||
end
|
||||
|
||||
RegisterCommand('animmenu', function()
|
||||
if not ESX.GetPlayerData().dead then
|
||||
OpenAnimationsMenu()
|
||||
end
|
||||
end)
|
||||
end, false)
|
||||
|
||||
RegisterCommand('cleartasks', function()
|
||||
if not ESX.GetPlayerData().dead then
|
||||
ClearPedTasks(PlayerPedId())
|
||||
end
|
||||
end, false)
|
||||
|
||||
RegisterKeyMapping('animmenu', 'Open Animations Menu', 'keyboard', 'f3')
|
||||
RegisterKeyMapping('cleartasks', 'Stop Anmimation', 'keyboard', 'z')
|
||||
|
||||
@@ -26,7 +26,7 @@ RegisterNUICallback('withdraw', function(data, cb)
|
||||
end)
|
||||
|
||||
-- Create blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
if not Config.EnableBlips then return end
|
||||
|
||||
for _, ATMLocation in pairs(Config.ATMLocations) do
|
||||
@@ -43,9 +43,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Activate menu when player is inside marker
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local canSleep = true
|
||||
isInATMMarker = false
|
||||
@@ -76,15 +76,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if canSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Menu interactions
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isInATMMarker and not menuIsShowed then
|
||||
|
||||
@@ -106,7 +106,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
else
|
||||
Citizen.Wait(700)
|
||||
Wait(700)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -145,7 +145,7 @@ AddEventHandler('esx_bankerjob:hasExitedMarker', function (zone)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blip = AddBlipForCoord(Config.Zones.BankActions.Coords)
|
||||
|
||||
SetBlipSprite(blip, 108)
|
||||
@@ -158,9 +158,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Draw marker & activate menu when player is inside marker
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'banker' then
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
@@ -190,18 +190,18 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -214,7 +214,7 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -93,7 +93,7 @@ AddEventHandler('esx_barbershop:hasExitedMarker', function(zone)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in ipairs(Config.Shops) do
|
||||
local blip = AddBlipForCoord(v)
|
||||
|
||||
@@ -108,9 +108,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events and draw marker
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerCoords, isInMarker, currentZone, letSleep = GetEntityCoords(PlayerPedId()), nil, nil, true
|
||||
|
||||
for k,v in ipairs(Config.Shops) do
|
||||
@@ -137,15 +137,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if currentAction then
|
||||
ESX.ShowHelpNotification(currentActionMsg)
|
||||
@@ -158,7 +158,7 @@ Citizen.CreateThread(function()
|
||||
currentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -6,6 +6,7 @@ AddEventHandler('esx_basicneeds:resetStatus', function()
|
||||
TriggerEvent('esx_status:set', 'thirst', 500000)
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('esx_basicneeds:healPlayer')
|
||||
AddEventHandler('esx_basicneeds:healPlayer', function()
|
||||
-- restore hunger & thirst
|
||||
@@ -79,7 +80,7 @@ AddEventHandler('esx_basicneeds:onEat', function(prop_name)
|
||||
prop_name = prop_name or 'prop_cs_burger_01'
|
||||
IsAnimated = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local playerPed = PlayerPedId()
|
||||
local x,y,z = table.unpack(GetEntityCoords(playerPed))
|
||||
local prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
|
||||
@@ -89,7 +90,7 @@ AddEventHandler('esx_basicneeds:onEat', function(prop_name)
|
||||
ESX.Streaming.RequestAnimDict('mp_player_inteat@burger', function()
|
||||
TaskPlayAnim(playerPed, 'mp_player_inteat@burger', 'mp_player_int_eat_burger_fp', 8.0, -8, -1, 49, 0, 0, 0, 0)
|
||||
|
||||
Citizen.Wait(3000)
|
||||
Wait(3000)
|
||||
IsAnimated = false
|
||||
ClearPedSecondaryTask(playerPed)
|
||||
DeleteObject(prop)
|
||||
@@ -105,7 +106,7 @@ AddEventHandler('esx_basicneeds:onDrink', function(prop_name)
|
||||
prop_name = prop_name or 'prop_ld_flow_bottle'
|
||||
IsAnimated = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local playerPed = PlayerPedId()
|
||||
local x,y,z = table.unpack(GetEntityCoords(playerPed))
|
||||
local prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
|
||||
@@ -115,7 +116,7 @@ AddEventHandler('esx_basicneeds:onDrink', function(prop_name)
|
||||
ESX.Streaming.RequestAnimDict('mp_player_intdrink', function()
|
||||
TaskPlayAnim(playerPed, 'mp_player_intdrink', 'loop_bottle', 1.0, -1.0, 2000, 0, 1, true, true, true)
|
||||
|
||||
Citizen.Wait(3000)
|
||||
Wait(3000)
|
||||
IsAnimated = false
|
||||
ClearPedSecondaryTask(playerPed)
|
||||
DeleteObject(prop)
|
||||
|
||||
@@ -22,3 +22,11 @@ ESX.RegisterCommand('heal', 'admin', function(xPlayer, args, showError)
|
||||
end, true, {help = 'Heal a player, or yourself - restores thirst, hunger and health.', validate = true, arguments = {
|
||||
{name = 'playerId', help = 'the player id', type = 'player'}
|
||||
}})
|
||||
|
||||
AddEventHandler('txAdmin:events:healedPlayer', function(eventData)
|
||||
if GetInvokingResource() ~= "monitor" or type(eventData) ~= "table" or type(eventData.id) ~= "number" then
|
||||
return
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx_basicneeds:healPlayer', eventData.id)
|
||||
end)
|
||||
@@ -197,15 +197,15 @@ function StoreBoatInGarage(vehicle, teleportCoords)
|
||||
end
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isInShopMenu then
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -6,9 +6,9 @@ CurrentActionMsg = ''
|
||||
CurrentActionData = {}
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -36,7 +36,7 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -75,9 +75,9 @@ AddEventHandler('esx_boat:hasExitedMarker', function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
@@ -149,13 +149,13 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blipList = {}
|
||||
|
||||
for i=1, #Config.Zones.Garages, 1 do
|
||||
|
||||
@@ -118,7 +118,7 @@ AddEventHandler('esx_clotheshop:hasExitedMarker', function(zone)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in ipairs(Config.Shops) do
|
||||
local blip = AddBlipForCoord(v)
|
||||
|
||||
@@ -133,9 +133,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events & draw markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
local playerCoords, isInMarker, currentZone, letSleep = GetEntityCoords(PlayerPedId()), false, nil, true
|
||||
|
||||
for k,v in pairs(Config.Shops) do
|
||||
@@ -162,15 +162,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if currentAction then
|
||||
ESX.ShowHelpNotification(currentActionMsg)
|
||||
@@ -183,7 +183,7 @@ Citizen.CreateThread(function()
|
||||
currentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local Player = nil
|
||||
local CruisedSpeed, CruisedSpeedKm, VehicleVectorY = 0, 0, 0
|
||||
|
||||
Citizen.CreateThread(function ()
|
||||
CreateThread(function ()
|
||||
while true do
|
||||
Wait(0)
|
||||
if IsControlJustPressed(1, 246) and IsDriver() then
|
||||
@@ -19,7 +19,7 @@ function TriggerCruiseControl ()
|
||||
|
||||
ESX.ShowNotification(_U('activated') .. ': ~b~ ' .. CruisedSpeedKm .. ' km/h')
|
||||
|
||||
Citizen.CreateThread(function ()
|
||||
CreateThread(function ()
|
||||
while CruisedSpeed > 0 and IsInVehicle() == Player do
|
||||
Wait(0)
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ AddEventHandler('esx_dmvschool:loadLicenses', function(licenses)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blip = AddBlipForCoord(Config.Zones.DMVSchool.Pos.x, Config.Zones.DMVSchool.Pos.y, Config.Zones.DMVSchool.Pos.z)
|
||||
|
||||
SetBlipSprite (blip, 408)
|
||||
@@ -214,14 +214,14 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
for k,v in pairs(Config.Zones) do
|
||||
local Pos = Vector3(v.Pos.x, v.Pos.y, v.Pos.z)
|
||||
local Pos = vector3(v.Pos.x, v.Pos.y, v.Pos.z)
|
||||
if(v.Type ~= -1 and #(coords - Pos) < Config.DrawDistance) then
|
||||
DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
|
||||
end
|
||||
@@ -230,17 +230,17 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker = false
|
||||
local currentZone = nil
|
||||
|
||||
for k,v in pairs(Config.Zones) do
|
||||
local Pos = Vector3(v.Pos.x, v.Pos.y, v.Pos.z)
|
||||
local Pos = vector3(v.Pos.x, v.Pos.y, v.Pos.z)
|
||||
if(#(coords - Pos) < v.Size.x) then
|
||||
isInMarker = true
|
||||
currentZone = k
|
||||
@@ -261,9 +261,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Block UI
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
|
||||
if CurrentTest == 'theory' then
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -274,15 +274,15 @@ Citizen.CreateThread(function()
|
||||
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
|
||||
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -295,16 +295,16 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Drive test
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentTest == 'drive' then
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -352,15 +352,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
else
|
||||
-- not currently taking driver test
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Speed / Damage control
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
|
||||
if CurrentTest == 'drive' then
|
||||
|
||||
@@ -400,12 +400,12 @@ Citizen.CreateThread(function()
|
||||
|
||||
-- avoid stacking faults
|
||||
LastVehicleHealth = health
|
||||
Citizen.Wait(1500)
|
||||
Wait(1500)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- not currently taking driver test
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -60,11 +60,11 @@ Config.CheckPoints = {
|
||||
{
|
||||
Pos = {x = 234.907, y = -1345.385, z = 29.542},
|
||||
Action = function(playerPed, vehicle, setCurrentZoneType)
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
DrawMissionText(_U('stop_for_ped'), 5000)
|
||||
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
Citizen.Wait(4000)
|
||||
Wait(4000)
|
||||
|
||||
FreezeEntityPosition(vehicle, false)
|
||||
DrawMissionText(_U('good_lets_cont'), 5000)
|
||||
@@ -77,11 +77,11 @@ Config.CheckPoints = {
|
||||
Action = function(playerPed, vehicle, setCurrentZoneType)
|
||||
setCurrentZoneType('town')
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
DrawMissionText(_U('stop_look_left', Config.SpeedLimits['town']), 5000)
|
||||
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
Citizen.Wait(6000)
|
||||
Wait(6000)
|
||||
|
||||
FreezeEntityPosition(vehicle, false)
|
||||
DrawMissionText(_U('good_turn_right'), 5000)
|
||||
@@ -109,7 +109,7 @@ Config.CheckPoints = {
|
||||
DrawMissionText(_U('stop_for_passing'), 5000)
|
||||
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
Citizen.Wait(6000)
|
||||
Wait(6000)
|
||||
FreezeEntityPosition(vehicle, false)
|
||||
end
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local menuOpen = false
|
||||
local wasOpen = false
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local time = 800
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -16,7 +16,7 @@ Citizen.CreateThread(function()
|
||||
OpenDrugShop()
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
if wasOpen then
|
||||
@@ -24,7 +24,7 @@ Citizen.CreateThread(function()
|
||||
ESX.UI.Menu.CloseAll()
|
||||
end
|
||||
|
||||
Citizen.Wait(time)
|
||||
Wait(time)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -135,7 +135,7 @@ function CreateBlipCircle(coords, text, radius, color, sprite)
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,zone in pairs(Config.CircleZones) do
|
||||
CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite)
|
||||
end
|
||||
|
||||
@@ -2,9 +2,9 @@ local spawnedWeeds = 0
|
||||
local weedPlants = {}
|
||||
local isPickingUp, isProcessing = false, false
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(700)
|
||||
Wait(700)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
if #(coords - Config.CircleZones.WeedField.coords) < 50 then
|
||||
@@ -13,13 +13,14 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local wait = 1000
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if #(coords - Config.CircleZones.WeedProcessing.coords) < 1 then
|
||||
wait = 2
|
||||
if not isProcessing then
|
||||
ESX.ShowHelpNotification(_U('weed_processprompt'))
|
||||
end
|
||||
@@ -40,10 +41,8 @@ Citizen.CreateThread(function()
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
wait = 2
|
||||
end
|
||||
Citizen.Wait(wait)
|
||||
Wait(wait)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -58,7 +57,7 @@ function ProcessWeed(xCannabis)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
while timeLeft > 0 do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
timeLeft = timeLeft - 1
|
||||
|
||||
if #(GetEntityCoords(playerPed) - Config.CircleZones.WeedProcessing.coords) > 4 then
|
||||
@@ -72,9 +71,9 @@ function ProcessWeed(xCannabis)
|
||||
isProcessing = false
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
@@ -98,9 +97,9 @@ Citizen.CreateThread(function()
|
||||
if canPickUp then
|
||||
TaskStartScenarioInPlace(playerPed, 'world_human_gardener_plant', 0, false)
|
||||
|
||||
Citizen.Wait(2000)
|
||||
Wait(2000)
|
||||
ClearPedTasks(playerPed)
|
||||
Citizen.Wait(1500)
|
||||
Wait(1500)
|
||||
|
||||
ESX.Game.DeleteObject(nearbyObject)
|
||||
|
||||
@@ -116,7 +115,7 @@ Citizen.CreateThread(function()
|
||||
end, 'cannabis')
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -131,7 +130,7 @@ end)
|
||||
|
||||
function SpawnWeedPlants()
|
||||
while spawnedWeeds < 25 do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local weedCoords = GenerateWeedCoords()
|
||||
|
||||
ESX.Game.SpawnLocalObject('prop_weed_02', weedCoords, function(obj)
|
||||
@@ -166,14 +165,14 @@ end
|
||||
|
||||
function GenerateWeedCoords()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
|
||||
local weedCoordX, weedCoordY
|
||||
|
||||
math.randomseed(GetGameTimer())
|
||||
local modX = math.random(-90, 90)
|
||||
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
|
||||
math.randomseed(GetGameTimer())
|
||||
local modY = math.random(-90, 90)
|
||||
|
||||
@@ -258,7 +258,7 @@ AddEventHandler('esx_property:hasExitedMarker', function(name, part, parking)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
|
||||
for k,v in pairs(Config.Garages) do
|
||||
|
||||
@@ -284,7 +284,7 @@ end)
|
||||
|
||||
local nearMarker = false
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local sleep = 500
|
||||
|
||||
@@ -327,12 +327,12 @@ Citizen.CreateThread(function()
|
||||
|
||||
end
|
||||
if sleep == 0 then nearMarker = true else nearMarker = false end
|
||||
Citizen.Wait(sleep)
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
if nearMarker then
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -390,7 +390,7 @@ Citizen.CreateThread(function()
|
||||
|
||||
TriggerEvent('esx_property:hasExitedMarker', LastGarage, LastPart, LastParking)
|
||||
end
|
||||
Citizen.Wait(1)
|
||||
else Citizen.Wait(500) end
|
||||
Wait(1)
|
||||
else Wait(500) end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -50,23 +50,23 @@ end)
|
||||
RegisterNetEvent('esx_holdup:startTimer')
|
||||
AddEventHandler('esx_holdup:startTimer', function()
|
||||
local timer = Stores[store].secondsRemaining
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while timer > 0 and holdingUp do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
if timer > 0 then
|
||||
timer = timer - 1
|
||||
end
|
||||
end
|
||||
end)
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while holdingUp do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
DrawTxt(0.66, 1.44, 1.0, 1.0, 0.4, _U('robbery_timer', timer), 255, 255, 255, 255)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Stores) do
|
||||
local blip = AddBlipForCoord(v.position)
|
||||
SetBlipSprite(blip, 156)
|
||||
@@ -78,9 +78,9 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
local playerPos, letSleep = GetEntityCoords(PlayerPedId()), true
|
||||
for k,v in pairs(Stores) do
|
||||
local distance = #(playerPos - v.position)
|
||||
@@ -109,7 +109,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -31,9 +31,9 @@ AddEventHandler('esx_joblisting:hasExitedMarker', function(zone)
|
||||
end)
|
||||
|
||||
-- Activate menu when player is inside marker, and draw markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
isInMarker = false
|
||||
@@ -63,7 +63,7 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Create blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for i=1, #Config.Zones, 1 do
|
||||
local blip = AddBlipForCoord(Config.Zones[i])
|
||||
|
||||
@@ -80,9 +80,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Menu Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if IsControlJustReleased(0, 38) and isInMarker and not menuIsShowed then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
@@ -300,22 +300,22 @@ AddEventHandler('esx_jobs:spawnJobVehicle', function(spawnPoint, vehicle)
|
||||
end)
|
||||
|
||||
-- Show top left hint
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
|
||||
if hintIsShowed then
|
||||
ESX.ShowHelpNotification(hintToDisplay)
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Display markers (only if on duty and the player's job ones)
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
local zones = {}
|
||||
|
||||
if ESX.PlayerData.job ~= nil then
|
||||
@@ -348,9 +348,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Display public markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
for k,v in pairs(Config.PublicZones) do
|
||||
if(v.Marker ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then
|
||||
@@ -361,9 +361,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Activate public marker
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local position = nil
|
||||
local zone = nil
|
||||
@@ -398,10 +398,10 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Activate menu when player is inside marker
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
|
||||
if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name ~= 'unemployed' then
|
||||
local zones = nil
|
||||
@@ -512,7 +512,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- Slaughterer
|
||||
RemoveIpl("CS1_02_cf_offmission")
|
||||
RequestIpl("CS1_02_cf_onmission1")
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
local playersWorking = {}
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
local timeNow = os.clock()
|
||||
|
||||
for playerId,data in pairs(playersWorking) do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
-- is player still online?
|
||||
|
||||
@@ -361,7 +361,7 @@ function GetAction(data)
|
||||
end
|
||||
|
||||
-- Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Config.Zones) do
|
||||
local blip = AddBlipForCoord(v.Pos.x, v.Pos.y, v.Pos.z)
|
||||
|
||||
@@ -376,9 +376,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Activate menu when player is inside marker
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsPedInAnyVehicle(playerPed, false) then
|
||||
@@ -424,9 +424,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Prevent Free Tunning Bug
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if lsMenuIsShowed then
|
||||
DisableControlAction(2, 288, true)
|
||||
@@ -438,7 +438,7 @@ Citizen.CreateThread(function()
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -301,8 +301,8 @@ function OpenMobileMechanicActionsMenu()
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
CreateThread(function()
|
||||
Wait(10000)
|
||||
|
||||
SetVehicleDoorsLocked(vehicle, 1)
|
||||
SetVehicleDoorsLockedForAllPlayers(vehicle, false)
|
||||
@@ -327,8 +327,8 @@ function OpenMobileMechanicActionsMenu()
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(20000)
|
||||
CreateThread(function()
|
||||
Wait(20000)
|
||||
|
||||
SetVehicleFixed(vehicle)
|
||||
SetVehicleDeformationFixed(vehicle)
|
||||
@@ -355,8 +355,8 @@ function OpenMobileMechanicActionsMenu()
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_MAID_CLEAN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
CreateThread(function()
|
||||
Wait(10000)
|
||||
|
||||
SetVehicleDirtLevel(vehicle, 0)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
@@ -524,7 +524,7 @@ function OpenGetStocksMenu()
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_mechanicjob:getStockItem', itemName, count)
|
||||
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
OpenGetStocksMenu()
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -571,7 +571,7 @@ function OpenPutStocksMenu()
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_mechanicjob:putStockItems', itemName, count)
|
||||
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
OpenPutStocksMenu()
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -608,8 +608,8 @@ AddEventHandler('esx_mechanicjob:onHijack', function()
|
||||
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
CreateThread(function()
|
||||
Wait(10000)
|
||||
if chance <= 66 then
|
||||
SetVehicleDoorsLocked(vehicle, 1)
|
||||
SetVehicleDoorsLockedForAllPlayers(vehicle, false)
|
||||
@@ -640,8 +640,8 @@ AddEventHandler('esx_mechanicjob:onCarokit', function()
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_HAMMERING', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
CreateThread(function()
|
||||
Wait(10000)
|
||||
SetVehicleFixed(vehicle)
|
||||
SetVehicleDeformationFixed(vehicle)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
@@ -667,8 +667,8 @@ AddEventHandler('esx_mechanicjob:onFixkit', function()
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(20000)
|
||||
CreateThread(function()
|
||||
Wait(20000)
|
||||
SetVehicleFixed(vehicle)
|
||||
SetVehicleDeformationFixed(vehicle)
|
||||
SetVehicleUndriveable(vehicle, false)
|
||||
@@ -765,9 +765,9 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts)
|
||||
end)
|
||||
|
||||
-- Pop NPC mission vehicle when inside area
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
|
||||
if NPCTargetTowableZone and not NPCHasSpawnedTowable then
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
@@ -797,7 +797,7 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blip = AddBlipForCoord(Config.Zones.MechanicActions.Pos.x, Config.Zones.MechanicActions.Pos.y, Config.Zones.MechanicActions.Pos.z)
|
||||
|
||||
SetBlipSprite (blip, 446)
|
||||
@@ -812,9 +812,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
local coords, letSleep = GetEntityCoords(PlayerPedId()), true
|
||||
@@ -827,18 +827,18 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
Wait(10)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
|
||||
@@ -868,14 +868,14 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local trackedEntities = {
|
||||
'prop_roadcone02a',
|
||||
'prop_toolchest_01'
|
||||
}
|
||||
|
||||
while true do
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
@@ -912,9 +912,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
@@ -3,7 +3,7 @@ local DrunkLevel = -1
|
||||
|
||||
function Drunk(level, start)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
@@ -17,7 +17,7 @@ function Drunk(level, start)
|
||||
RequestAnimSet("move_m@drunk@slightlydrunk")
|
||||
|
||||
while not HasAnimSetLoaded("move_m@drunk@slightlydrunk") do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
SetPedMovementClipset(playerPed, "move_m@drunk@slightlydrunk", true)
|
||||
@@ -27,7 +27,7 @@ function Drunk(level, start)
|
||||
RequestAnimSet("move_m@drunk@moderatedrunk")
|
||||
|
||||
while not HasAnimSetLoaded("move_m@drunk@moderatedrunk") do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
SetPedMovementClipset(playerPed, "move_m@drunk@moderatedrunk", true)
|
||||
@@ -37,7 +37,7 @@ function Drunk(level, start)
|
||||
RequestAnimSet("move_m@drunk@verydrunk")
|
||||
|
||||
while not HasAnimSetLoaded("move_m@drunk@verydrunk") do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
SetPedMovementClipset(playerPed, "move_m@drunk@verydrunk", true)
|
||||
@@ -58,7 +58,7 @@ end
|
||||
|
||||
function Reality()
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
@@ -92,7 +92,7 @@ AddEventHandler('esx_status:loaded', function(status)
|
||||
end
|
||||
)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
|
||||
while true do
|
||||
|
||||
@@ -151,7 +151,7 @@ AddEventHandler('esx_optionalneeds:onDrink', function()
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_DRINKING", 0, 1)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
end)
|
||||
@@ -215,9 +215,9 @@ RegisterNUICallback('escape', function()
|
||||
ESX.UI.Menu.Close('phone', GetCurrentResourceName(), 'main')
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if GUI.PhoneIsShowed then -- codes here: https://pastebin.com/guYd0ht4
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
@@ -260,9 +260,9 @@ AddEventHandler('onResourceStop', function(resource)
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -276,7 +276,7 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -73,7 +73,7 @@ function GenerateUniquePhoneNumber()
|
||||
local foundNumber, phoneNumber = false, nil
|
||||
|
||||
while not foundNumber do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
|
||||
math.randomseed(GetGameTimer())
|
||||
phoneNumber = math.random(10000, 99999)
|
||||
|
||||
@@ -164,7 +164,7 @@ function OpenCloakroomMenu()
|
||||
end, 'police')
|
||||
|
||||
while awaitService == nil do
|
||||
Citizen.Wait(5)
|
||||
Wait(5)
|
||||
end
|
||||
|
||||
-- if we couldn't enter service don't let the player get changed
|
||||
@@ -336,7 +336,7 @@ function OpenPoliceActionsMenu()
|
||||
elseif action == 'hijack_vehicle' then
|
||||
if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 3.0) then
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true)
|
||||
Citizen.Wait(20000)
|
||||
Wait(20000)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
SetVehicleDoorsLocked(vehicle, 1)
|
||||
@@ -356,13 +356,13 @@ function OpenPoliceActionsMenu()
|
||||
currentTask.task = ESX.SetTimeout(10000, function()
|
||||
ClearPedTasks(playerPed)
|
||||
ImpoundVehicle(vehicle)
|
||||
Citizen.Wait(100) -- sleep the entire script to let stuff sink back to reality
|
||||
Wait(100) -- sleep the entire script to let stuff sink back to reality
|
||||
end)
|
||||
|
||||
-- keep track of that vehicle!
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while currentTask.busy do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
|
||||
vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 3.0, 0, 71)
|
||||
if not DoesEntityExist(vehicle) and currentTask.busy then
|
||||
@@ -867,7 +867,7 @@ function OpenGetStocksMenu()
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_policejob:getStockItem', itemName, count)
|
||||
|
||||
Citizen.Wait(300)
|
||||
Wait(300)
|
||||
OpenGetStocksMenu()
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -914,7 +914,7 @@ function OpenPutStocksMenu()
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_policejob:putStockItems', itemName, count)
|
||||
|
||||
Citizen.Wait(300)
|
||||
Wait(300)
|
||||
OpenPutStocksMenu()
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -930,7 +930,7 @@ RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
if job.name == 'police' then
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('esx_policejob:forceBlip')
|
||||
end
|
||||
end)
|
||||
@@ -1025,7 +1025,7 @@ AddEventHandler('esx_policejob:handcuff', function()
|
||||
if isHandcuffed then
|
||||
RequestAnimDict('mp_arresting')
|
||||
while not HasAnimDictLoaded('mp_arresting') do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
TaskPlayAnim(playerPed, 'mp_arresting', 'idle', 8.0, -8, -1, 49, 0, 0, 0, 0)
|
||||
@@ -1086,11 +1086,11 @@ AddEventHandler('esx_policejob:drag', function(copId)
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local wasDragged
|
||||
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if isHandcuffed and dragStatus.isDragged then
|
||||
@@ -1101,7 +1101,7 @@ Citizen.CreateThread(function()
|
||||
AttachEntityToEntity(playerPed, targetPed, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
|
||||
wasDragged = true
|
||||
else
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
end
|
||||
else
|
||||
wasDragged = false
|
||||
@@ -1112,7 +1112,7 @@ Citizen.CreateThread(function()
|
||||
wasDragged = false
|
||||
DetachEntity(playerPed, true, false)
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -1152,9 +1152,9 @@ AddEventHandler('esx_policejob:OutVehicle', function()
|
||||
end)
|
||||
|
||||
-- Handcuff
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if isHandcuffed then
|
||||
@@ -1207,13 +1207,13 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Create blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Config.PoliceStations) do
|
||||
local blip = AddBlipForCoord(v.Blip.Coords)
|
||||
|
||||
@@ -1230,9 +1230,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Draw markers and more
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'police' then
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -1332,16 +1332,16 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Enter / Exit entity zone events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local trackedEntities = {
|
||||
'prop_roadcone02a',
|
||||
'prop_barrier_work05',
|
||||
@@ -1351,7 +1351,7 @@ Citizen.CreateThread(function()
|
||||
}
|
||||
|
||||
while true do
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local playerCoords = GetEntityCoords(playerPed)
|
||||
@@ -1388,9 +1388,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
@@ -143,16 +143,16 @@ function StoreNearbyVehicle(playerCoords)
|
||||
ESX.Game.DeleteVehicle(vehicleId)
|
||||
local isBusy = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while isBusy do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
drawLoadingText(_U('garage_storing'), 255, 255, 255, 255)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Workaround for vehicle not deleting when other players are near it.
|
||||
while DoesEntityExist(vehicleId) do
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
attempts = attempts + 1
|
||||
|
||||
-- Give up
|
||||
@@ -281,15 +281,15 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)
|
||||
end)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if isInShopMenu then
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -313,7 +313,7 @@ function WaitForVehicleToLoad(modelHash)
|
||||
EndTextCommandBusyspinnerOn(4)
|
||||
|
||||
while not HasModelLoaded(modelHash) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
DisableAllControlActions(0)
|
||||
end
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ AddEventHandler('playerDropped', function()
|
||||
if playerId then
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
if xPlayer and xPlayer.job.name == 'police' then
|
||||
Citizen.Wait(5000)
|
||||
Wait(5000)
|
||||
TriggerClientEvent('esx_policejob:updateBlip', -1)
|
||||
end
|
||||
end
|
||||
@@ -433,7 +433,7 @@ RegisterNetEvent('esx_policejob:spawned')
|
||||
AddEventHandler('esx_policejob:spawned', function()
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
if xPlayer and xPlayer.job.name == 'police' then
|
||||
Citizen.Wait(5000)
|
||||
Wait(5000)
|
||||
TriggerClientEvent('esx_policejob:updateBlip', -1)
|
||||
end
|
||||
end)
|
||||
@@ -447,7 +447,7 @@ end)
|
||||
|
||||
AddEventHandler('onResourceStart', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
Citizen.Wait(5000)
|
||||
Wait(5000)
|
||||
for _, xPlayer in pairs(ESX.GetExtendedPlayers('job', 'police')) do
|
||||
TriggerClientEvent('esx_policejob:updateBlip', xPlayer.source)
|
||||
end
|
||||
|
||||
@@ -103,18 +103,18 @@ function EnterProperty(name, owner)
|
||||
|
||||
TriggerServerEvent('esx_property:saveLastProperty', name)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
DoScreenFadeOut(800)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
for i=1, #property.ipls, 1 do
|
||||
RequestIpl(property.ipls[i])
|
||||
|
||||
while not IsIplActive(property.ipls[i]) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,11 +139,11 @@ function ExitProperty(name)
|
||||
|
||||
TriggerServerEvent('esx_property:deleteLastProperty')
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
DoScreenFadeOut(800)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
SetEntityCoords(playerPed, outside.x, outside.y, outside.z)
|
||||
@@ -663,9 +663,9 @@ end)
|
||||
|
||||
AddEventHandler('esx:onPlayerSpawn', function()
|
||||
if firstSpawn then
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while not ESX.IsPlayerLoaded() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_property:getLastProperty', function(propertyName)
|
||||
@@ -677,7 +677,7 @@ AddEventHandler('esx:onPlayerSpawn', function()
|
||||
RequestIpl(property.ipls[i])
|
||||
|
||||
while not IsIplActive(property.ipls[i]) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -771,9 +771,9 @@ AddEventHandler('esx_property:hasExitedMarker', function(name, part)
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events & Draw markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker, letSleep = false, true
|
||||
@@ -851,15 +851,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -882,7 +882,7 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -58,7 +58,7 @@ function RemoveOwnedProperty(name, owner, noPay)
|
||||
end
|
||||
|
||||
MySQL.ready(function()
|
||||
Citizen.Wait(1500)
|
||||
Wait(1500)
|
||||
|
||||
MySQL.query('SELECT * FROM `properties`', {}, function(properties)
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ AddEventHandler('esx_realestateagentjob:hasExitedMarker', function(zone)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blip = AddBlipForCoord(Config.Zones.OfficeEnter.Pos.x, Config.Zones.OfficeEnter.Pos.y, Config.Zones.OfficeEnter.Pos.z)
|
||||
|
||||
SetBlipSprite (blip, 357)
|
||||
@@ -223,9 +223,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
@@ -238,9 +238,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker = false
|
||||
@@ -267,9 +267,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -282,13 +282,13 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Load IPLS
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
RequestIpl('ex_dt1_02_office_02c')
|
||||
end)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ AddEventHandler('esx_rpchat:sendProximityMessage', function(playerId, title, mes
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
TriggerEvent('chat:addSuggestion', '/twt', _U('twt_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
|
||||
TriggerEvent('chat:addSuggestion', '/anontwt', _U('twtanon_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
|
||||
TriggerEvent('chat:addSuggestion', '/me', _U('me_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
|
||||
|
||||
@@ -63,7 +63,7 @@ AddEventHandler('esx_shops:hasExitedMarker', function(zone)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Config.Zones) do
|
||||
for i = 1, #v.Pos, 1 do
|
||||
if v.ShowBlip then
|
||||
@@ -83,9 +83,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker, letSleep, currentZone = false, false
|
||||
|
||||
@@ -119,15 +119,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if currentAction then
|
||||
ESX.ShowHelpNotification(currentActionMsg)
|
||||
@@ -140,7 +140,7 @@ Citizen.CreateThread(function()
|
||||
currentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -3,9 +3,9 @@ local disableControls = false
|
||||
local currentObj = nil
|
||||
|
||||
if Config.Debug then
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
for i=1, #debugProps, 1 do
|
||||
local coords = GetEntityCoords(debugProps[i])
|
||||
@@ -32,50 +32,50 @@ if Config.Debug then
|
||||
end
|
||||
|
||||
if #debugProps == 0 then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
local wait = 1000
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if sitting and not IsPedUsingScenario(playerPed, currentScenario) then
|
||||
wakeup()
|
||||
end
|
||||
|
||||
-- Disable controls
|
||||
if disableControls then
|
||||
DisableControlAction(1, 37, true) -- Disables INPUT_SELECT_WEAPON (TAB)
|
||||
Wait(wait)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterCommand('sit', function()
|
||||
if sitting then
|
||||
wakeup()
|
||||
else
|
||||
local object, distance = GetNearChair()
|
||||
|
||||
if Config.Debug then
|
||||
table.insert(debugProps, object)
|
||||
end
|
||||
|
||||
if IsControlJustPressed(0, 38) and IsControlPressed(0, 21) and IsInputDisabled(0) and IsPedOnFoot(playerPed) then
|
||||
if sitting then
|
||||
wakeup()
|
||||
else
|
||||
local object, distance = GetNearChair()
|
||||
if distance and distance < 1.4 then
|
||||
local hash = GetEntityModel(object)
|
||||
|
||||
if Config.Debug then
|
||||
table.insert(debugProps, object)
|
||||
end
|
||||
|
||||
if distance and distance < 1.4 then
|
||||
local hash = GetEntityModel(object)
|
||||
|
||||
for k,v in pairs(Config.Sitable) do
|
||||
if GetHashKey(k) == hash then
|
||||
sit(object, k, v)
|
||||
break
|
||||
end
|
||||
end
|
||||
for k,v in pairs(Config.Sitable) do
|
||||
if GetHashKey(k) == hash then
|
||||
sit(object, k, v)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end, false)
|
||||
|
||||
|
||||
RegisterKeyMapping('sit', 'Sit', 'keyboard', 'e')
|
||||
|
||||
function GetNearChair()
|
||||
local object, distance
|
||||
@@ -135,7 +135,7 @@ function sit(object, modelName, data)
|
||||
currentScenario = data.scenario
|
||||
TaskStartScenarioAtPosition(playerPed, currentScenario, pos.x, pos.y, pos.z + (playerPos.z - pos.z)/2, GetEntityHeading(object) + 180.0, 0, true, false)
|
||||
|
||||
Citizen.Wait(2500)
|
||||
Wait(2500)
|
||||
if GetEntitySpeed(PlayerPedId()) > 0 then
|
||||
ClearPedTasks(PlayerPedId())
|
||||
TaskStartScenarioAtPosition(playerPed, currentScenario, pos.x, pos.y, pos.z + (playerPos.z - pos.z)/2, GetEntityHeading(object) + 180.0, 0, true, true)
|
||||
|
||||
@@ -324,11 +324,11 @@ ESX.RegisterServerCallback('esx_society:getOnlinePlayers', function(source, cb)
|
||||
end
|
||||
cb(onlinePlayers)
|
||||
getOnlinePlayers = false
|
||||
Citizen.Wait(1000) -- For the next second any extra requests will receive the cached list
|
||||
Wait(1000) -- For the next second any extra requests will receive the cached list
|
||||
onlinePlayers = {}
|
||||
return
|
||||
end
|
||||
while getOnlinePlayers do Citizen.Wait(10) end -- Wait for the xPlayer loop to finish
|
||||
while getOnlinePlayers do Wait(10) end -- Wait for the xPlayer loop to finish
|
||||
cb(onlinePlayers)
|
||||
end)
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ AddEventHandler('esx_status:load', function(status)
|
||||
|
||||
if Config.Display then TriggerEvent('esx_status:setDisplay', 0.5) end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local data = {}
|
||||
while ESX.PlayerLoaded do
|
||||
for i=1, #Status do
|
||||
@@ -90,7 +90,7 @@ AddEventHandler('esx_status:load', function(status)
|
||||
|
||||
TriggerEvent('esx_status:onTick', data)
|
||||
table.wipe(data)
|
||||
Citizen.Wait(Config.TickTime)
|
||||
Wait(Config.TickTime)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
@@ -161,9 +161,9 @@ end)
|
||||
|
||||
-- Pause menu disable hud display
|
||||
if Config.Display then
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(300)
|
||||
Wait(300)
|
||||
|
||||
if IsPauseMenuActive() and not isPaused then
|
||||
isPaused = true
|
||||
@@ -184,9 +184,9 @@ AddEventHandler('esx:loadingScreenOff', function()
|
||||
end)
|
||||
|
||||
-- Update server
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(Config.UpdateInterval)
|
||||
Wait(Config.UpdateInterval)
|
||||
if ESX.PlayerLoaded then TriggerServerEvent('esx_status:update', GetStatusData(true)) end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -50,9 +50,9 @@ AddEventHandler('esx_status:update', function(status)
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10 * 60 * 1000)
|
||||
Wait(10 * 60 * 1000)
|
||||
local parameters = {}
|
||||
for _, xPlayer in pairs(ESX.GetExtendedPlayers()) do
|
||||
local status = ESX.Players[xPlayer.source]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local HasAlreadyEnteredMarker, OnJob, IsNearCustomer, CustomerIsEnteringVehicle, CustomerEnteredVehicle, IsDead, CurrentActionData = false, false, false, false, false, false, {}
|
||||
local HasAlreadyEnteredMarker, OnJob, IsNearCustomer, CustomerIsEnteringVehicle, CustomerEnteredVehicle, CurrentActionData = false, false, false, false, false, {}
|
||||
local CurrentCustomer, CurrentCustomerBlip, DestinationBlip, targetCoords, LastZone, CurrentAction, CurrentActionMsg
|
||||
|
||||
function DrawSub(msg, time)
|
||||
@@ -9,13 +9,13 @@ function DrawSub(msg, time)
|
||||
end
|
||||
|
||||
function ShowLoadingPromt(msg, time, type)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(0)
|
||||
CreateThread(function()
|
||||
Wait(0)
|
||||
|
||||
BeginTextCommandBusyspinnerOn('STRING')
|
||||
AddTextComponentSubstringPlayerName(msg)
|
||||
EndTextCommandBusyspinnerOn(type)
|
||||
Citizen.Wait(time)
|
||||
Wait(time)
|
||||
|
||||
BusyspinnerOff()
|
||||
end)
|
||||
@@ -363,7 +363,7 @@ function OpenGetStocksMenu()
|
||||
|
||||
-- todo: refresh on callback
|
||||
TriggerServerEvent('esx_taxijob:getStockItem', itemName, count)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
OpenGetStocksMenu()
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -411,7 +411,7 @@ function OpenPutStocksMenu()
|
||||
|
||||
-- todo: refresh on callback
|
||||
TriggerServerEvent('esx_taxijob:putStockItems', itemName, count)
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
OpenPutStocksMenu()
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -476,7 +476,7 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blip = AddBlipForCoord(Config.Zones.TaxiActions.Pos.x, Config.Zones.TaxiActions.Pos.y, Config.Zones.TaxiActions.Pos.z)
|
||||
|
||||
SetBlipSprite (blip, 198)
|
||||
@@ -491,9 +491,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events, and draw markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
@@ -523,19 +523,19 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Taxi Job
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if OnJob then
|
||||
@@ -546,7 +546,7 @@ Citizen.CreateThread(function()
|
||||
local waitUntil = GetGameTimer() + GetRandomIntInRange(30000, 45000)
|
||||
|
||||
while OnJob and waitUntil > GetGameTimer() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
if OnJob and IsPedInAnyVehicle(playerPed, false) and GetEntitySpeed(playerPed) > 0 then
|
||||
@@ -628,7 +628,7 @@ Citizen.CreateThread(function()
|
||||
targetCoords = Config.JobLocations[GetRandomIntInRange(1, #Config.JobLocations)]
|
||||
local distance = #(playerCoords - targetCoords)
|
||||
while distance < Config.MinimumDistance do
|
||||
Citizen.Wait(5)
|
||||
Wait(5)
|
||||
|
||||
targetCoords = Config.JobLocations[GetRandomIntInRange(1, #Config.JobLocations)]
|
||||
distance = #(playerCoords - targetCoords)
|
||||
@@ -693,14 +693,14 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while onJob do
|
||||
Citizen.Wait(10000)
|
||||
Wait(10000)
|
||||
if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.grade < 3 then
|
||||
if not IsInAuthorizedVehicle() then
|
||||
ClearCurrentMission()
|
||||
@@ -712,11 +712,11 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction and not IsDead then
|
||||
if CurrentAction and not ESX.GetPlayerData().dead then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
@@ -733,17 +733,12 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, 167) and IsInputDisabled(0) and not IsDead and Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
OpenMobileTaxiActionsMenu()
|
||||
end
|
||||
end
|
||||
end)
|
||||
RegisterCommand('taximenu', function()
|
||||
if not ESX.GetPlayerData().dead and Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
OpenMobileTaxiActionsMenu()
|
||||
end
|
||||
end, false)
|
||||
|
||||
AddEventHandler('esx:onPlayerDeath', function()
|
||||
IsDead = true
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:onPlayerSpawn', function(spawn)
|
||||
IsDead = false
|
||||
end)
|
||||
RegisterKeyMapping('taximenu', 'Open Taxi Menu', 'keyboard', 'f6')
|
||||
|
||||
@@ -66,7 +66,7 @@ function DeleteDisplayVehicleInsideShop()
|
||||
|
||||
if currentDisplayVehicle and DoesEntityExist(currentDisplayVehicle) then
|
||||
while DoesEntityExist(currentDisplayVehicle) and not NetworkHasControlOfEntity(currentDisplayVehicle) and attempt < 100 do
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
NetworkRequestControlOfEntity(currentDisplayVehicle)
|
||||
attempt = attempt + 1
|
||||
end
|
||||
@@ -98,7 +98,7 @@ function ReturnVehicleProvider()
|
||||
}, function(data, menu)
|
||||
TriggerServerEvent('esx_vehicleshop:returnProvider', data.current.value)
|
||||
|
||||
Citizen.Wait(300)
|
||||
Wait(300)
|
||||
menu.close()
|
||||
ReturnVehicleProvider()
|
||||
end, function(data, menu)
|
||||
@@ -108,9 +108,9 @@ function ReturnVehicleProvider()
|
||||
end
|
||||
|
||||
function StartShopRestriction()
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while IsInShopMenu do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
@@ -300,7 +300,7 @@ function WaitForVehicleToLoad(modelHash)
|
||||
EndTextCommandBusyspinnerOn(4)
|
||||
|
||||
while not HasModelLoaded(modelHash) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
DisableAllControlActions(0)
|
||||
end
|
||||
|
||||
@@ -740,7 +740,7 @@ if Config.EnablePlayerManagement then
|
||||
end
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local blip = AddBlipForCoord(Config.Zones.ShopEntering.Pos)
|
||||
|
||||
SetBlipSprite (blip, 326)
|
||||
@@ -754,9 +754,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events & Draw Markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(4)
|
||||
Wait(4)
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker, letSleep, currentZone = false, true
|
||||
|
||||
@@ -788,15 +788,15 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(5)
|
||||
Wait(5)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
@@ -841,12 +841,12 @@ Citizen.CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
RequestIpl('shr_int') -- Load walls and floor
|
||||
|
||||
local interiorID = 7170
|
||||
|
||||
@@ -11,7 +11,7 @@ function GeneratePlate()
|
||||
local doBreak = false
|
||||
|
||||
while true do
|
||||
Citizen.Wait(2)
|
||||
Wait(2)
|
||||
math.randomseed(GetGameTimer())
|
||||
if Config.PlateUseSpace then
|
||||
generatedPlate = string.upper(GetRandomLetter(Config.PlateLetters) .. ' ' .. GetRandomNumber(Config.PlateNumbers))
|
||||
@@ -42,14 +42,14 @@ function IsPlateTaken(plate)
|
||||
end, plate)
|
||||
|
||||
while type(callback) == 'string' do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
return callback
|
||||
end
|
||||
|
||||
function GetRandomNumber(length)
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
if length > 0 then
|
||||
return GetRandomNumber(length - 1) .. NumberCharset[math.random(1, #NumberCharset)]
|
||||
else
|
||||
@@ -58,7 +58,7 @@ function GetRandomNumber(length)
|
||||
end
|
||||
|
||||
function GetRandomLetter(length)
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
if length > 0 then
|
||||
return GetRandomLetter(length - 1) .. Charset[math.random(1, #Charset)]
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@ local categories, vehicles = {}, {}
|
||||
TriggerEvent('esx_phone:registerNumber', 'cardealer', _U('dealer_customers'), false, false)
|
||||
TriggerEvent('esx_society:registerSociety', 'cardealer', _U('car_dealer'), 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'})
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
local char = Config.PlateLetters
|
||||
char = char + Config.PlateNumbers
|
||||
if Config.PlateUseSpace then char = char + 1 end
|
||||
|
||||
@@ -41,9 +41,9 @@ AddEventHandler('esx:onPlayerSpawn', function()
|
||||
NetworkSetTalkerProximity(voice.default)
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Wait(1)
|
||||
|
||||
if IsControlJustPressed(1, Keys['H']) and IsControlPressed(1, Keys['LEFTSHIFT']) then
|
||||
voice.current = (voice.current + 1) % 3
|
||||
|
||||
@@ -100,9 +100,9 @@ function DisplayBoughtScaleform(weaponName, price)
|
||||
|
||||
PlaySoundFrontend(-1, 'WEAPON_PURCHASE', 'HUD_AMMO_SHOP_SOUNDSET', false)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while sec > 0 do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -132,7 +132,7 @@ AddEventHandler('onResourceStop', function(resource)
|
||||
end)
|
||||
|
||||
-- Create Blips
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
for k,v in pairs(Config.Zones) do
|
||||
if v.Legal then
|
||||
for i = 1, #v.Locations, 1 do
|
||||
@@ -153,9 +153,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
@@ -170,9 +170,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker, currentZone = false, nil
|
||||
|
||||
@@ -196,9 +196,9 @@ Citizen.CreateThread(function()
|
||||
end)
|
||||
|
||||
-- Key Controls
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction ~= nil then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Config = {}
|
||||
|
||||
Config.Locale = 'en'
|
||||
Config.MinPlayer = 0 --Set how many players need to be connect before whitelist start, 0-32
|
||||
Config.MinPlayer = 10 --Set how many players need to be connect before whitelist start, 0-32
|
||||
|
||||
@@ -30,7 +30,7 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
deferrals.update(_U('whitelist_check'))
|
||||
|
||||
-- Needed, not sure why.
|
||||
Citizen.Wait(100)
|
||||
Wait(100)
|
||||
|
||||
local identifier = ESX.GetIdentifier(playerId)
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ end
|
||||
function EnterInstance(instance)
|
||||
insideInstance = true
|
||||
-- Fix vehicles randomly spawning nearby the player inside an instance
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while insideInstance do
|
||||
Citizen.Wait(0) -- must be run every frame
|
||||
Wait(0) -- must be run every frame
|
||||
|
||||
SetVehicleDensityMultiplierThisFrame(0.0)
|
||||
SetParkedVehicleDensityMultiplierThisFrame(0.0)
|
||||
@@ -139,9 +139,9 @@ AddEventHandler('instance:onInvite', function(_instance, type, data)
|
||||
host = _instance,
|
||||
data = data
|
||||
}
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while instanceInvite do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
|
||||
ESX.ShowHelpNotification(_U('press_to_enter'))
|
||||
|
||||
@@ -153,9 +153,9 @@ AddEventHandler('instance:onInvite', function(_instance, type, data)
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- Controls for invite
|
||||
Citizen.Wait(10000)
|
||||
Wait(10000)
|
||||
|
||||
if instanceInvite then
|
||||
ESX.ShowNotification(_U('invite_expired'))
|
||||
@@ -168,9 +168,9 @@ end)
|
||||
RegisterInstanceType('default')
|
||||
|
||||
-- Instance players
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
playersToHide = {}
|
||||
|
||||
if instance.host then
|
||||
@@ -193,9 +193,9 @@ end)
|
||||
|
||||
local letSleep = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
local playerPed = PlayerPedId()
|
||||
letSleep = true
|
||||
|
||||
@@ -212,12 +212,12 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Citizen.Wait(1000)
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
TriggerEvent('instance:loaded')
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(3000)
|
||||
CreateThread(function()
|
||||
Wait(3000)
|
||||
print('^1Do not run this resource in a live environment, it is solely intended for showcasing ESX functions^0')
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user