PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: Guibs on 10 November, 2003, 12:42:30

Title: Vip Chat :)
Post by: Guibs on 10 November, 2003, 12:42:30
Hi there,,

A stand alone script for Vip & higher, depending of your profiles.dat file used. [The script is following the PtokaX profile by default (0 = master, 1=op, 2=vip)]

------------------
-- VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)

------------------
-- Main Function --
------------------
function Main()
VIPCHAT = "-=VipChat=-"
frmHub:RegBot(VIPCHAT)
end

------------------
-- 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 user.iProfile == 0 or user.iProfile == 1 or user.iProfile == 2 then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
VipChatRoom(user,msg)
end
end
end
end

-------------------
-- Vip Chat Room --
-------------------

function VipChatRoom(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 usr.iProfile == 0 or usr.iProfile == 1 or usr.iProfile == 2 then
usr:SendData("$To: "..usr.sName.." From: "..VIPCHAT.." $<"..user.sName.."> " ..msg)
end
end
end
end
end
end
------------------
Enjoy,,,, :)

l8tr,, ;o)
Title:
Post by: pHaTTy on 10 November, 2003, 12:44:05
AH DAMN, that reminds me i supposed to be making sumit similar for AC,,,,,,,,,,,,, hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

nice script guibs m8 :o)
Title:
Post by: AlwaysConnected on 10 November, 2003, 19:30:35
QuoteOriginally posted by (uk-kingdom)pH?tt?
AH DAMN, that reminds me i supposed to be making sumit similar for AC,,,,,,,,,,,,, hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

nice script guibs m8 :o)

doesnot matter phatty  :D
Title:
Post by: pHaTTy on 10 November, 2003, 19:35:19
ahh phew ok AC heheeh
Title: vipchat by guibs
Post by: BrickTop on 25 March, 2004, 15:52:36
vipchat script    guibs

I cant get the vipchat script to work, get an error in line 9 of code  any ideas????????


code:--------------------------------------------------------------------------------
-- VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)

------------------
-- Main Function --
------------------
function Main()
   VIPCHAT = "-=VipChat=-"
   frmHub:RegBot(VIPCHAT)
end

------------------
-- 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 user.iProfile == 0 or user.iProfile == 1 or user.iProfile == 2 then
            s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
            VipChatRoom(user,msg)
         end
      end
   end
end

-------------------
-- Vip Chat Room --
-------------------

function VipChatRoom(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 usr.iProfile == 0 or usr.iProfile == 1 or usr.iProfile == 2 then
                  usr:SendData("$To: "..usr.sName.." From: "..VIPCHAT.." $<"..user.sName.."> " ..msg)
               end
            end
         end
      end
   end
end
--------------------------------------------------------------------------------