PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: kepp on 15 November, 2003, 03:08:05

Title: VIP Or Reg chat
Post by: kepp on 15 November, 2003, 03:08:05
Could anyone make a VERY simple chatbot for VIP's or Regs, dosen't matter! :D
Title:
Post by: RiPOFF on 15 November, 2003, 07:11:41
i have one you want it?
Title:
Post by: kepp on 15 November, 2003, 14:02:15
If it is a very simple one sure! :D
Title:
Post by: turkiye on 15 November, 2003, 14:04:11
yeah its very simple
Title:
Post by: kepp on 16 November, 2003, 18:11:20
If it so simple then where is it ? ;)
Title:
Post by: RiPOFF on 17 November, 2003, 05:41:57
--
-- Creator: klownietklowniet
-- Network: [ > DC - UniteD < ]
--
-- Editor: R?P?FF?
-- Network:?In?a??? ??tw??x? An ?nd?rGr?und? ??tw??k Subnet
--
-- Request by Peter
--
-- Edits by R?P?FF? & klownietklowniet
--
-- A VIP and Higher chat
-- 02-09-2003: klownietklowniet changed the script abit so all (VIPs, OPs and SUs) can chat. (Request by BlazeXXX)
-- 19-10-2003: R?P?FF? added the (Reg) & (SuperOp) profile in it so now regs & sops are included in script.
-- 19-10-2003: klownietklowniet added a message so when non reg users pm it, it will respond and act on the message
-- "This chat is for registered users only. Your message has not been sent." (Request by R?P?FF?)


BotName = ".:ReGs~OnLy.ChAt:."


function Main()
frmHub:RegBot(BotName)
end


function DataArrival(curUser,data)

local MessageRecognized = 0

if isPM(data)==1 then
whoto,from,message=ParsePM(data)
MessageRecognized=1
end

if MessageRecognized==1 and whoto==BotName then
if (curUser.iProfile>=0 and curUser.iProfile<=4) then
local sus=GetUsersByProfile("Master")
local sops=GetUsersByProfile("SuperOp")
local ops=GetUsersByProfile("Operator")
local vips=GetUsersByProfile("VIP")
local regs=GetUsersByProfile("Reg")

for i, n in sops do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end

for i, n in sus do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end

for i, n in ops do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end

for i, n in vips do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end

for i, n in regs do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
else
curUser:SendPM(BotName, "This chat is for registered users only. Your message has not been sent.")
end
end
end


function ParsePM(data)
s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
message = strsub(message,1,strlen(message)-1)
return whoTo,from,message
end


function isPM(data)
if( strsub(data, 1, 3) == "$To" ) then
return 1
else
return 0
end
end
Title:
Post by: kepp on 17 November, 2003, 09:45:08
Thanks