mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
tweak: es_extended - code cleanup
This commit is contained in:
@@ -5,7 +5,7 @@ ESX.PlayerLoaded = false
|
||||
Core.CurrentRequestId = 0
|
||||
Core.ServerCallbacks = {}
|
||||
Core.TimeoutCallbacks = {}
|
||||
ESX.Input = {}
|
||||
Core.Input = {}
|
||||
ESX.UI = {}
|
||||
ESX.UI.HUD = {}
|
||||
ESX.UI.HUD.RegisteredElements = {}
|
||||
@@ -177,7 +177,7 @@ end
|
||||
|
||||
ESX.RegisterInput = function(command_name, label, input_group, key, on_press, on_release)
|
||||
RegisterCommand(on_release ~= nil and "+" .. command_name or command_name, on_press)
|
||||
ESX.Input[command_name] = on_release ~= nil and ESX.HashString("+" .. command_name) or ESX.HashString(command_name)
|
||||
Core.Input[command_name] = on_release ~= nil and ESX.HashString("+" .. command_name) or ESX.HashString(command_name)
|
||||
if on_release then
|
||||
RegisterCommand("-" .. command_name, on_release)
|
||||
end
|
||||
@@ -188,12 +188,7 @@ function ESX.TriggerServerCallback(name, cb, ...)
|
||||
Core.ServerCallbacks[Core.CurrentRequestId] = cb
|
||||
|
||||
TriggerServerEvent('esx:triggerServerCallback', name, Core.CurrentRequestId, ...)
|
||||
|
||||
if Core.CurrentRequestId < 65535 then
|
||||
Core.CurrentRequestId = Core.CurrentRequestId + 1
|
||||
else
|
||||
Core.CurrentRequestId = 0
|
||||
end
|
||||
Core.CurrentRequestId = Core.CurrentRequestId < 65535 and Core.CurrentRequestId + 1 or 0
|
||||
end
|
||||
|
||||
function ESX.UI.HUD.SetDisplay(opacity)
|
||||
|
||||
@@ -142,7 +142,7 @@ end
|
||||
|
||||
ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args, showError)
|
||||
if not args.playerId then args.playerId = xPlayer.source end
|
||||
if args.group == "superadmin" then args.group = "admin" end
|
||||
if args.group == "superadmin" then args.group = "admin" print("[^3WARNING^7] Superadmin detected, setting group to admin") end
|
||||
args.playerId.setGroup(args.group)
|
||||
end, true, {help = _U('command_setgroup'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
|
||||
|
||||
@@ -52,7 +52,7 @@ function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
if not command.allowConsole and playerId == 0 then
|
||||
print(('[^3WARNING^7] ^5%s'):format(_U('commanderror_console')))
|
||||
else
|
||||
local xPlayer, error = ESX.GetPlayerFromId(playerId), nil
|
||||
local xPlayer, error = ESX.Players[playerId], nil
|
||||
|
||||
if command.suggestion then
|
||||
if command.suggestion.validate then
|
||||
@@ -365,7 +365,7 @@ end
|
||||
if not Config.OxInventory then
|
||||
function ESX.CreatePickup(type, name, count, label, playerId, components, tintIndex)
|
||||
local pickupId = (Core.PickupId == 65635 and 0 or Core.PickupId + 1)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
local xPlayer = ESX.Players[playerId]
|
||||
local coords = xPlayer.getCoords()
|
||||
|
||||
Core.Pickups[pickupId] = {
|
||||
@@ -401,7 +401,7 @@ function Core.IsPlayerAdmin(playerId)
|
||||
return true
|
||||
end
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
local xPlayer = ESX.Players[playerId]
|
||||
|
||||
if xPlayer then
|
||||
if xPlayer.group == 'admin' then
|
||||
|
||||
@@ -224,6 +224,7 @@ function loadESXPlayer(identifier, playerId, isNew)
|
||||
if result.group then
|
||||
if result.group == "superadmin" then
|
||||
userData.group = "admin"
|
||||
print("[^3WARNING^7] Superadmin detected, setting group to admin")
|
||||
else
|
||||
userData.group = result.group
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user