AuthorMessage
Takel
n00b
Posts: 17

Hi all,
a script would serve me for hexhub that made me create a chat for profile, example a vipchat 
is it possible??
thx Takel®
CrazyGuy
n00b
Posts: 32

Code:

-- set which profiles can talk in the chat
tChat = {
   ["Owner"] = 1,
   ["Admin"] = 1,
   ["SOP"] = 0,
   ["OP"] = 0,
   ["KVip"] = 1,
   ["Vip"] = 1,
   ["Reg"] = 0,
   ["Default"] = 0,
   ["OP-begger"] = 0,
   ["VIP-FAGS"] = 0,
   ["LAME-SPAMMER"] = 0,
   ["Banned"] = 0,
   ["Delete"] = 0,
}
tUsers = {}
Main = function()
   local bID = Hub.RegBot("VIP-Chat")
end
UserConnected = function(User)
   tUsers[User.iUserID] =  { [1] = GetProfileName(User.iProfile), [2] = User.sName }
end
UserDisconnected = function(User)
   tUsers[User.iUserID] = nil
end
ErrorEvent= function(error)
   SendToAll(Hub.BotName(), error)
end
DataArrival = function(User, Data)
   local bIsPM = string.find(Data, "%$To%:%sVIP%-Chat")
   local _,_,sMessage = string.find(Data, "%>%s(.+)")
   if bIsPM ~= nil then
      if tChat[GetProfileName(User.iProfile)] == 1 then
         for k in pairs(tUsers) do
            if tChat[tUsers[k][1]] == 1 and tUsers[k][2] ~= User.sName then
               SendDataTo(k, "$To: "..tUsers[k][2].." From: VIP-Chat $<"..User.sName.."> "..sMessage)
            end
         end
      else
         SendPMTo(User.iUserID, "VIP-Chat", "You're not allowed to use this chatroom")
      end
   end
end

Although this can be optimized with a plugin-side VIP-Chat
Takel
n00b
Posts: 17

sorry,
it doesn't work, it loads the chat in list users but if you write us inside, any vip it receives it
thx Takel®
CrazyGuy
n00b
Posts: 32

Quoted from Takel
sorry,
it doesn't work, it loads the chat in list users but if you write us inside, any vip it receives it
thx Takel®

Not quite sure on what you mean there. But since the script keeps a record of who'se who with a table, you'll need to restart the hub so all users log in again
Takel
n00b
Posts: 17

sorry,
try it again, restart hub but not run.. :(
Takel®
CrazyGuy
n00b
Posts: 32

What version of the plugin are you using ?
Can you see Vip-Chat in the userlist ?