mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
refactor(es_extended): correction of lint errors
This commit is contained in:
@@ -1225,7 +1225,7 @@ function ESX.ShowInventory()
|
||||
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||
}
|
||||
|
||||
ESX.OpenContext("right", elementsG, function(menuG, _)
|
||||
ESX.OpenContext("right", elementsG, function(menuG)
|
||||
local quantity = tonumber(menuG.eles[2].inputValue)
|
||||
|
||||
if quantity and quantity > 0 and element.count >= quantity then
|
||||
@@ -1264,7 +1264,7 @@ function ESX.ShowInventory()
|
||||
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||
}
|
||||
|
||||
ESX.OpenContext("right", elementsR, function(menuR, _)
|
||||
ESX.OpenContext("right", elementsR, function(menuR)
|
||||
local quantity = tonumber(menuR.eles[2].inputValue)
|
||||
|
||||
if quantity and quantity > 0 and element.count >= quantity then
|
||||
@@ -1299,7 +1299,7 @@ function ESX.ShowInventory()
|
||||
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||
}
|
||||
|
||||
ESX.OpenContext("right", elementsGA, function(menuGA, _)
|
||||
ESX.OpenContext("right", elementsGA, function(menuGA)
|
||||
local quantity = tonumber(menuGA.eles[2].inputValue)
|
||||
|
||||
if quantity and quantity > 0 then
|
||||
|
||||
@@ -72,20 +72,20 @@ function ESX.DumpTable(table, nb)
|
||||
|
||||
if type(table) == 'table' then
|
||||
local s = ''
|
||||
for i = 1, nb + 1, 1 do
|
||||
for _ = 1, nb + 1, 1 do
|
||||
s = s .. " "
|
||||
end
|
||||
|
||||
s = '{\n'
|
||||
for k, v in pairs(table) do
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
for i = 1, nb, 1 do
|
||||
for _ = 1, nb, 1 do
|
||||
s = s .. " "
|
||||
end
|
||||
s = s .. '['..k..'] = ' .. ESX.DumpTable(v, nb + 1) .. ',\n'
|
||||
end
|
||||
|
||||
for i = 1, nb, 1 do
|
||||
for _ = 1, nb, 1 do
|
||||
s = s .. " "
|
||||
end
|
||||
|
||||
|
||||
@@ -985,7 +985,7 @@ Config.Weapons = {
|
||||
},
|
||||
{name = 'WEAPON_ACIDPACKAGE', label = TranslateCap('weapon_acidpackage'), components = {}},
|
||||
{name = 'WEAPON_CANDYCANE', label = TranslateCap('weapon_candycane'), components = {}},
|
||||
{name = 'WEAPON_RAILGUNXM3', label = TranslateCap('weapon_railgunxm3'), ammo = {label = TranslateCap('ammo_rounds'), hash = `AMMO_RAILGUN`}, tints = Config.DefaultWeaponTints,
|
||||
{name = 'WEAPON_RAILGUNXM3', label = TranslateCap('weapon_railgunxm3'), ammo = {label = TranslateCap('ammo_rounds'), hash = `AMMO_RAILGUN`}, tints = Config.DefaultWeaponTints,
|
||||
components = {
|
||||
{name = 'clip_default', label = TranslateCap('component_clip_default'), hash = `COMPONENT_RAILGUNXM3_CLIP_01`},
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
end
|
||||
end,
|
||||
|
||||
getLoadout = function(_)
|
||||
getLoadout = function()
|
||||
return function()
|
||||
return {}
|
||||
end
|
||||
@@ -144,49 +144,49 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
end
|
||||
end,
|
||||
|
||||
addWeapon = function(_)
|
||||
addWeapon = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
addWeaponComponent = function(_)
|
||||
addWeaponComponent = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
addWeaponAmmo = function(_)
|
||||
addWeaponAmmo = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
updateWeaponAmmo = function(_)
|
||||
updateWeaponAmmo = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
setWeaponTint = function(_)
|
||||
setWeaponTint = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
getWeaponTint = function(_)
|
||||
getWeaponTint = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
removeWeapon = function(_)
|
||||
removeWeapon = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
removeWeaponComponent = function(_)
|
||||
removeWeaponComponent = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
removeWeaponAmmo = function(_)
|
||||
removeWeaponAmmo = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
hasWeaponComponent = function(_)
|
||||
hasWeaponComponent = function()
|
||||
return function()
|
||||
return false
|
||||
end
|
||||
end,
|
||||
|
||||
hasWeapon = function(_)
|
||||
hasWeapon = function()
|
||||
return function()
|
||||
return false
|
||||
end
|
||||
@@ -198,7 +198,7 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
end
|
||||
end,
|
||||
|
||||
getWeapon = function(_)
|
||||
getWeapon = function()
|
||||
return function() end
|
||||
end,
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
local SetTimeout = SetTimeout
|
||||
local GetPlayerPed = GetPlayerPed
|
||||
local DoesEntityExist = DoesEntityExist
|
||||
local GetEntityCoords = GetEntityCoords
|
||||
local GetEntityHeading = GetEntityHeading
|
||||
|
||||
function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, weight, job, loadout, name, coords, metadata)
|
||||
local targetOverrides = Config.PlayerFunctionOverride and Core.PlayerFunctionOverrides[Config.PlayerFunctionOverride] or {}
|
||||
@@ -165,7 +162,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
if #v.components > 0 then
|
||||
local components = {}
|
||||
|
||||
for k2,component in ipairs(v.components) do
|
||||
for _, component in ipairs(v.components) do
|
||||
if component ~= 'clip_default' then
|
||||
components[#components + 1] = component
|
||||
end
|
||||
@@ -257,7 +254,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.getInventoryItem(name, metadata)
|
||||
function self.getInventoryItem(name)
|
||||
for _, v in ipairs(self.inventory) do
|
||||
if v.name == name then
|
||||
return v
|
||||
@@ -265,7 +262,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.addInventoryItem(name, count, metadata, slot)
|
||||
function self.addInventoryItem(name, count)
|
||||
local item = self.getInventoryItem(name)
|
||||
|
||||
if item then
|
||||
@@ -278,7 +275,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.removeInventoryItem(name, count, metadata, slot)
|
||||
function self.removeInventoryItem(name, count)
|
||||
local item = self.getInventoryItem(name)
|
||||
|
||||
if item then
|
||||
@@ -299,7 +296,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.setInventoryItem(name, count, metadata)
|
||||
function self.setInventoryItem(name, count)
|
||||
local item = self.getInventoryItem(name)
|
||||
|
||||
if item and count >= 0 then
|
||||
@@ -321,7 +318,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return self.maxWeight
|
||||
end
|
||||
|
||||
function self.canCarryItem(name, count, metadata)
|
||||
function self.canCarryItem(name, count)
|
||||
if ESX.Items[name] then
|
||||
local currentWeight, itemWeight = self.weight, ESX.Items[name].weight
|
||||
local newWeight = currentWeight + (itemWeight * count)
|
||||
@@ -422,7 +419,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.addWeaponAmmo(weaponName, ammoCount)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
local _, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
weapon.ammo = weapon.ammo + ammoCount
|
||||
@@ -431,7 +428,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.updateWeaponAmmo(weaponName, ammoCount)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
local _, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
weapon.ammo = ammoCount
|
||||
@@ -453,7 +450,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.getWeaponTint(weaponName)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
local _, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
return weapon.tintIndex
|
||||
@@ -469,7 +466,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
if v.name == weaponName then
|
||||
weaponLabel = v.label
|
||||
|
||||
for k2,v2 in ipairs(v.components) do
|
||||
for _,v2 in ipairs(v.components) do
|
||||
self.removeWeaponComponent(weaponName, v2)
|
||||
end
|
||||
|
||||
@@ -507,7 +504,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.removeWeaponAmmo(weaponName, ammoCount)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
local _, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
weapon.ammo = weapon.ammo - ammoCount
|
||||
@@ -516,7 +513,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.hasWeaponComponent(weaponName, weaponComponent)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
local _, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
for _, v in ipairs(weapon.components) do
|
||||
@@ -541,7 +538,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return false
|
||||
end
|
||||
|
||||
function self.hasItem(item, metadata)
|
||||
function self.hasItem(item)
|
||||
for _, v in ipairs(self.inventory) do
|
||||
if (v.name == item) and (v.count >= 1) then
|
||||
return v, v.count
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ESX.RegisterCommand('setcoords', 'admin', function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('setcoords', 'admin', function(xPlayer, args)
|
||||
xPlayer.setCoords({x = args.x, y = args.y, z = args.z})
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Set Coordinates /setcoords Triggered!", "pink", {
|
||||
@@ -76,7 +76,7 @@ ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError)
|
||||
ESX.OneSync.SpawnVehicle(args.car, playerCoords, playerHeading, upgrades, function(networkId)
|
||||
if networkId then
|
||||
local vehicle = NetworkGetEntityFromNetworkId(networkId)
|
||||
for i = 1, 20 do
|
||||
for _ = 1, 20 do
|
||||
Wait(0)
|
||||
SetPedIntoVehicle(playerPed, vehicle, -1)
|
||||
|
||||
@@ -93,7 +93,7 @@ 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, _)
|
||||
ESX.RegisterCommand({'cardel', 'dv'}, 'admin', function(xPlayer, args)
|
||||
local PedVehicle = GetVehiclePedIsIn(GetPlayerPed(xPlayer.source), false)
|
||||
if DoesEntityExist(PedVehicle) then
|
||||
DeleteEntity(PedVehicle)
|
||||
@@ -176,7 +176,7 @@ end, true, {help = TranslateCap('command_removeaccountmoney'), validate = true,
|
||||
}})
|
||||
|
||||
if not Config.OxInventory then
|
||||
ESX.RegisterCommand('giveitem', 'admin', function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('giveitem', 'admin', function(xPlayer, args)
|
||||
args.playerId.addInventoryItem(args.item, args.count)
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Give Item /giveitem Triggered!", "pink", {
|
||||
@@ -265,11 +265,11 @@ if not Config.OxInventory then
|
||||
}})
|
||||
end
|
||||
|
||||
ESX.RegisterCommand({'clear', 'cls'}, 'user', function(xPlayer, _, _)
|
||||
ESX.RegisterCommand({'clear', 'cls'}, 'user', function(xPlayer)
|
||||
xPlayer.triggerEvent('chat:clear')
|
||||
end, false, {help = TranslateCap('command_clear')})
|
||||
|
||||
ESX.RegisterCommand({'clearall', 'clsall'}, 'admin', function(xPlayer, _, _)
|
||||
ESX.RegisterCommand({'clearall', 'clsall'}, 'admin', function(xPlayer)
|
||||
TriggerClientEvent('chat:clear', -1)
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Clear Chat /clearall Triggered!", "pink", {
|
||||
@@ -279,13 +279,13 @@ ESX.RegisterCommand({'clearall', 'clsall'}, 'admin', function(xPlayer, _, _)
|
||||
end
|
||||
end, true, {help = TranslateCap('command_clearall')})
|
||||
|
||||
ESX.RegisterCommand("refreshjobs", 'admin', function(xPlayer, _, _)
|
||||
ESX.RegisterCommand("refreshjobs", 'admin', function()
|
||||
ESX.RefreshJobs()
|
||||
end, true, {help = TranslateCap('command_clearall')})
|
||||
|
||||
if not Config.OxInventory then
|
||||
ESX.RegisterCommand('clearinventory', 'admin', function(xPlayer, args, _)
|
||||
for k, v in ipairs(args.playerId.inventory) do
|
||||
ESX.RegisterCommand('clearinventory', 'admin', function(xPlayer, args)
|
||||
for _, v in ipairs(args.playerId.inventory) do
|
||||
if v.count > 0 then
|
||||
args.playerId.setInventoryItem(v.name, 0)
|
||||
end
|
||||
@@ -302,7 +302,7 @@ if not Config.OxInventory then
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args)
|
||||
for i=#args.playerId.loadout, 1, -1 do
|
||||
args.playerId.removeWeapon(args.playerId.loadout[i].name)
|
||||
end
|
||||
@@ -319,7 +319,7 @@ if not Config.OxInventory then
|
||||
}})
|
||||
end
|
||||
|
||||
ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args)
|
||||
if not args.playerId then args.playerId = xPlayer.source end
|
||||
if args.group == "superadmin" then args.group = "admin" print("[^3WARNING^7] ^5Superadmin^7 detected, setting group to ^5admin^7") end
|
||||
args.playerId.setGroup(args.group)
|
||||
@@ -336,32 +336,31 @@ end, true, {help = TranslateCap('command_setgroup'), validate = true, arguments
|
||||
{name = 'group', help = TranslateCap('command_setgroup_group'), type = 'string'},
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('save', 'admin', function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('save', 'admin', function(_, args)
|
||||
Core.SavePlayer(args.playerId)
|
||||
print("[^2Info^0] Saved Player - ^5".. args.playerId.source .. "^0")
|
||||
end, true, {help = TranslateCap('command_save'), validate = true, arguments = {
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('saveall', 'admin', function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('saveall', 'admin', function()
|
||||
Core.SavePlayers()
|
||||
end, true, {help = TranslateCap('command_saveall')})
|
||||
|
||||
ESX.RegisterCommand('group', {"user", "admin"}, function(xPlayer, _, _)
|
||||
ESX.RegisterCommand('group', {"user", "admin"}, function(xPlayer)
|
||||
print(xPlayer.getName()..", You are currently: ^5".. xPlayer.getGroup() .. "^0")
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('job', {"user", "admin"}, function(xPlayer, _, _)
|
||||
ESX.RegisterCommand('job', {"user", "admin"}, function(xPlayer)
|
||||
print(xPlayer.getName()..", You are currently: ^5".. xPlayer.getJob().name.. "^0 - ^5".. xPlayer.getJob().grade_label .. "^0")
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('info', {"user", "admin"}, function(xPlayer, _, _)
|
||||
ESX.RegisterCommand('info', {"user", "admin"}, function(xPlayer)
|
||||
local job = xPlayer.getJob().name
|
||||
local jobgrade = xPlayer.getJob().grade_name
|
||||
print("^2ID : ^5"..xPlayer.source.." ^0| ^2Name:^5"..xPlayer.getName().." ^0 | ^2Group:^5"..xPlayer.getGroup().."^0 | ^2Job:^5".. job.."^0")
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('coords', "admin", function(xPlayer, _, _)
|
||||
ESX.RegisterCommand('coords', "admin", function(xPlayer)
|
||||
local ped = GetPlayerPed(xPlayer.source)
|
||||
local coords = GetEntityCoords(ped, false)
|
||||
local heading = GetEntityHeading(ped)
|
||||
@@ -369,7 +368,7 @@ ESX.RegisterCommand('coords', "admin", function(xPlayer, _, _)
|
||||
print("Coords - Vector4: ^5".. vector4(coords.x, coords.y, coords.z, heading) .. "^0")
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('tpm', "admin", function(xPlayer, _, _)
|
||||
ESX.RegisterCommand('tpm', "admin", function(xPlayer)
|
||||
xPlayer.triggerEvent("esx:tpm")
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Admin Teleport /tpm Triggered!", "pink", {
|
||||
@@ -379,7 +378,7 @@ ESX.RegisterCommand('tpm', "admin", function(xPlayer, _, _)
|
||||
end
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('goto', "admin", function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('goto', "admin", function(xPlayer, args)
|
||||
local targetCoords = args.playerId.getCoords()
|
||||
xPlayer.setCoords(targetCoords)
|
||||
if Config.AdminLogging then
|
||||
@@ -394,7 +393,8 @@ end, true, {help = TranslateCap('command_goto'), validate = true, arguments = {
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('bring', "admin", function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('bring', "admin", function(xPlayer, args)
|
||||
local targetCoords = args.playerId.getCoords()
|
||||
local playerCoords = xPlayer.getCoords()
|
||||
args.playerId.setCoords(playerCoords)
|
||||
if Config.AdminLogging then
|
||||
@@ -409,7 +409,7 @@ end, true, {help = TranslateCap('command_bring'), validate = true, arguments = {
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('kill', "admin", function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('kill', "admin", function(xPlayer, args)
|
||||
args.playerId.triggerEvent("esx:killPlayer")
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Kill Command /kill Triggered!", "pink", {
|
||||
@@ -422,7 +422,7 @@ end, true, {help = TranslateCap('command_kill'), validate = true, arguments = {
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('freeze', "admin", function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('freeze', "admin", function(xPlayer, args)
|
||||
args.playerId.triggerEvent('esx:freezePlayer', "freeze")
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Admin Freeze /freeze Triggered!", "pink", {
|
||||
@@ -435,7 +435,7 @@ end, true, {help = TranslateCap('command_freeze'), validate = true, arguments =
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('unfreeze', "admin", function(xPlayer, args, _)
|
||||
ESX.RegisterCommand('unfreeze', "admin", function(xPlayer, args)
|
||||
args.playerId.triggerEvent('esx:freezePlayer', "unfreeze")
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Admin UnFreeze /unfreeze Triggered!", "pink", {
|
||||
@@ -448,7 +448,7 @@ end, true, {help = TranslateCap('command_unfreeze'), validate = true, arguments
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand("noclip", 'admin', function(xPlayer, _, _)
|
||||
ESX.RegisterCommand("noclip", 'admin', function(xPlayer)
|
||||
xPlayer.triggerEvent('esx:noclip')
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Admin NoClip /noclip Triggered!", "pink", {
|
||||
@@ -458,10 +458,10 @@ ESX.RegisterCommand("noclip", 'admin', function(xPlayer, _, _)
|
||||
end
|
||||
end, false)
|
||||
|
||||
ESX.RegisterCommand('players', "admin", function(xPlayer, _, _)
|
||||
ESX.RegisterCommand('players', "admin", function()
|
||||
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
|
||||
|
||||
@@ -42,7 +42,7 @@ MySQL.ready(function()
|
||||
Core.DatabaseConnected = true
|
||||
if not Config.OxInventory then
|
||||
local items = MySQL.query.await('SELECT * FROM items')
|
||||
for k, v in ipairs(items) do
|
||||
for _, v in ipairs(items) do
|
||||
ESX.Items[v.name] = {label = v.label, weight = v.weight, rare = v.rare, canRemove = v.can_remove}
|
||||
end
|
||||
else
|
||||
|
||||
@@ -6,7 +6,7 @@ end
|
||||
|
||||
function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
if type(name) == 'table' then
|
||||
for k, v in ipairs(name) do
|
||||
for _, v in ipairs(name) do
|
||||
ESX.RegisterCommand(v, group, cb, allowConsole, suggestion)
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
|
||||
Core.RegisteredCommands[name] = {group = group, cb = cb, allowConsole = allowConsole, suggestion = suggestion}
|
||||
|
||||
RegisterCommand(name, function(playerId, args, rawCommand)
|
||||
RegisterCommand(name, function(playerId, args)
|
||||
local command = Core.RegisteredCommands[name]
|
||||
|
||||
if not command.allowConsole and playerId == 0 then
|
||||
@@ -143,7 +143,7 @@ function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
end, true)
|
||||
|
||||
if type(group) == 'table' then
|
||||
for k, v in ipairs(group) do
|
||||
for _, v in ipairs(group) do
|
||||
ExecuteCommand(('add_ace group.%s command.%s allow'):format(v, name))
|
||||
end
|
||||
else
|
||||
@@ -248,7 +248,7 @@ function ESX.GetIdentifier(playerId)
|
||||
if fxDk == 1 then
|
||||
return "ESX-DEBUG-LICENCE"
|
||||
end
|
||||
for k, v in ipairs(GetPlayerIdentifiers(playerId)) do
|
||||
for _, v in ipairs(GetPlayerIdentifiers(playerId)) do
|
||||
if string.match(v, 'license:') then
|
||||
local identifier = string.gsub(v, 'license:', '')
|
||||
return identifier
|
||||
@@ -341,7 +341,7 @@ function ESX.CreateJob(name, label, grades)
|
||||
local parameters = {}
|
||||
local job = {name = name, label = label, grades = {}}
|
||||
|
||||
for k,v in pairs(grades) do
|
||||
for _,v in pairs(grades) do
|
||||
job.grades[tostring(v.grade)] = {job_name = name, grade = v.grade, name = v.name, label = v.label, salary = v.salary, skin_male = {}, skin_female = {}}
|
||||
parameters[#parameters + 1] = { name, v.grade, v.name, v.label, v.salary}
|
||||
end
|
||||
|
||||
@@ -92,7 +92,7 @@ function createESXPlayer(identifier, playerId, data)
|
||||
end
|
||||
|
||||
if not Config.Multichar then
|
||||
AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
AddEventHandler('playerConnecting', function(_, _, deferrals)
|
||||
deferrals.defer()
|
||||
local playerId = source
|
||||
local identifier = ESX.GetIdentifier(playerId)
|
||||
@@ -364,7 +364,7 @@ function loadESXPlayer(identifier, playerId, isNew)
|
||||
end
|
||||
|
||||
|
||||
AddEventHandler('chatMessage', function(playerId, author, message)
|
||||
AddEventHandler('chatMessage', function(playerId, _, message)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
if message:sub(1, 1) == '/' and playerId > 0 then
|
||||
CancelEvent()
|
||||
@@ -464,7 +464,7 @@ if not Config.OxInventory then
|
||||
targetXPlayer.setWeaponTint(itemName, weaponTint)
|
||||
end
|
||||
if weaponComponents then
|
||||
for k, v in pairs(weaponComponents) do
|
||||
for _, v in pairs(weaponComponents) do
|
||||
targetXPlayer.addWeaponComponent(itemName, v)
|
||||
end
|
||||
end
|
||||
@@ -486,7 +486,7 @@ if not Config.OxInventory then
|
||||
end
|
||||
elseif type == 'item_ammo' then
|
||||
if sourceXPlayer.hasWeapon(itemName) then
|
||||
local weaponNum, weapon = sourceXPlayer.getWeapon(itemName)
|
||||
local _, weapon = sourceXPlayer.getWeapon(itemName)
|
||||
|
||||
if targetXPlayer.hasWeapon(itemName) then
|
||||
local _, weaponObject = ESX.GetWeapon(itemName)
|
||||
@@ -604,7 +604,7 @@ if not Config.OxInventory then
|
||||
xPlayer.addWeapon(pickup.name, pickup.count)
|
||||
xPlayer.setWeaponTint(pickup.name, pickup.tintIndex)
|
||||
|
||||
for k, v in ipairs(pickup.components) do
|
||||
for _, v in ipairs(pickup.components) do
|
||||
xPlayer.addWeaponComponent(pickup.name, v)
|
||||
end
|
||||
end
|
||||
@@ -629,11 +629,11 @@ ESX.RegisterServerCallback('esx:isUserAdmin', function(source, cb)
|
||||
cb(Core.IsPlayerAdmin(source))
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx:getGameBuild', function(source, cb)
|
||||
ESX.RegisterServerCallback('esx:getGameBuild', function(_, cb)
|
||||
cb(tonumber(GetConvar("sv_enforceGameBuild", 1604)))
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx:getOtherPlayerData', function(source, cb, target)
|
||||
ESX.RegisterServerCallback('esx:getOtherPlayerData', function(_, cb, target)
|
||||
local xPlayer = ESX.GetPlayerFromId(target)
|
||||
|
||||
cb({identifier = xPlayer.identifier, accounts = xPlayer.getAccounts(), inventory = xPlayer.getInventory(), job = xPlayer.getJob(),
|
||||
@@ -643,7 +643,7 @@ end)
|
||||
ESX.RegisterServerCallback('esx:getPlayerNames', function(source, cb, players)
|
||||
players[source] = nil
|
||||
|
||||
for playerId, v in pairs(players) do
|
||||
for playerId, _ in pairs(players) do
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
if xPlayer then
|
||||
|
||||
@@ -167,7 +167,7 @@ function ESX.OneSync.GetVehiclesInArea(coords, maxDistance, modelFilter)
|
||||
end
|
||||
|
||||
local function getClosestEntity(entities, coords, modelFilter, isPed)
|
||||
local distance, closestEntity, closestCoords = maxDistance or 100, nil, nil
|
||||
local distance, closestEntity, closestCoords = 100, nil, nil
|
||||
coords = type(coords) == 'number' and GetEntityCoords(GetPlayerPed(coords)) or vector3(coords.x, coords.y, coords.z)
|
||||
|
||||
for _, entity in pairs(entities) do
|
||||
@@ -205,6 +205,6 @@ function ESX.OneSync.GetClosestVehicle(coords, modelFilter)
|
||||
return getClosestEntity(GetAllVehicles(), coords, modelFilter)
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback("esx:Onesync:SpawnObject", function(source, cb, model, coords, heading)
|
||||
ESX.RegisterServerCallback("esx:Onesync:SpawnObject", function(_, cb, model, coords, heading)
|
||||
ESX.OneSync.SpawnObject(model, coords, heading, cb)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user