PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: angelsanges on 22 February, 2004, 13:46:29

Title: !inform
Post by: angelsanges on 22 February, 2004, 13:46:29
it's possible to do a bot that with a command !inform   sends a message to a user trought bot ....example:

message from OP: hello!

 ;)
Title:
Post by: kepp on 22 February, 2004, 14:34:37
Fast one..
sBot = "Botname"

function DataArrival(user, data)
   if strsub(data,1,1)=="<" then
   data=strsub(data,1,strlen(data)-1)
   local s,e,cmd,who,msg=strfind(data,"%b<>%s+(%S+)%s+(%S+)%s*(.*)")
      if (cmd=="!inform") then
         if user.bOperator then
         local victim = GetItemByName(who)
            if victim == nil then
               user:SendData(sBot,"*** "..who.." is not in the hub.") return 1
        else
               victim:SendPM(sBot,"Message from OP: "..msg)
               user:SendData(sBot,"Message was sent to "..victim.sName) return 1
            end
         end
      end
   end
end

Title:
Post by: angelsanges on 22 February, 2004, 20:42:25
QuoteOriginally posted by kepp
Fast one..
sBot = "Botname"

function DataArrival(user, data)
   if strsub(data,1,1)=="<" then
   data=strsub(data,1,strlen(data)-1)
   local s,e,cmd,who,msg=strfind(data,"%b<>%s+(%S+)%s+(%S+)%s*(.*)")
      if (cmd=="!inform") then
         if user.bOperator then
         local victim = GetItemByName(who)
            if victim == nil then
               user:SendData(sBot,"*** "..who.." is not in the hub.") return 1
        else
               victim:SendPM(sBot,"Message from OP: "..msg)
               user:SendData(sBot,"Message was sent to "..victim.sName) return 1
            end
         end
      end
   end
end



uhm... nice bot!...it is possible to add the name of the OP ?

example:  Message from : hello!