PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: Madman on 03 August, 2005, 18:54:06

Title: Master chat
Post by: Madman on 03 August, 2005, 18:54:06
Converted on request
Maybe somebody can have a use for it...

-- Master chat by Hawk
-- Lua5 Edition by Madman
-- Conversion requested by ???M
-- Added: ChatProfiles, Request by (-=TrIp-iN-SuN=-)

ChatProfiles = {
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 0, -- Moderator/Some other profile
[5] = 0, -- NetFounder/Another profile
}

MasterChatName = "master_chat"

function Main()
   frmHub:RegBot(MasterChatName)
end

function ToArrival(user,data)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
if whoTo == MasterChatName then
if ChatProfiles[user.iProfile] == 1 then
s,e,whoTo,from,msg = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
else
user:SendData("$To: "..user.sName.." From: "..MasterChatName.." $This Chat Is For Master ops only. Your message has not been sent")
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 ChatProfiles[usr.iProfile] == 1 then
usr:SendData("$To: "..usr.sName.." From: "..MasterChatName.." $<"..user.sName.."> " ..msg)
else
return 1
end
end
end
end
end
end
Title:
Post by: ?Tr??T_???? on 03 August, 2005, 23:30:03
nice one ;)
Title: ?
Post by: (-=TrIp-iN-SuN=-) on 06 August, 2005, 05:23:27
bro i need NetFounder Can to talk in master chat to and i can't to do this i try to change every thing and it's not work or Only NetFounder can to talk or OnlY Masters i want in this chat masters and netfounder too u can to do same thing?
Title:
Post by: Madman on 06 August, 2005, 14:21:16
Done... Script updated...
Set the ChatProfiles as you wish..
Title: .
Post by: (-=TrIp-iN-SuN=-) on 06 August, 2005, 16:46:39
tnx bro ;)
Title: yebo
Post by: ?Tr??T_???? on 06 August, 2005, 17:41:02
thats wath i was needing 2 :P
Title: Re: Master chat
Post by: speedX on 26 August, 2006, 20:58:03
nice script madman...
Title: Re: Master chat
Post by: JueLz on 26 August, 2006, 21:25:32
Awsm script MadMAn!!!!!!!!!!!
Title: Re: Master chat
Post by: Samantha on 05 November, 2006, 03:15:17

--// Simple MasterChat by NightLitch 2005-03-05
--// Fixed bug with some profile not recieving chat - Samantha 15/10/2006
--// Added Leviathan support - Samantha 19/10/2006

MasterChatName = "?Admin-Chat?"

function Main()
frmHub:RegBot(MasterChatName)
end


function ToArrival(user,data)
local s,e,to,from,msg = string.find(data,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)%|")
if to == VipChatName then
if user.iProfile == 6 or user.iProfile == 5 or user.iProfile == 0 then
MasterChat(user,msg)
else
SendPmToNick(user.sName,MasterChatName, "*** You don't have the privileges to talk in this chat.")
return 1
end
end
end

function VipChat(user,msg)
for _,profile in pairs(GetProfiles()) do
for _,users in pairs(GetUsersByProfile(profile)) do
if GetItemByName(users) then
if GetItemByName(users).iProfile == 6 or GetItemByName(users).iProfile == 5 or GetItemByName(users).iProfile == 0 then
if GetItemByName(users).sName ~= user.sName then
GetItemByName(users):SendData("$To: "..GetItemByName(users).sName.." From: "..MasterChatName.." $<"..user.sName.."> "..msg)
end
end
end
end
end
end




try this and it works :)
Title: Re: Master chat
Post by: 6Marilyn6Manson6 on 05 November, 2006, 08:42:57
Quote from: Samantha on 05 November, 2006, 03:15:17

--// Simple MasterChat by NightLitch 2005-03-05
--// Fixed bug with some profile not recieving chat - Samantha 15/10/2006
--// Added Leviathan support - Samantha 19/10/2006

MasterChatName = "?Admin-Chat?"

function Main()
frmHub:RegBot(MasterChatName)
end


function ToArrival(user,data)
local s,e,to,from,msg = string.find(data,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)%|")
if to == VipChatName then
if user.iProfile == 6 or user.iProfile == 5 or user.iProfile == 0 then
MasterChat(user,msg)
else
SendPmToNick(user.sName,MasterChatName, "*** You don't have the privileges to talk in this chat.")
return 1
end
end
end

function VipChat(user,msg)
for _,profile in pairs(GetProfiles()) do
for _,users in pairs(GetUsersByProfile(profile)) do
if GetItemByName(users) then
if GetItemByName(users).iProfile == 6 or GetItemByName(users).iProfile == 5 or GetItemByName(users).iProfile == 0 then
if GetItemByName(users).sName ~= user.sName then
GetItemByName(users):SendData("$To: "..GetItemByName(users).sName.." From: "..MasterChatName.." $<"..user.sName.."> "..msg)
end
end
end
end
end
end




try this and it works :)

Your post contain 2 errors:

if to == VipChatName then

and

MasterChat(user,msg)

This is correct post:

--// Simple MasterChat by NightLitch 2005-03-05
--// Fixed bug with some profile not recieving chat - Samantha 15/10/2006
--// Added Leviathan support - Samantha 19/10/2006
--// Fixed bug with some name of chat and function - 6Marilyn6Manson6 04/11/2006

MasterChatName = "?Admin-Chat?"

function Main()
frmHub:RegBot(MasterChatName)
end


function ToArrival(user,data)
local s,e,to,from,msg = string.find(data,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)%|")
if to == MasterChatName then
if user.iProfile == 6 or user.iProfile == 5 or user.iProfile == 0 then
MasterChat(user,msg)
else
SendPmToNick(user.sName,MasterChatName, "*** You don't have the privileges to talk in this chat.")
return 1
end
end
end

function MasterChat(user,msg)
for _,profile in pairs(GetProfiles()) do
for _,users in pairs(GetUsersByProfile(profile)) do
if GetItemByName(users) then
if GetItemByName(users).iProfile == 6 or GetItemByName(users).iProfile == 5 or GetItemByName(users).iProfile == 0 then
if GetItemByName(users).sName ~= user.sName then
GetItemByName(users):SendData("$To: "..GetItemByName(users).sName.." From: "..MasterChatName.." $<"..user.sName.."> "..msg)
end
end
end
end
end
end


This is ok :D