PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: night_hawk on 10 February, 2004, 16:43:05

Title: Chat Room
Post by: night_hawk on 10 February, 2004, 16:43:05
Hi i need just a plain chat room that my users can chat in. I run trivia in the main part of my hub. All I need is something that they can join on there own. I tried one chat room script and it did not work right it show two messages when i typed and it messed around with my ops when they tried to use there commands.. I am useing test drive 4.99 it someone one can make a simple scritp i would be very happy thank you.... ?(
Title: Try this one!
Post by: WickeD on 10 February, 2004, 17:17:08
-- Chat-Room
-- 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.
-- Simple Modify by WickeD to ChatRoom for Users.




function Main()
   ChatRoom = "ChatRoom"
   frmHub:RegBot(ChatRoom)
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 == ChatRoom 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(ChatRoom, "That chat is for Hub-Users 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: "..ChatRoom.." $<"..user.sName.."> " ..msg)


               end
            end
         end
      end
   end
end

_______________________________________

Try it! I have not tryed it! So no guarantees that it works!  =)

//WickeD
Title: ty
Post by: night_hawk on 10 February, 2004, 18:19:43
i need it to work for all my users vip regs and ops
Title: ty
Post by: night_hawk on 10 February, 2004, 18:23:14
i need it to work for all my users vip regs and ops
Title: Okej! Try this one then!
Post by: WickeD on 10 February, 2004, 19:08:15
-- Chat-Room
-- 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.
-- Simple Modify by WickeD to ChatRoom for User/Reg/Vip/Moderator/Op/Master.




function Main()
ChatRoom = "ChatRoom"
frmHub:RegBot(ChatRoom)
end
Levels= { [-1]=0,[0]=0,[1]=0,[2]=0,[3]=0,[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 == ChatRoom 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(ChatRoom, "That chat is for, User/Reg/Vip/Moderator/Op/Master. 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: "..ChatRoom.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end

_________________________________________

I have not tryed it! So no guarantees that it works!

//WickeD
Title: can you add adims to it to
Post by: night_hawk on 10 February, 2004, 20:46:05
i need my admin users added to if you can
Title:
Post by: night_hawk on 10 February, 2004, 21:03:01
Is there a way that they can log thems in to it in stead of it being a pop up
Title:
Post by: WickeD on 10 February, 2004, 21:14:29
QuoteOriginally posted by night_hawk
Is there a way that they can log thems in to it in stead of it being a pop up

That can I not help you whit! Sorry I am not so good on writing scripts!
____________________________________________

I can add Admin to it if you post your Profiles here so I can se what profiles your Admin has!

(Your Profiles do you find in your ptokaX map/Profiles.DAT)

//WickeD
Title:
Post by: night_hawk on 10 February, 2004, 21:38:49
where do i find that
Title: You find it:
Post by: WickeD on 10 February, 2004, 21:53:00
(Your Profiles do you find in your ptokaX map/Profiles.DAT)


//WickeD
Title:
Post by: night_hawk on 10 February, 2004, 22:44:05
sorry i am new to ptokax i am just learn it what do you mean profile for my admins. I am trying to understand what you trying to tell me...  Do you mean my doc files(scripting)
Title:
Post by: night_hawk on 10 February, 2004, 22:52:18
i found this for profile thats all hope it helps

0|Master|11111111111111111111000000000000
1|Operator|11111100011001111111000000000000
2|VIP|10000000000001111000000000000000
3|Reg|10000000000000000000000000000000
4|Guest|10000000000000000000000000000000
5|Admin|11111100011111111111000000000000
Title: Here you go!
Post by: WickeD on 10 February, 2004, 23:27:49
-- Chat-Room
-- 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.
-- Simple Modify by WickeD to ChatRoom for User/Reg/Vip/Moderator/Op/Admin/Master.




function Main()
ChatRoom = "ChatRoom"
frmHub:RegBot(ChatRoom)
end
Levels= { [-1]=0,[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}
------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == ChatRoom 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(ChatRoom, "That chat is for, User/Reg/Vip/Moderator/Op/Admin/Master. 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: "..ChatRoom.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end


___________________________________________

Try this then! I think is it fixed now! Good luck!

//WickeD
Title: ty
Post by: night_hawk on 11 February, 2004, 02:31:24
thank you for helping me old...If you like to join my hub i would be glad to invite you and thank you again