mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
Merge branch 'esx-framework:main' into main
This commit is contained in:
@@ -389,36 +389,32 @@ end
|
||||
|
||||
function StartServerSyncLoops()
|
||||
if not Config.OxInventory then
|
||||
-- keep track of ammo
|
||||
CreateThread(function()
|
||||
local currentWeapon = {timer=0}
|
||||
while ESX.PlayerLoaded do
|
||||
local sleep = 500
|
||||
-- keep track of ammo
|
||||
|
||||
if currentWeapon.timer == sleep then
|
||||
local ammoCount = GetAmmoInPedWeapon(ESX.PlayerData.ped, currentWeapon.hash)
|
||||
TriggerServerEvent('esx:updateWeaponAmmo', currentWeapon.name, ammoCount)
|
||||
currentWeapon.timer = 0
|
||||
elseif currentWeapon.timer > sleep then
|
||||
currentWeapon.timer = currentWeapon.timer - sleep
|
||||
end
|
||||
|
||||
if IsPedArmed(ESX.PlayerData.ped, 4) then
|
||||
sleep = 0
|
||||
if IsPedShooting(ESX.PlayerData.ped) then
|
||||
local _,weaponHash = GetCurrentPedWeapon(ESX.PlayerData.ped, true)
|
||||
local weapon = ESX.GetWeaponFromHash(weaponHash)
|
||||
|
||||
if weapon then
|
||||
currentWeapon.name = weapon.name
|
||||
currentWeapon.hash = weaponHash
|
||||
currentWeapon.timer = 100 * sleep
|
||||
end
|
||||
CreateThread(function()
|
||||
local currentWeapon = {Ammo = 0}
|
||||
while ESX.PlayerLoaded do
|
||||
local sleep = 250
|
||||
if IsPedArmed(ESX.PlayerData.ped, 4) or IsPedArmed(ESX.PlayerData.ped, 2) then
|
||||
sleep = 0
|
||||
local _,weaponHash = GetCurrentPedWeapon(ESX.PlayerData.ped, true)
|
||||
local weapon = ESX.GetWeaponFromHash(weaponHash)
|
||||
if weapon then
|
||||
local ammoCount = GetAmmoInPedWeapon(ESX.PlayerData.ped, weaponHash)
|
||||
if weapon.name ~= currentWeapon.name then
|
||||
currentWeapon.Ammo = ammoCount
|
||||
currentWeapon.name = weapon.name
|
||||
else
|
||||
if ammoCount ~= currentWeapon.Ammo then
|
||||
currentWeapon.Ammo = ammoCount
|
||||
TriggerServerEvent('esx:updateWeaponAmmo', weapon.name, ammoCount)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Wait(sleep)
|
||||
end
|
||||
end
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
-- sync current player coords with server
|
||||
|
||||
@@ -6,41 +6,20 @@ description 'ESX Ambulance Job'
|
||||
|
||||
version '1.6.5'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
shared_scripts {
|
||||
'@es_extended/imports.lua'
|
||||
'@es_extended/locale.lua',
|
||||
'locales/*.lua',
|
||||
'config.lua'
|
||||
}
|
||||
|
||||
|
||||
server_scripts {
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'@es_extended/locale.lua',
|
||||
'locales/br.lua',
|
||||
'locales/en.lua',
|
||||
'locales/fi.lua',
|
||||
'locales/fr.lua',
|
||||
'locales/es.lua',
|
||||
'locales/sv.lua',
|
||||
'locales/pl.lua',
|
||||
'locales/de.lua',
|
||||
'locales/cs.lua',
|
||||
'locales/nl.lua',
|
||||
'locales/tr.lua',
|
||||
'locales/hu.lua',
|
||||
'config.lua',
|
||||
'server/main.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/locale.lua',
|
||||
'locales/br.lua',
|
||||
'locales/en.lua',
|
||||
'locales/fi.lua',
|
||||
'locales/fr.lua',
|
||||
'locales/es.lua',
|
||||
'locales/sv.lua',
|
||||
'locales/pl.lua',
|
||||
'locales/cs.lua',
|
||||
'locales/nl.lua',
|
||||
'locales/tr.lua',
|
||||
'locales/hu.lua',
|
||||
'config.lua',
|
||||
'client/main.lua',
|
||||
'client/job.lua',
|
||||
'client/vehicle.lua',
|
||||
|
||||
Reference in New Issue
Block a user