PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: GaMeFaNaTiC on 28 October, 2003, 16:10:58

Title: OPCHAT SCRIPT
Post by: GaMeFaNaTiC on 28 October, 2003, 16:10:58
any1 gt this...
Title:
Post by: pHaTTy on 28 October, 2003, 16:13:15
huh, tis built into the hub software, just enable it icecube 4 above i think
Title:
Post by: GaMeFaNaTiC on 28 October, 2003, 16:19:45
ye itz ther but it doesnt seem to work :S. no other op can recieive a msg wen u write smin in ther :S.
Title:
Post by: pHaTTy on 28 October, 2003, 16:23:26
hmmmmm
Title:
Post by: raz on 31 October, 2003, 19:37:16
u should try downloading the software again. or the script which does vipchat u can change it 2 opchat. i can't be bothered uploading it so i will upload it afterwards. :D
Title:
Post by: raz on 31 October, 2003, 20:03:41
here it is. i have changed it so it is like opchat.

BotName = "{?2?M}?OpChat"

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<=2) then
local sus=GetUsersByProfile("Master")
local sops=GetUsersByProfile("SuperOp")
local ops=GetUsersByProfile("Operator")

for i, n in sops do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end

for i, n in sus do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end

for i, n in ops do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
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
Title:
Post by: Tuben on 31 October, 2003, 21:13:50
Or maybe this ??

I dont now but this works werry nice ;)


BOT_Chat = "Op-Chat"

function Main()
frmHub:RegBot(Bot_Chat)
end
function DataArrival(curUser,sdata)

if curUser.iProfile == 0 or curUser.iProfile == 1 then
 if strsub(sdata, 1, 5) == "$To: " and strsub(sdata, 6, strlen(BOT_Chat) + 5) == BOT_Chat then
sdata = strsub(sdata, 1, strlen(sdata) - 1)
   local _,_,whoTo,from,msg = strfind(sdata,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
aProfiles = GetProfiles()
for i = 0, getn(aProfiles) do
 if aProfiles[i] == "Master" or
    aProfiles[i] == "Operator" then    
local aUsers = GetUsersByProfile(aProfiles[i])
for i = 0, getn(aUsers) do
if aUsers[i] ~= from then
local user = GetItemByName(aUsers[i])
if user then
user:SendData("$To: "..aUsers[i].." From: "..BOT_Chat.." $<"..from.."> "..msg)
end
    end
  end
                 end
      end
             end
  end
end