mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Tab indent update
This commit is contained in:
+245
-297
@@ -19,40 +19,36 @@ local isDead = false
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
ESX.PlayerLoaded = true
|
||||
ESX.PlayerData = xPlayer
|
||||
|
||||
ESX.PlayerLoaded = true
|
||||
ESX.PlayerData = xPlayer
|
||||
for i=1, #xPlayer.accounts, 1 do
|
||||
local accountTpl = '<div><img src="img/accounts/' .. xPlayer.accounts[i].name .. '.png"/> {{money}}</div>'
|
||||
|
||||
for i=1, #xPlayer.accounts, 1 do
|
||||
ESX.UI.HUD.RegisterElement('account_' .. xPlayer.accounts[i].name, i-1, 0, accountTpl, {
|
||||
money = 0
|
||||
})
|
||||
|
||||
local accountTpl = '<div><img src="img/accounts/' .. xPlayer.accounts[i].name .. '.png"/> {{money}}</div>'
|
||||
ESX.UI.HUD.UpdateElement('account_' .. xPlayer.accounts[i].name, {
|
||||
money = xPlayer.accounts[i].money
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.HUD.RegisterElement('account_' .. xPlayer.accounts[i].name, i-1, 0, accountTpl, {
|
||||
money = 0
|
||||
})
|
||||
local jobTpl = '<div>{{job_label}} - {{grade_label}}</div>'
|
||||
|
||||
ESX.UI.HUD.UpdateElement('account_' .. xPlayer.accounts[i].name, {
|
||||
money = xPlayer.accounts[i].money
|
||||
})
|
||||
if xPlayer.job.grade_label == '' then
|
||||
jobTpl = '<div>{{job_label}}</div>'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local jobTpl = '<div>{{job_label}} - {{grade_label}}</div>'
|
||||
|
||||
if xPlayer.job.grade_label == '' then
|
||||
jobTpl = '<div>{{job_label}}</div>'
|
||||
end
|
||||
|
||||
ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, {
|
||||
job_label = '',
|
||||
grade_label = ''
|
||||
})
|
||||
|
||||
ESX.UI.HUD.UpdateElement('job', {
|
||||
job_label = xPlayer.job.label,
|
||||
grade_label = xPlayer.job.grade_label
|
||||
})
|
||||
ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, {
|
||||
job_label = '',
|
||||
grade_label = ''
|
||||
})
|
||||
|
||||
ESX.UI.HUD.UpdateElement('job', {
|
||||
job_label = xPlayer.job.label,
|
||||
grade_label = xPlayer.job.grade_label
|
||||
})
|
||||
end)
|
||||
|
||||
AddEventHandler('playerSpawned', function()
|
||||
@@ -122,7 +118,6 @@ AddEventHandler('baseevents:onPlayerKilled', function(killerId, data)
|
||||
|
||||
TriggerEvent('esx:onPlayerDeath', data)
|
||||
TriggerServerEvent('esx:onPlayerDeath', data)
|
||||
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:onPlayerDeath', function()
|
||||
@@ -134,82 +129,77 @@ AddEventHandler('skinchanger:loadDefaultModel', function()
|
||||
end)
|
||||
|
||||
AddEventHandler('skinchanger:modelLoaded', function()
|
||||
while not ESX.PlayerLoaded do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
while not ESX.PlayerLoaded do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
TriggerEvent('esx:restoreLoadout')
|
||||
TriggerEvent('esx:restoreLoadout')
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:restoreLoadout', function()
|
||||
local playerPed = PlayerPedId()
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
RemoveAllPedWeapons(playerPed, true)
|
||||
RemoveAllPedWeapons(playerPed, true)
|
||||
|
||||
for i=1, #ESX.PlayerData.loadout, 1 do
|
||||
local weaponHash = GetHashKey(ESX.PlayerData.loadout[i].name)
|
||||
GiveWeaponToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo, false, false)
|
||||
end
|
||||
for i=1, #ESX.PlayerData.loadout, 1 do
|
||||
local weaponHash = GetHashKey(ESX.PlayerData.loadout[i].name)
|
||||
GiveWeaponToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo, false, false)
|
||||
end
|
||||
|
||||
LoadoutLoaded = true
|
||||
LoadoutLoaded = true
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setAccountMoney')
|
||||
AddEventHandler('esx:setAccountMoney', function(account)
|
||||
for i=1, #ESX.PlayerData.accounts, 1 do
|
||||
if ESX.PlayerData.accounts[i].name == account.name then
|
||||
ESX.PlayerData.accounts[i] = account
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #ESX.PlayerData.accounts, 1 do
|
||||
if ESX.PlayerData.accounts[i].name == account.name then
|
||||
ESX.PlayerData.accounts[i] = account
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.HUD.UpdateElement('account_' .. account.name, {
|
||||
money = account.money
|
||||
})
|
||||
ESX.UI.HUD.UpdateElement('account_' .. account.name, {
|
||||
money = account.money
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterNetEvent('es:activateMoney')
|
||||
AddEventHandler('es:activateMoney', function(money)
|
||||
ESX.PlayerData.money = money
|
||||
ESX.PlayerData.money = money
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addInventoryItem')
|
||||
AddEventHandler('esx:addInventoryItem', function(item, count)
|
||||
for i=1, #ESX.PlayerData.inventory, 1 do
|
||||
if ESX.PlayerData.inventory[i].name == item.name then
|
||||
ESX.PlayerData.inventory[i] = item
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #ESX.PlayerData.inventory, 1 do
|
||||
if ESX.PlayerData.inventory[i].name == item.name then
|
||||
ESX.PlayerData.inventory[i] = item
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.ShowInventoryItemNotification(true, item, count)
|
||||
|
||||
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
||||
ESX.ShowInventory()
|
||||
end
|
||||
ESX.UI.ShowInventoryItemNotification(true, item, count)
|
||||
|
||||
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
||||
ESX.ShowInventory()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeInventoryItem')
|
||||
AddEventHandler('esx:removeInventoryItem', function(item, count)
|
||||
for i=1, #ESX.PlayerData.inventory, 1 do
|
||||
if ESX.PlayerData.inventory[i].name == item.name then
|
||||
ESX.PlayerData.inventory[i] = item
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #ESX.PlayerData.inventory, 1 do
|
||||
if ESX.PlayerData.inventory[i].name == item.name then
|
||||
ESX.PlayerData.inventory[i] = item
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.ShowInventoryItemNotification(false, item, count)
|
||||
|
||||
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
||||
ESX.ShowInventory()
|
||||
end
|
||||
ESX.UI.ShowInventoryItemNotification(false, item, count)
|
||||
|
||||
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
||||
ESX.ShowInventory()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
ESX.PlayerData.job = job
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addWeapon')
|
||||
@@ -240,185 +230,157 @@ end)
|
||||
-- Commands
|
||||
RegisterNetEvent('esx:teleport')
|
||||
AddEventHandler('esx:teleport', function(pos)
|
||||
-- heading?!
|
||||
pos.x = pos.x + 0.0
|
||||
pos.y = pos.y + 0.0
|
||||
pos.z = pos.z + 0.0
|
||||
pos.x = pos.x + 0.0
|
||||
pos.y = pos.y + 0.0
|
||||
pos.z = pos.z + 0.0
|
||||
|
||||
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
|
||||
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
|
||||
|
||||
while not HasCollisionLoadedAroundEntity(PlayerPedId()) do
|
||||
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
SetEntityCoords(PlayerPedId(), pos.x, pos.y, pos.z)
|
||||
while not HasCollisionLoadedAroundEntity(PlayerPedId()) do
|
||||
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
SetEntityCoords(PlayerPedId(), pos.x, pos.y, pos.z)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.UI.HUD.UpdateElement('job', {
|
||||
job_label = job.label,
|
||||
grade_label = job.grade_label
|
||||
})
|
||||
ESX.UI.HUD.UpdateElement('job', {
|
||||
job_label = job.label,
|
||||
grade_label = job.grade_label
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:loadIPL')
|
||||
AddEventHandler('esx:loadIPL', function(name)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
LoadMpDlcMaps()
|
||||
EnableMpDlcMaps(true)
|
||||
RequestIpl(name)
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
LoadMpDlcMaps()
|
||||
EnableMpDlcMaps(true)
|
||||
RequestIpl(name)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:unloadIPL')
|
||||
AddEventHandler('esx:unloadIPL', function(name)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
RemoveIpl(name)
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
RemoveIpl(name)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playAnim')
|
||||
AddEventHandler('esx:playAnim', function(dict, anim)
|
||||
Citizen.CreateThread(function()
|
||||
local playerPed = PlayerPedId()
|
||||
RequestAnimDict(dict)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
local pid = PlayerPedId()
|
||||
|
||||
RequestAnimDict(dict)
|
||||
|
||||
while not HasAnimDictLoaded(dict) do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
TaskPlayAnim(pid, dict, anim, 1.0, -1.0, 20000, 0, 1, true, true, true)
|
||||
|
||||
end)
|
||||
while not HasAnimDictLoaded(dict) do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
TaskPlayAnim(playerPed, dict, anim, 1.0, -1.0, 20000, 0, 1, true, true, true)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playEmote')
|
||||
AddEventHandler('esx:playEmote', function(emote)
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
TaskStartScenarioInPlace(playerPed, emote, 0, false);
|
||||
Citizen.Wait(20000)
|
||||
ClearPedTasks(playerPed)
|
||||
|
||||
end)
|
||||
TaskStartScenarioInPlace(playerPed, emote, 0, false);
|
||||
Citizen.Wait(20000)
|
||||
ClearPedTasks(playerPed)
|
||||
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:spawnVehicle')
|
||||
AddEventHandler('esx:spawnVehicle', function(model)
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
ESX.Game.SpawnVehicle(model, coords, 90.0, function(vehicle)
|
||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||
end)
|
||||
|
||||
ESX.Game.SpawnVehicle(model, coords, 90.0, function(vehicle)
|
||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:spawnObject')
|
||||
AddEventHandler('esx:spawnObject', function(model)
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local forward = GetEntityForwardVector(playerPed)
|
||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local forward = GetEntityForwardVector(playerPed)
|
||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||
|
||||
ESX.Game.SpawnObject(model, {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}, function(obj)
|
||||
SetEntityHeading(obj, GetEntityHeading(playerPed))
|
||||
PlaceObjectOnGroundProperly(obj)
|
||||
end)
|
||||
|
||||
ESX.Game.SpawnObject(model, {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}, function(obj)
|
||||
SetEntityHeading(obj, GetEntityHeading(playerPed))
|
||||
PlaceObjectOnGroundProperly(obj)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:pickup')
|
||||
AddEventHandler('esx:pickup', function(id, label, player)
|
||||
local ped = GetPlayerPed(GetPlayerFromServerId(player))
|
||||
local coords = GetEntityCoords(ped)
|
||||
local forward = GetEntityForwardVector(ped)
|
||||
local x, y, z = table.unpack(coords + forward * -2.0)
|
||||
|
||||
local ped = GetPlayerPed(GetPlayerFromServerId(player))
|
||||
local coords = GetEntityCoords(ped)
|
||||
local forward = GetEntityForwardVector(ped)
|
||||
local x, y, z = table.unpack(coords + forward * -2.0)
|
||||
|
||||
ESX.Game.SpawnLocalObject('prop_money_bag_01', {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z - 2.0,
|
||||
}, function(obj)
|
||||
|
||||
SetEntityAsMissionEntity(obj, true, false)
|
||||
|
||||
PlaceObjectOnGroundProperly(obj)
|
||||
|
||||
Pickups[id] = {
|
||||
id = id,
|
||||
obj = obj,
|
||||
label = label,
|
||||
inRange = false,
|
||||
coords = {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
},
|
||||
}
|
||||
|
||||
end)
|
||||
ESX.Game.SpawnLocalObject('prop_money_bag_01', {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z - 2.0,
|
||||
}, function(obj)
|
||||
SetEntityAsMissionEntity(obj, true, false)
|
||||
PlaceObjectOnGroundProperly(obj)
|
||||
|
||||
Pickups[id] = {
|
||||
id = id,
|
||||
obj = obj,
|
||||
label = label,
|
||||
inRange = false,
|
||||
coords = {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}
|
||||
}
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removePickup')
|
||||
AddEventHandler('esx:removePickup', function(id)
|
||||
ESX.Game.DeleteObject(Pickups[id].obj)
|
||||
Pickups[id] = nil
|
||||
ESX.Game.DeleteObject(Pickups[id].obj)
|
||||
Pickups[id] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:pickupWeapon')
|
||||
AddEventHandler('esx:pickupWeapon', function(weaponPickup, weaponName,ammo)
|
||||
|
||||
local ped = PlayerPedId()
|
||||
local playerPedPos = GetEntityCoords(ped, true)
|
||||
CreateAmbientPickup(GetHashKey(weaponPickup), playerPedPos.x + 2.0, playerPedPos.y, playerPedPos.z + 0.5, 0, ammo, 1, false, true)
|
||||
|
||||
local ped = PlayerPedId()
|
||||
local playerPedPos = GetEntityCoords(ped, true)
|
||||
CreateAmbientPickup(GetHashKey(weaponPickup), playerPedPos.x + 2.0, playerPedPos.y, playerPedPos.z + 0.5, 0, ammo, 1, false, true)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:spawnPed')
|
||||
AddEventHandler('esx:spawnPed', function(model)
|
||||
model = (tonumber(model) ~= nil and tonumber(model) or GetHashKey(model))
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local forward = GetEntityForwardVector(playerPed)
|
||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||
|
||||
model = (tonumber(model) ~= nil and tonumber(model) or GetHashKey(model))
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local forward = GetEntityForwardVector(playerPed)
|
||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||
Citizen.CreateThread(function()
|
||||
RequestModel(model)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
RequestModel(model)
|
||||
|
||||
while not HasModelLoaded(model) do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
CreatePed(5, model, x, y, z, 0.0, true, false)
|
||||
|
||||
end)
|
||||
while not HasModelLoaded(model) do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
|
||||
CreatePed(5, model, x, y, z, 0.0, true, false)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:deleteVehicle')
|
||||
@@ -438,127 +400,121 @@ end)
|
||||
|
||||
-- Pause menu disable HUD display
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
if IsPauseMenuActive() and not IsPaused then
|
||||
IsPaused = true
|
||||
TriggerEvent('es:setMoneyDisplay', 0.0)
|
||||
ESX.UI.HUD.SetDisplay(0.0)
|
||||
elseif not IsPauseMenuActive() and IsPaused then
|
||||
IsPaused = false
|
||||
TriggerEvent('es:setMoneyDisplay', 1.0)
|
||||
ESX.UI.HUD.SetDisplay(1.0)
|
||||
end
|
||||
end
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
|
||||
if IsPauseMenuActive() and not IsPaused then
|
||||
IsPaused = true
|
||||
TriggerEvent('es:setMoneyDisplay', 0.0)
|
||||
ESX.UI.HUD.SetDisplay(0.0)
|
||||
elseif not IsPauseMenuActive() and IsPaused then
|
||||
IsPaused = false
|
||||
TriggerEvent('es:setMoneyDisplay', 1.0)
|
||||
ESX.UI.HUD.SetDisplay(1.0)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Save loadout
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
|
||||
Citizen.Wait(1)
|
||||
local playerPed = PlayerPedId()
|
||||
local loadout = {}
|
||||
local loadoutChanged = false
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local loadout = {}
|
||||
local loadoutChanged = false
|
||||
if IsPedDeadOrDying(playerPed) then
|
||||
LoadoutLoaded = false
|
||||
end
|
||||
|
||||
if IsPedDeadOrDying(playerPed) then
|
||||
LoadoutLoaded = false
|
||||
end
|
||||
for i=1, #Config.Weapons, 1 do
|
||||
|
||||
for i=1, #Config.Weapons, 1 do
|
||||
local weaponHash = GetHashKey(Config.Weapons[i].name)
|
||||
|
||||
local weaponHash = GetHashKey(Config.Weapons[i].name)
|
||||
if HasPedGotWeapon(playerPed, weaponHash, false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then
|
||||
local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)
|
||||
|
||||
if HasPedGotWeapon(playerPed, weaponHash, false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then
|
||||
if LastLoadout[Config.Weapons[i].name] == nil or LastLoadout[Config.Weapons[i].name] ~= ammo then
|
||||
loadoutChanged = true
|
||||
end
|
||||
|
||||
local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)
|
||||
LastLoadout[Config.Weapons[i].name] = ammo
|
||||
|
||||
if LastLoadout[Config.Weapons[i].name] == nil or LastLoadout[Config.Weapons[i].name] ~= ammo then
|
||||
loadoutChanged = true
|
||||
end
|
||||
table.insert(loadout, {
|
||||
name = Config.Weapons[i].name,
|
||||
ammo = ammo,
|
||||
label = Config.Weapons[i].label
|
||||
})
|
||||
else
|
||||
if LastLoadout[Config.Weapons[i].name] ~= nil then
|
||||
loadoutChanged = true
|
||||
end
|
||||
|
||||
LastLoadout[Config.Weapons[i].name] = ammo
|
||||
LastLoadout[Config.Weapons[i].name] = nil
|
||||
end
|
||||
|
||||
table.insert(loadout, {
|
||||
name = Config.Weapons[i].name,
|
||||
ammo = ammo,
|
||||
label = Config.Weapons[i].label
|
||||
})
|
||||
end
|
||||
|
||||
else
|
||||
if loadoutChanged and LoadoutLoaded then
|
||||
ESX.PlayerData.loadout = loadout
|
||||
TriggerServerEvent('esx:updateLoadout', loadout)
|
||||
end
|
||||
|
||||
if LastLoadout[Config.Weapons[i].name] ~= nil then
|
||||
loadoutChanged = true
|
||||
end
|
||||
|
||||
LastLoadout[Config.Weapons[i].name] = nil
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if loadoutChanged and LoadoutLoaded then
|
||||
ESX.PlayerData.loadout = loadout
|
||||
TriggerServerEvent('esx:updateLoadout', loadout)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Menu interactions
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
while true do
|
||||
|
||||
Citizen.Wait(10)
|
||||
Citizen.Wait(10)
|
||||
|
||||
if IsControlJustReleased(0, Keys['F2']) and GetLastInputMethod(2) and not isDead and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
||||
ESX.ShowInventory()
|
||||
end
|
||||
if IsControlJustReleased(0, Keys['F2']) and GetLastInputMethod(2) and not isDead and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
||||
ESX.ShowInventory()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Dot above head
|
||||
if Config.ShowDotAbovePlayer then
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(1)
|
||||
Citizen.Wait(1)
|
||||
|
||||
local players = ESX.Game.GetPlayers()
|
||||
local players = ESX.Game.GetPlayers()
|
||||
for i = 1, #players, 1 do
|
||||
if players[i] ~= PlayerId() then
|
||||
local ped = GetPlayerPed(players[i])
|
||||
local headId = CreateMpGamerTag(ped, ('·'), false, false, '', false)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #players, 1 do
|
||||
if players[i] ~= PlayerId() then
|
||||
local ped = GetPlayerPed(players[i])
|
||||
local headId = CreateMpGamerTag(ped, ('·'), false, false, '', false)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
-- Disable wanted level
|
||||
if Config.DisableWantedLevel then
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(10)
|
||||
Citizen.Wait(10)
|
||||
|
||||
local playerId = PlayerId()
|
||||
local playerId = PlayerId()
|
||||
if GetPlayerWantedLevel(playerId) ~= 0 then
|
||||
SetPlayerWantedLevel(playerId, 0, false)
|
||||
SetPlayerWantedLevelNow(playerId, false)
|
||||
end
|
||||
|
||||
if GetPlayerWantedLevel(playerId) ~= 0 then
|
||||
SetPlayerWantedLevel(playerId, 0, false)
|
||||
SetPlayerWantedLevelNow(playerId, false)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
@@ -602,37 +558,29 @@ end)
|
||||
|
||||
-- Last position
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
while true do
|
||||
Citizen.Wait(1000)
|
||||
if ESX ~= nil and ESX.PlayerLoaded and PlayerSpawned then
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
Citizen.Wait(1000)
|
||||
|
||||
if ESX ~= nil and ESX.PlayerLoaded and PlayerSpawned then
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if not IsEntityDead(playerPed) then
|
||||
ESX.PlayerData.lastPosition = {x = coords.x, y = coords.y, z = coords.z}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
if not IsEntityDead(playerPed) then
|
||||
ESX.PlayerData.lastPosition = {x = coords.x, y = coords.y, z = coords.z}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
while true do
|
||||
|
||||
Citizen.Wait(1000)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsEntityDead(playerPed) and PlayerSpawned then
|
||||
PlayerSpawned = false
|
||||
end
|
||||
end
|
||||
Citizen.Wait(1000)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
if IsEntityDead(playerPed) and PlayerSpawned then
|
||||
PlayerSpawned = false
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user