Try something like this.
-- NOTE This code is not tested and may need to be edited to work properly.
local symbol = '/'
local commands = {
'help',
'commands'
}
addEventHandler('onPlayerChat',root,function(message)
local textTable = split(message,' ')
for k=1,#textTable do
for l=1,#commands do
if textTable[1] == symbol..commands[l] then
table.remove(textTable,1)
triggerEvent(commands[l],root,source,textTable)
end
end
end
end)
for i=1,#commands do
addEvent(commands[i])
end
addEventHandler('help',root,function(source,payload)
outputChatBox('Use /commands for a list of commands.',source)
end)
addEventHandler('commands',root,function(source,payload)
outputChatBox('Commands: '..table.concat(commands,', '),source)
end)