mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
feat: Added ChatEvent handler to server/events.lua
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
-- Event Handler
|
||||
|
||||
AddEventHandler('chatMessage', function(source, _, message)
|
||||
local src = source
|
||||
if string.sub(message, 1, 1) ~= '/' then return end
|
||||
local args = QBCore.Shared.SplitStr(message, ' ')
|
||||
local command = string.gsub(args[1]:lower(), '/', '')
|
||||
CancelEvent()
|
||||
if not QBCore.Commands.List[command] then return end
|
||||
table.remove(args, 1)
|
||||
QBCore.Commands.List[command].callback(src, args)
|
||||
end)
|
||||
|
||||
AddEventHandler('playerDropped', function()
|
||||
local src = source
|
||||
if not QBCore.Players[src] then return end
|
||||
|
||||
Reference in New Issue
Block a user