PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: BlazeXxX on 29 November, 2003, 02:34:08

Title: Help with VIPChat pls!
Post by: BlazeXxX on 29 November, 2003, 02:34:08
Hi all,
Klownietklowniet wrote a vipchat script for my hub, and what i am neding is.. i need two scripts out of this..

One i want this script to accept all these type of profiles:

Master - 0
Operator - 1
VIP - 2
Reg - 3
Moderator - 4

I want everyone else to access that chat and read/write in there except these ppl: Regiserd users, unregged users.. So in other words all Master,Operator,VIP & Moderator.. They all should be able to use that VIPchat..

Second request is:

I just want Master & Moderator accessing the chat only.. Like a SU Chat but i want mods also to participate.. So profil 0 and 4 shud only access this one as i want ops to use opchat and mods,masters to use this chat..

I know its pretty simple for the genius here :) Here is the original script..

Byee,
BlazeX

-- Date: 01-09-2003
--
-- code from klownietklowniet
-- network: [ > DC - UniteD < ]
--
-- Request by peter
--
-- A simple SU (Master) chat
-- 02-09-2003: changed the script abit so all (VIPs, OPs and SUs) can chat. (Request by BlazeXXX)


BotName = "VIP-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 and (curUser.iProfile>=0 and curUser.iProfile<=3) then
local sus=GetUsersByProfile("Master")
local ops=GetUsersByProfile("Operator")
local vips=GetUsersByProfile("VIP")

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

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: BlazeXxX on 30 November, 2003, 03:54:18
its ok, i fixed it my self :) thx anyways...