mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Merge pull request #1038 from TheFantomas/dev
lint(core): Fix lint reports + fix some lint reports
This commit is contained in:
@@ -155,9 +155,9 @@ if GetResourceState("esx_context") ~= "missing" then
|
||||
end
|
||||
|
||||
function ESX.RefreshContext(...)
|
||||
exports["esx_context"]:Refresh(...)
|
||||
exports["esx_context"]:Refresh(...)
|
||||
end
|
||||
else
|
||||
else
|
||||
function ESX.OpenContext()
|
||||
print("[^1ERROR^7] Tried to ^5open^7 context menu, but ^5esx_context^7 is missing!")
|
||||
end
|
||||
@@ -358,7 +358,7 @@ end
|
||||
|
||||
function ESX.Game.SpawnObject(object, coords, cb, networked)
|
||||
networked = networked == nil and true or networked
|
||||
if networked then
|
||||
if networked then
|
||||
ESX.TriggerServerCallback('esx:Onesync:SpawnObject', function(NetworkID)
|
||||
if cb then
|
||||
local obj = NetworkGetEntityFromNetworkId(NetworkID)
|
||||
@@ -366,7 +366,7 @@ function ESX.Game.SpawnObject(object, coords, cb, networked)
|
||||
while not DoesEntityExist(obj) do
|
||||
obj = NetworkGetEntityFromNetworkId(NetworkID)
|
||||
Wait(0)
|
||||
Tries += 1
|
||||
Tries = Tries + 1
|
||||
if Tries > 250 then
|
||||
break
|
||||
end
|
||||
@@ -374,7 +374,7 @@ function ESX.Game.SpawnObject(object, coords, cb, networked)
|
||||
cb(obj)
|
||||
end
|
||||
end, object, coords, 0.0)
|
||||
else
|
||||
else
|
||||
local model = type(object) == 'number' and object or joaat(object)
|
||||
local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
|
||||
CreateThread(function()
|
||||
@@ -408,13 +408,13 @@ function ESX.Game.SpawnVehicle(vehicle, coords, heading, cb, networked)
|
||||
networked = networked == nil and true or networked
|
||||
|
||||
local playerCoords = GetEntityCoords(ESX.PlayerData.ped)
|
||||
if not vector or not playerCoords then
|
||||
if not vector or not playerCoords then
|
||||
return
|
||||
end
|
||||
local dist = #(playerCoords - vector)
|
||||
if dist > 424 then -- Onesync infinity Range (https://docs.fivem.net/docs/scripting-reference/onesync/)
|
||||
local executingResource = GetInvokingResource() or "Unknown"
|
||||
return print(("[^1ERROR^7] Resource ^5%s^7 Tried to spawn vehicle on the client but the position is too far away (Out of onesync range)."):format(executing_resource))
|
||||
return print(("[^1ERROR^7] Resource ^5%s^7 Tried to spawn vehicle on the client but the position is too far away (Out of onesync range)."):format(executingResource))
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
@@ -482,7 +482,7 @@ end
|
||||
function ESX.Game.GetPlayers(onlyOtherPlayers, returnKeyValue, returnPeds)
|
||||
local players, myPlayer = {}, PlayerId()
|
||||
|
||||
for k, player in ipairs(GetActivePlayers()) do
|
||||
for _, player in ipairs(GetActivePlayers()) do
|
||||
local ped = GetPlayerPed(player)
|
||||
|
||||
if DoesEntityExist(ped) and ((onlyOtherPlayers and player ~= myPlayer) or not onlyOtherPlayers) then
|
||||
@@ -560,7 +560,7 @@ function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilt
|
||||
if modelFilter then
|
||||
filteredEntities = {}
|
||||
|
||||
for k, entity in pairs(entities) do
|
||||
for _, entity in pairs(entities) do
|
||||
if modelFilter[GetEntityModel(entity)] then
|
||||
filteredEntities[#filteredEntities + 1] = entity
|
||||
end
|
||||
@@ -583,7 +583,7 @@ function ESX.Game.GetVehicleInDirection()
|
||||
local playerCoords = GetEntityCoords(playerPed)
|
||||
local inDirection = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
|
||||
local rayHandle = StartExpensiveSynchronousShapeTestLosProbe(playerCoords, inDirection, 10, playerPed, 0)
|
||||
local numRayHandle, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(rayHandle)
|
||||
local _, hit, _, _, entityHit = GetShapeTestResult(rayHandle)
|
||||
|
||||
if hit == 1 and GetEntityType(entityHit) == 2 then
|
||||
local entityCoords = GetEntityCoords(entityHit)
|
||||
@@ -610,7 +610,7 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
|
||||
local hasCustomXenonColor, customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle)
|
||||
local customXenonColor = nil
|
||||
if hasCustomXenonColor then
|
||||
if hasCustomXenonColor then
|
||||
customXenonColor = {customXenonColorR, customXenonColorG, customXenonColorB}
|
||||
end
|
||||
|
||||
@@ -638,7 +638,7 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
}
|
||||
|
||||
if TyresIndex[numWheels] then
|
||||
for tyre, idx in pairs(TyresIndex[numWheels]) do
|
||||
for _, idx in pairs(TyresIndex[numWheels]) do
|
||||
tyreBurst[tostring(idx)] = IsVehicleTyreBurst(vehicle, idx, false)
|
||||
end
|
||||
end
|
||||
@@ -1056,7 +1056,7 @@ function ESX.ShowInventory()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in ipairs(ESX.PlayerData.inventory) do
|
||||
for _, v in ipairs(ESX.PlayerData.inventory) do
|
||||
if v.count > 0 then
|
||||
currentWeight = currentWeight + (v.weight * v.count)
|
||||
|
||||
@@ -1073,7 +1073,7 @@ function ESX.ShowInventory()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in ipairs(Config.Weapons) do
|
||||
for _, v in ipairs(Config.Weapons) do
|
||||
local weaponHash = joaat(v.name)
|
||||
|
||||
if HasPedGotWeapon(playerPed, weaponHash, false) then
|
||||
@@ -1171,7 +1171,7 @@ function ESX.ShowInventory()
|
||||
{unselectable = true, icon = "fas fa-users", title = "Nearby Players"}
|
||||
}
|
||||
|
||||
for k, playerNearby in ipairs(playersNearby) do
|
||||
for _, playerNearby in ipairs(playersNearby) do
|
||||
players[GetPlayerServerId(playerNearby)] = true
|
||||
end
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
|
||||
if seat == 0 then
|
||||
SetPedIntoVehicle(ESX.PlayerData.ped, vehicle, 0)
|
||||
SetPedConfigFlag(ESX.PlayerData.ped, 184, true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -174,7 +174,7 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
|
||||
'WORLD_HUMAN_PAPARAZZI'
|
||||
}
|
||||
|
||||
for i, v in pairs(scenarios) do
|
||||
for _, v in pairs(scenarios) do
|
||||
SetScenarioTypeEnabled(v, false)
|
||||
end
|
||||
end
|
||||
@@ -218,7 +218,7 @@ AddEventHandler('esx:restoreLoadout', function()
|
||||
local ammoTypes = {}
|
||||
RemoveAllPedWeapons(ESX.PlayerData.ped, true)
|
||||
|
||||
for k, v in ipairs(ESX.PlayerData.loadout) do
|
||||
for _, v in ipairs(ESX.PlayerData.loadout) do
|
||||
local weaponName = v.name
|
||||
local weaponHash = joaat(weaponName)
|
||||
|
||||
@@ -227,7 +227,7 @@ AddEventHandler('esx:restoreLoadout', function()
|
||||
|
||||
local ammoType = GetPedAmmoTypeFromWeapon(ESX.PlayerData.ped, weaponHash)
|
||||
|
||||
for k2, v2 in ipairs(v.components) do
|
||||
for _, v2 in ipairs(v.components) do
|
||||
local componentHash = ESX.GetWeaponComponent(weaponName, v2).hash
|
||||
GiveWeaponComponentToPed(ESX.PlayerData.ped, weaponHash, componentHash)
|
||||
end
|
||||
@@ -242,8 +242,8 @@ end)
|
||||
|
||||
-- Credit: https://github.com/LukeWasTakenn, https://github.com/LukeWasTakenn/luke_garages/blob/master/client/client.lua#L331-L352
|
||||
AddStateBagChangeHandler('VehicleProperties', nil, function(bagName, key, value)
|
||||
if not value then
|
||||
return
|
||||
if not value then
|
||||
return
|
||||
end
|
||||
|
||||
local netId = bagName:gsub('entity:', '')
|
||||
@@ -315,17 +315,17 @@ if not Config.OxInventory then
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addWeapon')
|
||||
AddEventHandler('esx:addWeapon', function(weapon, ammo)
|
||||
AddEventHandler('esx:addWeapon', function()
|
||||
print("[^1ERROR^7] event ^5'esx:addWeapon'^7 Has Been Removed. Please use ^5xPlayer.addWeapon^7 Instead!")
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addWeaponComponent')
|
||||
AddEventHandler('esx:addWeaponComponent', function(weapon, weaponComponent)
|
||||
AddEventHandler('esx:addWeaponComponent', function()
|
||||
print("[^1ERROR^7] event ^5'esx:addWeaponComponent'^7 Has Been Removed. Please use ^5xPlayer.addWeaponComponent^7 Instead!")
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setWeaponAmmo')
|
||||
AddEventHandler('esx:setWeaponAmmo', function(weapon, weaponAmmo)
|
||||
AddEventHandler('esx:setWeaponAmmo', function()
|
||||
print("[^1ERROR^7] event ^5'esx:setWeaponAmmo'^7 Has Been Removed. Please use ^5xPlayer.addWeaponAmmo^7 Instead!")
|
||||
end)
|
||||
|
||||
@@ -337,7 +337,6 @@ if not Config.OxInventory then
|
||||
|
||||
RegisterNetEvent('esx:removeWeapon')
|
||||
AddEventHandler('esx:removeWeapon', function(weapon)
|
||||
local playerPed = ESX.PlayerData.ped
|
||||
RemoveWeaponFromPed(ESX.PlayerData.ped, joaat(weapon))
|
||||
SetPedAmmo(ESX.PlayerData.ped, joaat(weapon), 0)
|
||||
end)
|
||||
@@ -377,7 +376,7 @@ if not Config.OxInventory then
|
||||
local pickupObject = CreateWeaponObject(weaponHash, 50, coords.x, coords.y, coords.z, true, 1.0, 0)
|
||||
SetWeaponObjectTintIndex(pickupObject, tintIndex)
|
||||
|
||||
for k, v in ipairs(components) do
|
||||
for _, v in ipairs(components) do
|
||||
local component = ESX.GetWeaponComponent(name, v)
|
||||
GiveWeaponComponentToWeaponObject(pickupObject, component.hash)
|
||||
end
|
||||
@@ -468,7 +467,7 @@ if not Config.OxInventory then
|
||||
while true do
|
||||
local Sleep = 1500
|
||||
local playerCoords = GetEntityCoords(ESX.PlayerData.ped)
|
||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
|
||||
local _, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
|
||||
|
||||
for pickupId, pickup in pairs(pickups) do
|
||||
local distance = #(playerCoords - pickup.coords)
|
||||
|
||||
@@ -13,7 +13,7 @@ end
|
||||
|
||||
function ESX.Table.Set(t)
|
||||
local set = {}
|
||||
for k,v in ipairs(t) do set[v] = true end
|
||||
for _,v in ipairs(t) do set[v] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Locales['fi'] = {
|
||||
['received_weapon_ammo'] = 'Sinä sait ~o~%sx %s sinun %s varten henkilöltä %s',
|
||||
['received_weapon_withammo'] = 'Sinä sait 1x %s ammuksella ~o~%sx %s henkilöltä %s',
|
||||
['received_weapon_hasalready'] = '%s yritti antaa sinulle %s, mutta sinulla on jo sellainen',
|
||||
['received_weapon_noweapon'] = '%s yritti antaa sinulle ammuksia %s:lle, mutta sinulla ei ole sellaista',
|
||||
['received_weapon_noweapon'] = '%s yritti antaa sinulle ammuksia %s:lle, mutta sinulla ei ole sellaista',
|
||||
['gave_account_money'] = 'Sinä annoit $%s (%s) henkilölle %s',
|
||||
['received_account_money'] = 'Sinä sait $%s (%s) henkilöltä %s',
|
||||
['amount_invalid'] = 'Virheellinen määrä',
|
||||
@@ -75,7 +75,7 @@ Locales['fi'] = {
|
||||
['command_giveweapon_hasalready'] = 'Pelaajalla on jo kyseinen ase',
|
||||
['command_giveweaponcomponent'] = 'Anna aseen komponentti',
|
||||
['command_giveweaponcomponent_component'] = 'Komponentin nimi',
|
||||
['command_giveweaponcomponent_invalid'] = 'Virheellinen aseen komponentti',
|
||||
['command_giveweaponcomponent_invalid'] = 'Virheellinen aseen komponentti',
|
||||
['command_giveweaponcomponent_hasalready'] = 'Pelaajalla on jo kyseinen asekomponentti',
|
||||
['command_giveweaponcomponent_missingweapon'] = 'Pelaajalla ei ole kyseistä asetta',
|
||||
['command_save'] = 'Talenna pelaaja tietokantaan',
|
||||
@@ -105,7 +105,7 @@ Locales['fi'] = {
|
||||
['command_giveammo_ammo'] = 'Ammusten määrä',
|
||||
|
||||
-- Locale settings
|
||||
['locale_digit_grouping_symbol'] = ' ',
|
||||
['locale_digit_grouping_symbol'] = '',
|
||||
['locale_currency'] = '$%s',
|
||||
|
||||
-- Weapons
|
||||
|
||||
@@ -70,7 +70,7 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
|
||||
if account then
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money += money
|
||||
self.accounts[account.index].money = self.accounts[account.index].money + money
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:addAccountMoney', self.source, accountName, money, reason)
|
||||
if Inventory.accounts[accountName] then
|
||||
@@ -89,7 +89,7 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
|
||||
if account then
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money -= money
|
||||
self.accounts[account.index].money = self.accounts[account.index].mone - money
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:removeAccountMoney', self.source, accountName, money, reason)
|
||||
if Inventory.accounts[accountName] then
|
||||
|
||||
@@ -57,8 +57,8 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
local heading = GetEntityHeading(Ped)
|
||||
self.coords = {
|
||||
x = coords.x,
|
||||
y = coords.y,
|
||||
z = coords.z,
|
||||
y = coords.y,
|
||||
z = coords.z,
|
||||
heading = heading or 0.0
|
||||
}
|
||||
end
|
||||
@@ -148,7 +148,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
if minimal then
|
||||
local minimalInventory = {}
|
||||
|
||||
for k, v in ipairs(self.inventory) do
|
||||
for _, v in ipairs(self.inventory) do
|
||||
if v.count > 0 then
|
||||
minimalInventory[v.name] = v.count
|
||||
end
|
||||
@@ -170,7 +170,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
local minimalLoadout = {}
|
||||
|
||||
for k,v in ipairs(self.loadout) do
|
||||
for _,v in ipairs(self.loadout) do
|
||||
minimalLoadout[v.name] = {ammo = v.ammo}
|
||||
if v.tintIndex > 0 then minimalLoadout[v.name].tintIndex = v.tintIndex end
|
||||
|
||||
@@ -203,7 +203,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
|
||||
function self.setAccountMoney(accountName, money, reason)
|
||||
reason = reason or 'unknown'
|
||||
if not tonumber(money) then
|
||||
if not tonumber(money) then
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7'):format(accountName, self.playerId, money))
|
||||
return
|
||||
end
|
||||
@@ -216,17 +216,17 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:setAccountMoney', self.source, accountName, money, reason)
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Invalid Account ^5%s^0 For Player ^5%s^0!'):format(accountName, self.playerId))
|
||||
end
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7'):format(accountName, self.playerId, money))
|
||||
end
|
||||
end
|
||||
|
||||
function self.addAccountMoney(accountName, money, reason)
|
||||
reason = reason or 'Unknown'
|
||||
if not tonumber(money) then
|
||||
if not tonumber(money) then
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7'):format(accountName, self.playerId, money))
|
||||
return
|
||||
end
|
||||
@@ -234,21 +234,21 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
local account = self.getAccount(accountName)
|
||||
if account then
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money += money
|
||||
self.accounts[account.index].money = self.accounts[account.index].money + money
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:addAccountMoney', self.source, accountName, money, reason)
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!'):format(accountName, self.playerId))
|
||||
end
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7'):format(accountName, self.playerId, money))
|
||||
end
|
||||
end
|
||||
|
||||
function self.removeAccountMoney(accountName, money, reason)
|
||||
reason = reason or 'Unknown'
|
||||
if not tonumber(money) then
|
||||
if not tonumber(money) then
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7'):format(accountName, self.playerId, money))
|
||||
return
|
||||
end
|
||||
@@ -257,20 +257,20 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
|
||||
if account then
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money -= money
|
||||
self.accounts[account.index].money = self.accounts[account.index].money - money
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:removeAccountMoney', self.source, accountName, money, reason)
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!'):format(accountName, self.playerId))
|
||||
end
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7'):format(accountName, self.playerId, money))
|
||||
end
|
||||
end
|
||||
|
||||
function self.getInventoryItem(name, metadata)
|
||||
for k,v in ipairs(self.inventory) do
|
||||
for _,v in ipairs(self.inventory) do
|
||||
if v.name == name then
|
||||
return v
|
||||
end
|
||||
@@ -531,7 +531,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
for k,v in ipairs(weapon.components) do
|
||||
for _,v in ipairs(weapon.components) do
|
||||
if v == weaponComponent then
|
||||
return true
|
||||
end
|
||||
@@ -544,7 +544,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.hasWeapon(weaponName)
|
||||
for k,v in ipairs(self.loadout) do
|
||||
for _,v in ipairs(self.loadout) do
|
||||
if v.name == weaponName then
|
||||
return true
|
||||
end
|
||||
@@ -554,7 +554,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.hasItem(item, metadata)
|
||||
for k,v in ipairs(self.inventory) do
|
||||
for _,v in ipairs(self.inventory) do
|
||||
if (v.name == item) and (v.count >= 1) then
|
||||
return v, v.count
|
||||
end
|
||||
|
||||
@@ -76,7 +76,7 @@ ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError)
|
||||
end)
|
||||
end, false, {help = TranslateCap('command_car'), validate = false, arguments = {
|
||||
{name = 'car',validate = false, help = TranslateCap('command_car_car'), type = 'string'}
|
||||
}})
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand({'cardel', 'dv'}, 'admin', function(xPlayer, args, showError)
|
||||
local PedVehicle = GetVehiclePedIsIn(GetPlayerPed(xPlayer.source), false)
|
||||
@@ -84,7 +84,7 @@ ESX.RegisterCommand({'cardel', 'dv'}, 'admin', function(xPlayer, args, showError
|
||||
DeleteEntity(PedVehicle)
|
||||
end
|
||||
local Vehicles = ESX.OneSync.GetVehiclesInArea(GetEntityCoords(GetPlayerPed(xPlayer.source)), tonumber(args.radius) or 5.0)
|
||||
for i=1, #Vehicles do
|
||||
for i=1, #Vehicles do
|
||||
local Vehicle = NetworkGetEntityFromNetworkId(Vehicles[i])
|
||||
if DoesEntityExist(Vehicle) then
|
||||
DeleteEntity(Vehicle)
|
||||
@@ -141,7 +141,7 @@ if not Config.OxInventory then
|
||||
|
||||
ESX.RegisterCommand('giveammo', 'admin', function(xPlayer, args, showError)
|
||||
if args.playerId.hasWeapon(args.weapon) then
|
||||
args.playerId.addWeaponAmmo(args.weapon, args.ammo)
|
||||
args.playerId.addWeaponAmmo(args.weapon, args.ammo)
|
||||
else
|
||||
showError(TranslateCap("command_giveammo_noweapon_found"))
|
||||
end
|
||||
@@ -293,7 +293,7 @@ end, false)
|
||||
ESX.RegisterCommand('players', "admin", function(xPlayer, args, showError)
|
||||
local xPlayers = ESX.GetExtendedPlayers() -- Returns all xPlayers
|
||||
print("^5"..#xPlayers.." ^2online player(s)^0")
|
||||
for i=1, #(xPlayers) do
|
||||
for i=1, #(xPlayers) do
|
||||
local xPlayer = xPlayers[i]
|
||||
print("^1[ ^2ID : ^5"..xPlayer.source.." ^0| ^2Name : ^5"..xPlayer.getName().." ^0 | ^2Group : ^5"..xPlayer.getGroup().." ^0 | ^2Identifier : ^5".. xPlayer.identifier .."^1]^0\n")
|
||||
end
|
||||
|
||||
@@ -158,7 +158,7 @@ function Core.SavePlayer(xPlayer, cb)
|
||||
xPlayer.job.grade,
|
||||
xPlayer.group,
|
||||
json.encode(xPlayer.getCoords()),
|
||||
json.encode(xPlayer.getInventory(true)),
|
||||
json.encode(xPlayer.getInventory(true)),
|
||||
json.encode(xPlayer.getLoadout(true)),
|
||||
json.encode(xPlayer.getMeta()),
|
||||
xPlayer.identifier
|
||||
@@ -204,7 +204,7 @@ function Core.SavePlayers(cb)
|
||||
|
||||
MySQL.prepare(
|
||||
"UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?",
|
||||
parameters,
|
||||
parameters,
|
||||
function(results)
|
||||
if not results then
|
||||
return
|
||||
@@ -244,7 +244,7 @@ function ESX.GetPlayerFromIdentifier(identifier)
|
||||
end
|
||||
|
||||
function ESX.GetIdentifier(playerId)
|
||||
local fxDk = GetConvarInt('sv_fxdkMode', 0)
|
||||
local fxDk = GetConvarInt('sv_fxdkMode', 0)
|
||||
if fxDk == 1 then
|
||||
return "ESX-DEBUG-LICENCE"
|
||||
end
|
||||
@@ -306,7 +306,7 @@ function ESX.DiscordLogFields(name, title, color, fields)
|
||||
['text'] = "| ESX Logs | " .. os.date(),
|
||||
['icon_url'] = "https://cdn.discordapp.com/attachments/944789399852417096/1020099828266586193/blanc-800x800.png"
|
||||
},
|
||||
['fields'] = fields,
|
||||
['fields'] = fields,
|
||||
['description'] = "",
|
||||
['author'] = {
|
||||
['name'] = "ESX Framework",
|
||||
|
||||
@@ -26,7 +26,7 @@ local function getNearbyPlayers(source, closest, distance, ignore)
|
||||
if not closest then
|
||||
local dist = #(source - coords)
|
||||
if dist <= distance then
|
||||
count += 1
|
||||
count = count + 1
|
||||
result[count] = {id = xPlayer.source, ped = NetworkGetNetworkIdFromEntity(entity), coords = coords, dist = dist}
|
||||
end
|
||||
else
|
||||
@@ -76,7 +76,7 @@ function ESX.OneSync.SpawnVehicle(model, coords, heading, properties, cb)
|
||||
local networkId = NetworkGetNetworkIdFromEntity(createdVehicle)
|
||||
Entity(createdVehicle).state:set('VehicleProperties', vehicleProperties, true)
|
||||
cb(networkId)
|
||||
else
|
||||
else
|
||||
print(('[^1ERROR^7] Tried to spawn invalid vehicle - ^5%s^7!'):format(model))
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -87,7 +87,7 @@ end)
|
||||
RegisterNUICallback("selected",function(data,cb)
|
||||
if not activeMenu
|
||||
or not activeMenu.onSelect
|
||||
or not data.index
|
||||
or not data.index
|
||||
then
|
||||
return
|
||||
end
|
||||
@@ -96,7 +96,7 @@ RegisterNUICallback("selected",function(data,cb)
|
||||
local ele = activeMenu.eles[index]
|
||||
|
||||
if not ele
|
||||
or ele.input
|
||||
or ele.input
|
||||
then
|
||||
return
|
||||
end
|
||||
@@ -107,7 +107,7 @@ end)
|
||||
|
||||
RegisterNUICallback("changed",function(data,cb)
|
||||
if not activeMenu
|
||||
or not data.index
|
||||
or not data.index
|
||||
or not data.value
|
||||
then
|
||||
return
|
||||
@@ -117,7 +117,7 @@ RegisterNUICallback("changed",function(data,cb)
|
||||
local ele = activeMenu.eles[index]
|
||||
|
||||
if not ele
|
||||
or not ele.input
|
||||
or not ele.input
|
||||
then
|
||||
return
|
||||
end
|
||||
@@ -144,7 +144,7 @@ end)
|
||||
|
||||
local function focusPreview()
|
||||
if not activeMenu
|
||||
or not activeMenu.onSelect
|
||||
or not activeMenu.onSelect
|
||||
then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -301,7 +301,7 @@ else
|
||||
if not identifier then
|
||||
return deferrals.done(TranslateCap('no_identifier'))
|
||||
end
|
||||
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {identifier},
|
||||
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {identifier},
|
||||
function(result)
|
||||
if not result then
|
||||
playerIdentity[identifier] = nil
|
||||
@@ -338,7 +338,7 @@ else
|
||||
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
|
||||
for i=1, #(xPlayers) do
|
||||
for i=1, #(xPlayers) do
|
||||
if xPlayers[i] then
|
||||
checkIdentity(xPlayers[i])
|
||||
end
|
||||
@@ -393,7 +393,7 @@ else
|
||||
TriggerClientEvent('esx:showNotification',source,TranslateCap('invalid_height_format'), "error")
|
||||
return cb(false)
|
||||
end
|
||||
if xPlayer then
|
||||
if xPlayer then
|
||||
if alreadyRegistered[xPlayer.identifier] then
|
||||
xPlayer.showNotification(TranslateCap('already_registered'), "error")
|
||||
return cb(false)
|
||||
|
||||
@@ -3,7 +3,7 @@ GUI.Time = 0
|
||||
|
||||
local function openMenu(namespace, name, data)
|
||||
CurrentNameSpace = namespace
|
||||
OpenedMenus += 1
|
||||
OpenedMenus = OpenedMenus + 1
|
||||
SendNUIMessage({
|
||||
action = 'openMenu',
|
||||
namespace = namespace,
|
||||
@@ -15,7 +15,7 @@ end
|
||||
local function closeMenu(namespace, name)
|
||||
CurrentNameSpace = namespace
|
||||
if OpenedMenus < 1 then return end
|
||||
OpenedMenus -= 1
|
||||
OpenedMenus = OpenedMenus - 1
|
||||
SendNUIMessage({
|
||||
action = 'closeMenu',
|
||||
namespace = namespace,
|
||||
|
||||
@@ -159,9 +159,9 @@ if ESX.GetConfig().Multichar then
|
||||
end
|
||||
|
||||
function CharacterOptions(Characters, slots, SelectedCharacter)
|
||||
local elements = {{title = TranslateCap('character', Characters[SelectedCharacter.value].firstname .. " ".. Characters[SelectedCharacter.value].lastname),icon = "fa-regular fa-user", unselectable = true},
|
||||
local elements = {{title = TranslateCap('character', Characters[SelectedCharacter.value].firstname .. " ".. Characters[SelectedCharacter.value].lastname),icon = "fa-regular fa-user", unselectable = true},
|
||||
{title = TranslateCap('return'), unselectable = false,icon = "fa-solid fa-arrow-left",description = TranslateCap('return_description'), action = "return"}}
|
||||
if not Characters[SelectedCharacter.value].disabled then
|
||||
if not Characters[SelectedCharacter.value].disabled then
|
||||
elements[3] = {title = TranslateCap('char_play'), description = TranslateCap('char_play_description'), icon ="fa-solid fa-play",action = 'play', value = SelectedCharacter.value}
|
||||
else
|
||||
elements[3] = {title = TranslateCap('char_disabled'), value = SelectedCharacter.value, icon ="fa-solid fa-xmark", description = TranslateCap('char_disabled_description'),}
|
||||
|
||||
@@ -16,10 +16,10 @@ Locales["fi"] = {
|
||||
["char_delete_no_description"] = "Ei, Palaa hahmojen valintaan",
|
||||
["character"] = "Hahmo: %s",
|
||||
["return"] = "Takaisin",
|
||||
["return_description"] = "Palaa hahmojen valintaan.",
|
||||
["command_setslots"] = "Määritä pelaajan multicharacter paikkojen määrä",
|
||||
["return_description"] = "Palaa hahmojen valintaan.",
|
||||
["command_setslots"] = "Määritä pelaajan multicharacter paikkojen määrä",
|
||||
["command_remslots"] = "Vähennä pelaajan multicharacter paikkojen määrää",
|
||||
["command_enablechar"] = "Muuta pelaajan tietty hahmo käyttöön",
|
||||
["command_enablechar"] = "Muuta pelaajan tietty hahmo käyttöön",
|
||||
["command_disablechar"] = "Muuta pelaajan tietty hahmo pois käytöstä",
|
||||
["command_charslot"] = "Hahmon paikan numero",
|
||||
["command_identifier"] = "Pelaajan tunniste",
|
||||
|
||||
@@ -29,7 +29,7 @@ end
|
||||
local PRIMARY_IDENTIFIER = ESX.GetConfig().Identifier or GetConvar('sv_lan', '') == 'true' and 'ip' or "license"
|
||||
|
||||
local function GetIdentifier(source)
|
||||
local fxDk = GetConvarInt('sv_fxdkMode', 0)
|
||||
local fxDk = GetConvarInt('sv_fxdkMode', 0)
|
||||
if fxDk == 1 then
|
||||
return "ESX-DEBUG-LICENCE"
|
||||
end
|
||||
@@ -134,7 +134,7 @@ end
|
||||
local count = 0
|
||||
|
||||
for table, column in pairs(DB_TABLES) do
|
||||
count += 1
|
||||
count = count + 1
|
||||
queries[count] = {query = query:format(table, column), values = {identifier}}
|
||||
end
|
||||
|
||||
@@ -164,7 +164,7 @@ end
|
||||
DB_TABLES[column.TABLE_NAME] = column.COLUMN_NAME
|
||||
|
||||
if column?.CHARACTER_MAXIMUM_LENGTH ~= length then
|
||||
count += 1
|
||||
count = count + 1
|
||||
columns[column.TABLE_NAME] = column.COLUMN_NAME
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ local function Progressbar(message,length,Options)
|
||||
return false
|
||||
end
|
||||
CurrentProgress = Options or {}
|
||||
if CurrentProgress.animation then
|
||||
if CurrentProgress.animation then
|
||||
if CurrentProgress.animation.type == "anim" then
|
||||
ESX.Streaming.RequestAnimDict(CurrentProgress.animation.dict, function()
|
||||
TaskPlayAnim(ESX.PlayerData.ped, CurrentProgress.animation.dict, CurrentProgress.animation.lib, 1.0, 1.0, length, 1, 1.0, false,false,false)
|
||||
@@ -22,8 +22,8 @@ local function Progressbar(message,length,Options)
|
||||
})
|
||||
CurrentProgress.length = length or 3000
|
||||
while CurrentProgress ~= nil do
|
||||
if CurrentProgress.length > 0 then
|
||||
CurrentProgress.length -= 1000
|
||||
if CurrentProgress.length > 0 then
|
||||
CurrentProgress.length = CurrentProgress.length - 1000
|
||||
else
|
||||
ClearPedTasks(ESX.PlayerData.ped)
|
||||
if CurrentProgress.FreezePlayer then FreezeEntityPosition(PlayerPedId(), false) end
|
||||
|
||||
@@ -3,8 +3,8 @@ Config = {}
|
||||
Config.Locale = GetConvar('esx:locale', 'en')
|
||||
|
||||
Config.BackpackWeight = {
|
||||
[40] = 16,
|
||||
[41] = 20,
|
||||
[44] = 25,
|
||||
[40] = 16,
|
||||
[41] = 20,
|
||||
[44] = 25,
|
||||
[45] = 23
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user