fix(server): attempt to index a nil value (local 'xPlayer')

This commit is contained in:
someone
2024-07-25 18:57:00 +02:00
committed by GitHub
parent c80916c3e3
commit 3fd59f0f3b
+1 -1
View File
@@ -302,7 +302,7 @@ end
AddEventHandler("chatMessage", function(playerId, _, message)
local xPlayer = ESX.GetPlayerFromId(playerId)
if message:sub(1, 1) == "/" and playerId > 0 then
if xPlayer and message:sub(1, 1) == "/" and playerId > 0 then
CancelEvent()
local commandName = message:sub(1):gmatch("%w+")()
xPlayer.showNotification(TranslateCap("commanderror_invalidcommand", commandName))