Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function chatCommand(oPlayer, sText, bTeam)
- local tText = string.Explode(' ', string.lower(sText))
- // Not a command, let it through
- if string.Left(tText[1], 1) != '!' then return sText end
- // Remove the ! infront of the first word
- local sCmd = string.sub(tText[1], 2)
- if sCmd == 'help' then
- local tChat = {}
- // This is how you would add colors
- //table.insert(tChat, Color(255, 255, 255))
- table.insert(tChat, 'Avaiable commands: !help, !love, !ping, !admin, !who')
- chat.AddText(tChat)
- // Suppress the chat message
- return ''
- end
- if sCmd == 'ping' then
- local tChat = {}
- //table.insert(tChat, Color(255, 255, 255))
- table.insert(tChat, 'Pong!')
- chat.AddText(tChat)
- return ''
- end
- if sCmd == 'admin' then
- local tChat = {}
- //table.insert(tChat, Color(255, 255, 255))
- table.insert(tChat, 'Any administrator is on their way.')
- chat.AddText(tChat)
- return ''
- end
- if sCmd == 'who' then
- local tChat = {}
- //table.insert(tChat, Color(255, 255, 255))
- table.insert(tChat, 'Please check console for a list of players.')
- chat.AddText(tChat)
- for iKey, oPlayer in ipairs(player.GetHumans()) do
- print(oPlayer)
- end
- return ''
- end
- if sCmd == 'love' then
- local tChat = {}
- //table.insert(tChat, Color(255, 255, 255))
- table.insert(tChat, 'I Love You KEVIN!')
- chat.AddText(tChat)
- return ''
- end
- // You can add more commands by mimicing the if blocks above
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement