PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: qaz on 23 June, 2005, 02:44:14

Title: Can someboy shrink this script
Post by: qaz on 23 June, 2005, 02:44:14
(first, iam sorry for bad topic :( )

http://board.univ-angers.fr/thread.php?threadid=4187&boardid=26&sid=c219552736fd0e4b64d765fcdba756c9

the only thing i need from this awesome script is Mass Message to all... so can somebody shrink this script to fit my purpose.

Thanks for your help ?(
Title:
Post by: bastya_elvtars on 23 June, 2005, 03:07:03
Will this do?

-- QDM (quick-and-dirty mass) by bastya_elvtars

masscmd="massmess" -- no ! needed

Bot="LawMakerBornAgain" -- use your hub bot's name

masslev=4 -- 1: all, 2: reg & above, 3: vip & above, 4: op & su, 5: su only

------------------------------------------------------------------------------------

userlevels={ [-1] = 1, [0] = 5, [1] = 4, [2] = 3, [3] = 2 } -- rights management, no need to edit unless you use robo


-- do not edit below
function massmsg(user,data,env)
local _,_,message=string.find(data,"%b<>%s+%S+%s+(.+)")
if message then
for _,obj in frmHub:GetOnlineUsers() do
obj:SendData("$To: "..obj.sName.." From: "..Bot.." $<"..user.sName.."> "..message)
end
else
SendTxt(user,env,Bot,"Please write the message too, im not a politician to keep telling nothing...=)")
end
end

function ChatArrival(user,data)
  data=string.sub(data,1,string.len(data)-1)
  local _,_,cmd=string.find(data,"%b<>%s+[%!%+%#](%S+)")
  if cmd==masscmd then
    if userlevels[user.iProfile]>=masslev then
      massmsg(user,data,"MAIN")
    else
      SendTxt(user,env,Bot,"You are not allowed...")
    end
    return 1
  end
end

function SendTxt(user,env,bot,text)
if env=="PM" then
user:SendPM(bot,text)
else
user:SendData(bot,text)
end
end

function Main()
  frmHub:RegBot(Bot)
end
Title:
Post by: qaz on 23 June, 2005, 03:32:15
Works perfect, thank you bastya... you are allmost my personal hero  :P