PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: kunal on 24 October, 2005, 08:17:42

Title: lua 425
Post by: kunal on 24 October, 2005, 08:17:42
can anyone pls convert me this script

excludeUsers = {
["Nick1"]=1, --// Users who will not be checked at all
}  --// and so on...

Bot_N = "OpenHubCheck"
openLimit = 0 --// Amount of Open Hubs allowed
regLimit = 1 --// Amount of Reg Hubs allowed
opLimit = 0 --// Amount of Op Hubs allowed
GKickMsg = "You are in [open] hubs as a guest. Which is against our Rules. Connection Terminated!"
RKickMsg = "You are in [rehu] hubs as a registered User. Which is against our Rules. Connection Terminated!"
OKickMsg = "You are in [ophu] hubs as an Operator. Which is against our Rules. Connection Terminated!"
switch = 1 --// Standard 1 On oder 0 Off
Prefix = "!" --// Prefix for the cmd's
ChangeStatus = "change" --// Change Check Status
AddUser = "oadd" --// Ad User to imune list
DelUser = "odel" --// Del User from imune list
ListUsers = "olist" --// List imune Users
--End User Settings----------------------------------------------------------------------------------


function DataArrival(user, data)
if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
local openhubs,Guest,Reg,OP = scanmyinfo(user.sMyInfoString)
if switch == 1 then
if ( tonumber(Guest) > openLimit ) then
local msg = gsub(GKickMsg, "%b[open]", Guest)
user:SendData(Bot_N, msg)-- gsub(GKickMsg, "%b[open]", Guest) )
user:Disconnect()
elseif ( tonumber(Reg) > regLimit ) then
local msg = gsub(KickMsg, "%b[reg]", Reg)
user:SendData(Bot_N, msg)-- gsub(RKickMsg, "%b[reg]", Reg) )
user:Disconnect()
elseif ( tonumber(OP) > opLimit ) then
local msg = gsub(KickMsg, "%b[op]", OP)
user:SendData(Bot_N, msg)-- gsub(OKickMsg, "%b[op]", OP) )
user:Disconnect()
end
end
elseif strsub(data, 1,1) =="<" and user.bOperator then
data = strsub(data, 1, strlen(data)-1)
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s*(.*)")
if (cmd==Prefix..ChangeStatus) then
if switch == 1 then
switch = 0
user:SendData(Bot_N, "Anti Open Hub Check deactivated")
elseif switch == 0 then
switch = 1
user:SendData(Bot_N, "Anti Open Hub Check activated")
end
return 1
elseif (cmd==Prefix..AddUser) then
if arg  and arg ~= "" then
if excludeUsers[arg] then
user:SendData("User "..arg.." is already on my immune list")
else
excludeUsers[arg] = 1
user:SendData("User "..arg.." now on my immune list for this session ...")
end
else
user:SendData(Bot_N, "Please Use: "..Prefix..AddUser.." ")
end
elseif (cmd==Prefix..DelUser) then
if arg and arg ~= "" then
if excludeUsers[arg] then
excludeUsers[arg] = nil
user:SendData("User "..arg.." wiped from my imune list")
else
user:SendData("I dont have a "..arg.." on my list")
end
else
user:SendData(Bot_N, "Please Use: "..Prefix..DelUser.." ")
end
elseif (cmd==Prefix..ListUsers) then
local msg = "The following Users do not get checked by Anti Open Hub Script\r\n"
for nick, v in excludeUsers do
msg = msg.."\t - "..nick.."\r\n"
end
user:SendData(Bot_N, msg)
end
end
end


function scanmyinfo(myinfo)
local _,_,Hubs,Slots,speed = strfind(myinfo, "H:([^,]+),S:(%d+).*>$ $(.-).%$")
local Guest,Reg,OP
local _,_,limit1=strfind(myinfo,"[BLU]:(%d+)")
local _,_,limit2 = strfind(myinfo,"F:%d+/(%d+)")
local _,_,temp = strfind(myinfo, "$(%d+)%$")
if tonumber (Hubs) then
if Hubs=="0" then
Guest,Reg,OP= "0", "1" , "0"
else
Guest,Reg,OP=  Hubs, "0", "0"
end
else
_,_, Guest,Reg,OP = strfind(Hubs,"(%d+)/(%d+)/(%d+)")
end
if ophubscount==1 then
hubs = tonumber(Guest)+tonumber(Reg)+tonumber(OP)
slots=tonumber(Slots)
ratio=slots/hubs
else
hubs = tonumber(Guest)+tonumber(Reg)
slots=tonumber(Slots)
if hubs==0 then
ratio=slots
else
ratio=slots/hubs
end
end
if limit1 then
return  hubs,Guest,Reg,OP
elseif limit2 then
return  hubs,Guest,Reg,OP
else
return  hubs,Guest,Reg,OP
end
end
s
Title:
Post by: kunal on 25 October, 2005, 16:11:12
i tried to connect just to my hub with this script.however even if it was the only hub on i got this message
You are in 1 hubs as a guest. Which is against our Rules. Connection Terminated!
*** Disconnected
Title:
Post by: Dessamator on 25 October, 2005, 20:50:21
maybe u should change that, although it might be a script bug.
openLimit = 0--// Amount of Open Hubs allowed
Title:
Post by: 6Marilyn6Manson6 on 25 October, 2005, 20:56:39
openLimit = 0 --// Amount of Open Hubs allowed
This is max hubs...  :D
Title:
Post by: Bumbi on 25 October, 2005, 21:16:48
QuoteOriginally posted by kunal
i tried to connect just to my hub with this script.however even if it was the only hub on i got this message
You are in 1 hubs as a guest. Which is against our Rules. Connection Terminated!
*** Disconnected

If you use a client like Zion you have Z before your ++ tag then you have to make your name imune before you can connect with it ... the script takes all tags before ++ as public hub

Bumbi
Title:
Post by: kunal on 26 October, 2005, 11:29:14
Quotemaybe u should change that, although it might be a script bug.


openLimit = 0--// Amount of Open Hubs allowed

Dessamator, i have kept it 0 only coz i dont want hub users to join open hubs.but does it mean that i cant connect only to my hub which is only for reg users.
Title:
Post by: 6Marilyn6Manson6 on 26 October, 2005, 13:09:49
try this... tested :P


--By Unknown
--// Fixed small bugs with Msg and openLimit by 6Marilyn6Manson6 26/10/2005
excludeUsers = {
["Nick1"]=1, --// Users who will not be checked at all
} --// and so on...

Bot_N = "OpenHubCheck"
regLimit = 1 --// Amount of Reg Hubs allowed
opLimit = 0 --// Amount of Op Hubs allowed
GKickMsg = "You are in [open] hubs as a guest. Which is against our Rules. Connection Terminated!"
RKickMsg = "You are in [rehu] hubs as a registered User. Which is against our Rules. Connection Terminated!"
OKickMsg = "You are in [ophu] hubs as an Operator. Which is against our Rules. Connection Terminated!"
switch = 1 --// Standard 1 On oder 0 Off
Prefix = "!" --// Prefix for the cmd's
ChangeStatus = "change" --// Change Check Status
AddUser = "oadd" --// Ad User to imune list
DelUser = "odel" --// Del User from imune list
ListUsers = "olist" --// List imune Users
--End User Settings----------------------------------------------------------------------------------


function MyINFOArrival(user, data)
if string.sub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
local openhubs,Guest,Reg,OP = scanmyinfo(user.sMyInfoString)
if switch == 1 then
if user.bRegistered == nil then
local msg = string.gsub(GKickMsg, "%b[open]", Guest)
user:SendData(Bot_N, msg)-- string.gsub(GKickMsg, "%b[open]", Guest) )
user:Disconnect()
elseif ( tonumber(Reg) > regLimit ) then
local msg = string.gsub(RKickMsg, "%b[reg]", Reg)
user:SendData(Bot_N, msg)-- string.gsub(RKickMsg, "%b[reg]", Reg) )
user:Disconnect()
elseif ( tonumber(OP) > opLimit ) then
local msg = string.gsub(OKickMsg, "%b[op]", OP)
user:SendData(Bot_N, msg)-- string.gsub(OKickMsg, "%b[op]", OP) )
user:Disconnect()
end
end
end
end

function ChatArrival(user, data)
if string.sub(data, 1,1) =="<" and user.bOperator then
data = string.sub(data, 1, string.len(data)-1)
local s,e,cmd,arg = string.find(data, "%b<>%s+(%S+)%s*(.*)")
if (cmd==Prefix..ChangeStatus) then
if switch == 1 then
switch = 0
user:SendData(Bot_N, "Anti Open Hub Check deactivated")
elseif switch == 0 then
switch = 1
user:SendData(Bot_N, "Anti Open Hub Check activated")
end
return 1
elseif (cmd==Prefix..AddUser) then
if arg  and arg ~= "" then
if excludeUsers[arg] then
user:SendData("User "..arg.." is already on my immune list")
else
excludeUsers[arg] = 1
user:SendData("User "..arg.." now on my immune list for this session ...")
end
else
user:SendData(Bot_N, "Please Use: "..Prefix..AddUser.." ")
end
elseif (cmd==Prefix..DelUser) then
if arg and arg ~= "" then
if excludeUsers[arg] then
excludeUsers[arg] = nil
user:SendData("User "..arg.." wiped from my imune list")
else
user:SendData("I dont have a "..arg.." on my list")
end
else
user:SendData(Bot_N, "Please Use: "..Prefix..DelUser.." ")
end
elseif (cmd==Prefix..ListUsers) then
local msg = "The following Users do not get checked by Anti Open Hub Script\r\n"
for nick, v in excludeUsers do
msg = msg.."\t - "..nick.."\r\n"
end
user:SendData(Bot_N, msg)
end
end
end


function scanmyinfo(myinfo)
local _,_,Hubs,Slots,speed = string.find(myinfo, "H:([^,]+),S:(%d+).*>$ $(.-).%$")
local Guest,Reg,OP
local _,_,limit1=string.find(myinfo,"[BLU]:(%d+)")
local _,_,limit2 = string.find(myinfo,"F:%d+/(%d+)")
local _,_,temp = string.find(myinfo, "$(%d+)%$")
if tonumber (Hubs) then
if Hubs=="0" then
Guest,Reg,OP= "0", "1" , "0"
else
Guest,Reg,OP=  Hubs, "0", "0"
end
else
_,_, Guest,Reg,OP = string.find(Hubs,"(%d+)/(%d+)/(%d+)")
end
if ophubscount==1 then
hubs = tonumber(Guest)+tonumber(Reg)+tonumber(OP)
slots=tonumber(Slots)
ratio=slots/hubs
else
hubs = tonumber(Guest)+tonumber(Reg)
slots=tonumber(Slots)
if hubs==0 then
ratio=slots
else
ratio=slots/hubs
end
end
if limit1 then
return  hubs,Guest,Reg,OP
elseif limit2 then
return  hubs,Guest,Reg,OP
else
return  hubs,Guest,Reg,OP
end
end


C ya
Title:
Post by: 6Marilyn6Manson6 on 26 October, 2005, 13:51:09
I have tested it and work. C ya