All pastes #1240009 Raw Edit

Mine

public text v1 · immutable
#1240009 ·published 2008-10-29 21:30 UTC
rendered paste body
AskMe = {}
--commands table keep them lowercase for simplicty
AskMe.things = {
'help', --request == 1
'rules', --request == 2
'general', --request == 3
}
function AskMe.MightDo(dothis)
local cando = false
local willdo = 0
for i, v in ipairs(AskMe.things) do
if dothis:match(v) then
cando = true
willdo = i
end
end
if cando then
return willdo
else
return 0
end
end
function AskMe:OnEvent(event, msg)
local amsg = string.lower(msg)
AskMe.Doing(AskMe.MightDo(amsg), msg.name)
 
end
function AskMe.Doing(request, name)
if request = 0 then
--Command not found!
elseif request == 1 then
SendChat("This is help", "PRIVATE", name)
 
elseif request == 2 then
SendChat("This is rules", "PRIVATE", name)
 
elseif request == 3 then
SendChat("This is general", "PRIVATE", name)
end
RegisterEvent(AskMe, "CHAT_MSG_PRIVATE")