mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 23:01:26 +00:00
Merge pull request #1852 from seltonmt012/fix/console-commands-nil-xplayer
fix(es_extended/server/modules/commands): stop console commands from throwing on a missing xPlayer
This commit is contained in:
@@ -184,9 +184,11 @@ ESX.RegisterCommand(
|
||||
return
|
||||
end
|
||||
xTarget.triggerEvent("esx:repairPedVehicle")
|
||||
xPlayer.showNotification(TranslateCap("command_repair_success"), true, false, 140)
|
||||
if xPlayer.source ~= xTarget.source then
|
||||
xTarget.showNotification(TranslateCap("command_repair_success_target"), true, false, 140)
|
||||
if xPlayer then
|
||||
xPlayer.showNotification(TranslateCap("command_repair_success"))
|
||||
end
|
||||
if not xPlayer or xPlayer.source ~= xTarget.source then
|
||||
xTarget.showNotification(TranslateCap("command_repair_success_target"))
|
||||
end
|
||||
if Config.AdminLogging then
|
||||
ESX.DiscordLogFields("UserActions", "Fix Vehicle /fix Triggered!", "pink", {
|
||||
@@ -451,7 +453,11 @@ if not Config.CustomInventory then
|
||||
ESX.RegisterCommand("refreshitems", FilterGroups(CommandPermissions.refreshitems), function(xPlayer)
|
||||
local itemCount = ESX.RefreshItems()
|
||||
|
||||
xPlayer.showNotification(Translate("command_refreshitems_success", itemCount), true, false, 140)
|
||||
if xPlayer then
|
||||
xPlayer.showNotification(Translate("command_refreshitems_success", itemCount))
|
||||
else
|
||||
print(("[^2INFO^7] %s^7"):format(Translate("command_refreshitems_success", itemCount)))
|
||||
end
|
||||
end, true, { help = TranslateCap("command_refreshitems") })
|
||||
|
||||
ESX.RegisterCommand(
|
||||
@@ -564,7 +570,7 @@ end, true, { help = TranslateCap("command_saveall") })
|
||||
|
||||
ESX.RegisterCommand("group", FilterGroups(CommandPermissions.group), function(xPlayer, _, _)
|
||||
print(("%s, you are currently: ^5%s^0"):format(xPlayer.getName(), xPlayer.getGroup()))
|
||||
end, true)
|
||||
end, false)
|
||||
|
||||
ESX.RegisterCommand("job", FilterGroups(CommandPermissions.job), function(xPlayer, _, _)
|
||||
local job = xPlayer.getJob()
|
||||
|
||||
Reference in New Issue
Block a user