PtokaX forum

Development Section => HOW-TO's => HOW-TO requests => Topic started by: ?Tr??T_???? on 21 July, 2005, 00:32:24

Title: own commands
Post by: ?Tr??T_???? on 21 July, 2005, 00:32:24
hello
how do i do my own commands like:
!about
Title: thanx
Post by: ?Tr??T_???? on 21 July, 2005, 01:04:48
I know how to..... :D
Title:
Post by: Tw?sT?d-d?v on 21 July, 2005, 07:15:45
ok thx Mutor :D
Title:
Post by: Stravides on 18 August, 2005, 23:46:36
Ok, using ptokax 0.3.3.0 as I need to allow RMDC++ clients --- :)

I would like to be able to change my scripts to follow the following methodology...
function CheckBanIP(user,data)

end

function FilterCommand(user,data)

end


tblCommands = {
   ["!ban"] = function(user,data) CheckBanIP(user,data) end,
   ["!banip"] = function(user,data) CheckBanIP(user,data) end,
   ["!addreguser"] = function(user,data) FilterCommand(user,data) end,
   ["!delreguser"] = function(user,data) FilterCommand(user,data) end

}

function DataArrival(user, data)
   local s, e, sCommand = strfind(data, "^(%S+)";
   if sCommand and tblCommands[sCommand] then
      local returndata = tblCommands[sCommand](user,data);
   end
end

problem being is that the script does not run (even if I change toe strfind to a string.find

also want to be able to specify tblCommands[sCommand] (optional variables here)

how do I do that ???

many thanks
Title:
Post by: bastya_elvtars on 19 August, 2005, 00:24:22
s,e,cmd=strfind(data,"%b<>%s+(%S+)")
Title:
Post by: Dessamator on 19 August, 2005, 09:33:24
Well, that seems like zrightclicker in lua4, that said, just have a look at it, maybe it can help you .