PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: WickeD on 21 January, 2004, 14:16:54

Title: Help whit - Vip-Chat!
Post by: WickeD on 21 January, 2004, 14:16:54
Can any one help me write this script so only Vip can write in the chat and not Master, OP, Reg, User!  Master, OP, Reg, User will get this massage if eny of them try to write in the chat:  "This chat is for Hub-Vip only. Your message has not been sent."


Help my plz!

//WickeD
Title: =) This is the script i need help whit!
Post by: WickeD on 21 January, 2004, 14:22:08
------------------------------------------------------------------------
-- 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 = "[NorthSide]?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 then
if (curUser.iProfile>=0 and curUser.iProfile<=4) then
local vips=GetUsersByProfile("VIP")

for i, n in vips do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
else
curUser:SendPM(BotName, "This chat is for Hub-Vip 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

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

//WickeD
Title:
Post by: SaintSinner on 21 January, 2004, 15:24:42
try this
I hope your Vip profile # is default
i modified the Mastersonlychat script im learning on
i just removed the masters and ops from the table and added the vips, and added the message you wanted.
my Vips can chat without anyone else seeing it,


-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.


function Main()
VipChat = "VipChat"
frmHub:RegBot(VipChat)
end


Levels= { [4]=0, }
------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == VipChat then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendData(VipChat, "That chat is for Hub-Vip only. Your message has not been sent.")

end
end
end
end


function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..VipChat.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end





 

plop, phatty, NL, did i go in the right direction, can you see anything wrong.
Title:
Post by: ????L?F?? on 21 January, 2004, 15:28:56
you made two threads? and again, i personally wouldnt use a script by ripoff ^^
Title: Hi....!
Post by: WickeD on 21 January, 2004, 15:50:40
Thx!...SaintSinner.  =)        And sorry ????L?F???? !  =(

//WickeD
Title: Hi...SaintSinner!
Post by: WickeD on 21 January, 2004, 16:02:48
Gr8 script m8!  =)


Plz can you help me whit this to?

The massage: That chat is for Hub-Vip only. Your message has not been sent.... show?s in mainchat....can you write the script so the massage show?s in Vipchat window?

And make a same script but only for OP, Master?

I dont wont OP, Master to speak in to same chat as Vip are!

//WickeD
Title:
Post by: ????L?F?? on 21 January, 2004, 16:15:02
well maby the scipts attitude is better then ripoffs

kinda glad he left ^^ he was such a hassel
Title:
Post by: SaintSinner on 21 January, 2004, 16:33:01
QuoteOriginally posted by WickeD
Gr8 script m8!  =)


Plz can you help me whit this to?

The massage: That chat is for Hub-Vip only. Your message has not been sent.... show?s in mainchat....can you write the script so the massage show?s in Vipchat window?

And make a same script but only for OP, Master?

I dont wont OP, Master to speak in to same chat as Vip are!

//WickeD

no problem i am happy to help,
thanks should go to plop, phatty, nightlitch for the help.
give me a few min to fix it, it should be easy for the other ones you want, should be just a copy and paste thing, can you post your profiles.dat.
Title:
Post by: WickeD on 21 January, 2004, 16:41:04
It this what you want SaintSinner?

0|Master|11111111111111111111000000000000
1|Operator|11111111111111111111000000000000
2|VIP|10000000000000000000000000000000
3|Reg|10000000000000000000000000000000

If not! Can you tell me were i can get my profiles.dat?

//WickeD
Title:
Post by: SaintSinner on 21 January, 2004, 16:56:10
yup thats it,
ok so your vip index level is 2

here is the fixed vip with the pm in the vipchat


-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.




function Main()
VipChat = "VipChat"
frmHub:RegBot(VipChat)
end
Levels= { [2]=0, }
------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == VipChat then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendPM(VipChat, "That chat is for Hub-Vip only. Your message has not been sent.")

end
end
end
end


function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..VipChat.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end




Title: Gr8!!! =)
Post by: WickeD on 21 January, 2004, 17:02:26
Script for only OP, Master? Can you help me whit that to?  =)  


//WickeD
Title:
Post by: SaintSinner on 21 January, 2004, 17:08:21
do you want op and master chat or two seperate opchat and masterchat?
Title:
Post by: plop on 21 January, 2004, 17:38:35
QuoteOriginally posted by SaintSinner
plop, phatty, NL, did i go in the right direction, can you see anything wrong.
this:
elseif Levels[user.iProfile] == nil then
can be replaced for:
else

thats all, got some idea's for you but i'll post that in the other thread.
it's of no use here.

plop
Title: Yes SaintSinner!
Post by: WickeD on 21 January, 2004, 19:13:49
I want two seperate script! If it is ok whit you?


//WickeD
Title:
Post by: SaintSinner on 21 January, 2004, 19:27:54
here is the master one




-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.
-- chat for Masters with profile



function Main()
OPCHAT = "OP_MChat"
frmHub:RegBot(OPCHAT)
end
Levels= { [0]=0, }


------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == OPCHAT then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendPM(OP_MChat, "That chat is for Hub-Masters only. Your message has not been sent.")

end
end
end
end

function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..OPCHAT.." $<"..user.sName.."> " ..msg)

end
end
end
end
end
end



Title: Ok...! =)
Post by: WickeD on 21 January, 2004, 19:57:58
Gr8!!!  =)   And the OP-Chat.....  =)


//WickeD
Title:
Post by: SaintSinner on 21 January, 2004, 20:15:34
QuoteOriginally posted by WickeD
Gr8!!!  =)   And the OP-Chat.....  =)


//WickeD


im testing it
Title: =)
Post by: WickeD on 21 January, 2004, 20:23:55
Gr8 m8!!!   =)
Title:
Post by: NightLitch on 21 January, 2004, 21:18:23
Well if both scripts above work for you Wicked is suggest
you learn a few small things...

SaintSinner is just changing:


For Masters ONLY
Levels= { [0]=0, }

For Masters & OPs ONLY
Levels= { [0]=0,[1]=0,}

For VIP's ONLY
Levels= { [2]=0,}

For REGS's ONLY
Levels= { [3]=0,}

hope you understand.

real simple actually, you can just copy the first code 3 times

and changing to above lines... If you understand me.
Have a bad habbit not getting myself understand sometimes... :-P
Title: Hi...NightLitch!
Post by: WickeD on 21 January, 2004, 21:50:43
Thx m8!  =)


//WickeD
Title:
Post by: SaintSinner on 21 January, 2004, 22:02:37
ok i fixed some things with the OP one not sending
the messages, here you go the master one first:



-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.




function Main()
MChat = "MChat"
frmHub:RegBot(MChat)
end
Levels= { [0]=0, }


------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == MChat then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendPM(MChat, "That chat is for Hub-Masters only. Your message has not been sent.")

end
end
end
end

function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..MChat.." $<"..user.sName.."> " ..msg)

end
end
end
end
end
end




Title:
Post by: SaintSinner on 21 January, 2004, 22:04:54
the opchat one, its fixed now
had a little problem with the pm not being sent
make sure you have the ptokax internal opchat off.



-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.



function Main()
OpChat = "OpChat"
frmHub:RegBot(OpChat)
end
Levels= { [1]=0, }
------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == OpChat then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendPM(OpChat, "That chat is for Hub-Ops only. Your message has not been sent.")

end
end
end
end


function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..OpChat.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end






Title:
Post by: SaintSinner on 21 January, 2004, 22:06:26
and the vip one





-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.




function Main()
VipChat = "VipChat"
frmHub:RegBot(VipChat)
end
Levels= { [2]=0, }
------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == VipChat then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendPM(VipChat, "That chat is for Hub-Vip only. Your message has not been sent.")

end
end
end
end


function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..VipChat.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end




Title: Nice!!!! =)
Post by: WickeD on 21 January, 2004, 22:30:43
Thx m8!!! x 1000!!!!  =)

//WickeD
Title:
Post by: NightLitch on 22 January, 2004, 01:09:12
Just a little pointer... Shouldn't "Operators" Ops & Master be able to chat in OP-Chat???

Simple solusion for the OP-Chat is this to:

by deleting:

Levels= { [2]=0, }

and changing:

if Levels[user.iProfile] then

to

if user.bOperator then

this will be as the Op-Chat is in Hubsoft...

But maybe I have not understand the meaning... Maybe
you wanted "OPs" to have thier own without Masters and
vice versa.

Don't mean any harm here now. :-) smile for the learning.

Have a good one ya all.
Title: Hi...NightLitch!
Post by: WickeD on 22 January, 2004, 11:04:35
Yes i want:  "OPs" to have thier own without Masters and vice versa.  =)


//WickeD
Title:
Post by: NightLitch on 22 January, 2004, 12:36:43
Ok. :-)
Title: I gut one broblem!
Post by: WickeD on 22 January, 2004, 16:42:46
When one of VIP send a massage in VIP-Chat it come up a VIP massage window in my face whit the VIP?s massage in! So i can see what they are typing! That is wrong! But i can not type back and that is right! =)

Can eny one help me whit that? Plz!!

//WickeD
Title:
Post by: SaintSinner on 22 January, 2004, 18:33:03
what is your level?..owner, op, vip?
Title: Hi...SaintSinner!
Post by: WickeD on 22 January, 2004, 18:35:01
I am Owner in the hub!

//WickeD