Merge pull request #1384 from someone005/main

fix(server): attempt to index a nil value (local 'xPlayer')
This commit is contained in:
Gellipapa
2024-07-26 20:37:54 +02:00
committed by GitHub
+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))