Added invalid command handler

This commit is contained in:
ElPumpo
2020-03-09 13:05:33 +01:00
parent 7efcf85abb
commit e0d561649b
9 changed files with 16 additions and 0 deletions
+8
View File
@@ -193,6 +193,14 @@ function loadESXPlayer(identifier, playerId)
end)
end
AddEventHandler('chatMessage', function(playerId, author, message)
if message:sub(1, 1) == '/' and playerId > 0 then
CancelEvent()
local commandName = message:sub(1):gmatch("%w+")()
TriggerClientEvent('chat:addMessage', playerId, {args = {'^1SYSTEM', _U('commanderror_invalidcommand', commandName)}})
end
end)
AddEventHandler('playerDropped', function(reason)
local playerId = source
local xPlayer = ESX.GetPlayerFromId(playerId)