Hi trying to get Profiles Support into this one so that the script can block ppl for being in a certain ammount of Open Hubs/RegHubs/Admin Hubs
found a myinfo scanner in Lawmaker and have been trying to get things muddled around so it would work.
Now seeing i'm still a noob and got myself stuck again could someone have a look at this and tell me if i'm even going in the right direction? :D
Bot_N = "OpenHubCheck"
openLimit = 1 --// Hier k?nnen Anzahl erlaubte Open Hubs eingestellt werden
regLimit = 5
opLimit = 3
KickMsg = "Du bist in [open] Open Hubs. Dies verst?sst gegen unsere Regeln. Deshalb wird die Verbindung zur?ckgesetzt!" --- Vorsicht "[open]" ist teil der Nachricht und zeigt die Anzahl Open Hubs an ...
switch = 1 --// Hier wird der Standard gesetzt 1 ein oder 0 aus
Prefix = "!" --// Hier kommt das Prefix f?r die Befehle rein
ChangeStatus = "change" --// Hier kommt der Befehl um den Check ein und aus zu schalten
AddUser = "oadd" --// Hier kommt der Befehl rein um User f?r 1 Sitzung vom Check auszuschliessen
DelUser = "odel" --// Hier kommt der Befehl rein um User von der nicht-check liste zu streichen
ListUsers = "olist" --// User auflisten die nicht gecheckt werden
--End User Settings----------------------------------------------------------------------------------
--AB-Hier-bitte-nichts-mehr-?ndern!!!-----------------------------------------------------------
function DataArrival(user, data)
if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
-- local s,e,openhubs = strfind(data, ",H:(%d+)");
local _,_,openhubs,reghubs,ophubs = strfind(Hubs,"(%d+)/(%d+)/(%d+)");
if switch == 1 and ( tonumber(openhubs) >= openLimit ) and ( tonumber(reghubs) >= regLimit ) and ( tonumber(ophubs) >= opLimit ) then
local msg = gsub(KickMsg, "%b[open]", openhubs)
local msg = gsub(KickMsg, "%b[rehu]", reghubs)
local msg = gsub(KickMsg, "%b[ophu]", ophubs)
user:SendData(Bot_N, msg)-- gsub(KickMsg, "%b[open]", openhubs) )
user:Disconnect()
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 deaktiviert")
elseif switch == 0 then
switch = 1
user:SendData(Bot_N, "Anti Open Hub Check aktiviert")
end
return 1
elseif (cmd==Prefix..AddUser) then
if arg and arg ~= "" then
if excludeUsers[arg] then
user:SendData("Der User "..arg.." ist bereits vom Open Hub Check ausgeschlossen")
else
excludeUsers[arg] = 1
user:SendData("Der User "..arg.." wird in dieser Sitzung nicht kontrolliert ...")
end
else
user:SendData(Bot_N, "Bitte verwende: "..Prefix..AddUser.." ")
end
elseif (cmd==Prefix..DelUser) then
if arg and arg ~= "" then
if excludeUsers[arg] then
excludeUsers[arg] = nil
user:SendData("User "..arg.." wird wieder vom Anti Open Hub Check kontrolliert")
else
user:SendData("Ich habe keinen "..arg.." in meiner liste")
end
else
user:SendData(Bot_N, "Bitte verwende: "..Prefix..DelUser.." ")
end
elseif (cmd==Prefix..ListUsers) then
local msg = "Die folgenden User werden mindestens f?r diese Sitzung nicht nach Open Hubs kontrolliert\r\n"
for nick, v in excludeUsers do
msg = msg.."\t - "..nick.."\r\n"
end
user:SendData(Bot_N, msg)
end
end
end
I havent posted any of my scripts in Greek ...
would you mind changing this with the English ver ?
sure no problem
Bot_N = "OpenHubCheck"
openLimit = 1 --// Amount of Open Hubs allowed
regLimit = 5 --// Amount of Reg Hubs allowed
opLimit = 3 --// Amount of Op Hubs allowed
KickMsg = "You are in [open] Open Hubs. Which is against aour Rules. Connection Terminated!" --- Vorsicht "[open]" ist teil der Nachricht und zeigt die Anzahl Open Hubs an ...
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 s,e,openhubs = strfind(data, ",H:(%d+)");
local _,_,Guest,Reg,OP = strfind(Hubs,"(%d+)/(%d+)/(%d+)");
if switch == 1 and ( tonumber(Guest) >= openLimit ) and ( tonumber(Reg) >= regLimit ) and ( tonumber(OP) >= opLimit ) then
local msg = gsub(KickMsg, "%b[open]", Guest)
local msg = gsub(KickMsg, "%b[rehu]", Reg)
local msg = gsub(KickMsg, "%b[ophu]", OP)
if
user:SendData(Bot_N, msg)-- gsub(KickMsg, "%b[open]", openhubs) )
user:Disconnect()
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
Okie thx, now we can talk .. :)
is this string correct btw?
local _,_,openhubs,reghubs,ophubs = strfind(Hubs,"(%d+)/(%d+)/(%d+)");
i mean to read out the amount of hubs the user is conected to an as what?
QuoteOriginally posted by Psycho_Chihuahua
is this string correct btw?
local _,_,openhubs,reghubs,ophubs = strfind(Hubs,"(%d+)/(%d+)/(%d+)");
i mean to read out the amount of hubs the user is conected to an as what?
no
G/R/O
its Guest/Reg/OP
beware: dcgui sends oldstyle hubcount (H:x,S:y) tag
edited my top posti'm not getting very far ^^ just hope i'm still on the right track
u know this 1:
function scanmyinfo(myinfo)
local _,_,Hubs,Slots,speed = strfind(myinfo, "H:([^,]+),S:(%d+).*>$ $(.-).%$")
local Guest,Reg,OP,slots,hubs,ratio
local Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn=slotperhub[speed].max_slots,slotperhub[speed].min_ratio,slotperhub[speed].max_hubs,slotperhub[speed].min_limit
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
local Share = format("%0.2f", tonumber(temp)/gb)
if limit1 then
return hubs,slots,Guest,Reg,OP,speed,limit1,Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn,ratio,Share
elseif limit2 then
return hubs,slots,Guest,Reg,OP,speed,limit2,Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn,ratio,Share
else
return hubs,slots,Guest,Reg,OP,speed,nil,Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn,ratio,Share
end
end
this is what u requested somewhere else
it returns 13 values
thnx m8
i only need the three ^^ all that is neccesary is to count in how many hubs and as what (Guest/Reg/OP).
this is only supposed to be able to block certain connection ammounts (started off with only blocking users who were guests in open hubs)
well i'll see what i can do with it as i dont understand everything included :D
this does all calculation, exclude the ones u dont need from return
Weird no Syntax Errors No running Errors - but it just dont work ;(
excludeUsers = {
["bobby"]=1, --// Hier kommen die vom Check f?r immer ausgeschlossene User rein
["Uwe"]=1, --// Hier kommen die vom Check f?r immer ausgeschlossene User rein
["Freebird"]=1, --// Hier kommen die vom Check f?r immer ausgeschlossene User rein
} --// und so weiter...
Bot_N = "OpenHubCheck"
openLimit = 0 --// Amount of Open Hubs allowed
regLimit = 2 --// 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 Guest,Reg,OP
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]", openhubs) )
user:Disconnect()
elseif ( tonumber(Reg) >= regLimit ) then
local msg = gsub(KickMsg, "%b[rehu]", Reg)
user:SendData(Bot_N, msg)-- gsub(RKickMsg, "%b[rehu]", Guest) )
user:Disconnect()
elseif ( tonumber(OP) >= opLimit ) then
local msg = gsub(KickMsg, "%b[ophu]", OP)
user:SendData(Bot_N, msg)-- gsub(OKickMsg, "%b[ophu]", 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,slots,hubs,ratio
local Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn=slotperhub[speed].max_slots,slotperhub[speed].min_ratio,slotperhub[speed].max_hubs,slotperhub[speed].min_limit
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
local Share = format("%0.2f", tonumber(temp)/gb)
if limit1 then
return hubs,Guest,Reg,OP
elseif limit2 then
return hubs,Guest,Reg,OP
else
return hubs,Guest,Reg,OP
end
end
strsub(data, 1,7) == myinfo ?
Whats that?
QuoteOriginally posted by VidFamne
strsub(data, 1,7) == myinfo ?
Whats that?
trying to tell the bot to read it out of
function scanmyinfo(myinfo) :D
Hmm, there is no myinfo in DataArrival what I know of.
Only $MyINFO
Perhaps I'm wrong
**Edit
And I think you have to declare
myinfo = user.sMyInfoString
in there some place.
diesnt work with "$MYINFO" either
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)
myinfo = user.sMyInfoString
if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
local Guest,Reg,OP;
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[rehu]", Reg)
user:SendData(Bot_N, msg)-- gsub(RKickMsg, "%b[rehu]", Reg) )
user:Disconnect()
elseif ( tonumber(OP) >= opLimit ) then
local msg = gsub(KickMsg, "%b[ophu]", OP)
user:SendData(Bot_N, msg)-- gsub(OKickMsg, "%b[ophu]", 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,slots,hubs,ratio
local Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn=slotperhub[speed].max_slots,slotperhub[speed].min_ratio,slotperhub[speed].max_hubs,slotperhub[speed].min_limit
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
local Share = format("%0.2f", tonumber(temp)/gb)
if limit1 then
return hubs,Guest,Reg,OP
elseif limit2 then
return hubs,Guest,Reg,OP
else
return hubs,Guest,Reg,OP
end
end
receive
Syntax Error: attempt to compare nil with number
Syntax Error: attempt to compare nil with number
Try "$MyINFO"
same effect ;(
I would begin like this;if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
myinfo = user.sMyInfoString
local openhubs,Guest,Reg,OP = scanmyinfo(myinfo)
I got the first check working again already ... but from there on it doesnt go on to the second(Reg) and third )OP) check.....
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
Result is
Syntax Error: bad argument #1 to `strfind' (string expected, got nil)
Syntax Error: bad argument #1 to `gsub' (string expected, got nil)
QuoteOriginally posted by VidFamne
I would begin like this;if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
myinfo = user.sMyInfoString
local openhubs,Guest,Reg,OP = scanmyinfo(myinfo)
if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
local openhubs,Guest,Reg,OP = scanmyinfo(user.sMyInfoString)
edited my last post
replace this:
local msg = gsub(GKickMsg, "%b[open]", Guest)
to this:
local msg = gsub(GKickMsg, "(%b[])", Guest)
Bot_N = "OpenHubCheck"
openLimit = 1 --// Amount of Open Hubs allowed
regLimit = 5 --// Amount of Reg Hubs allowed
opLimit = 3 --// Amount of Op Hubs allowed
GKickMsg = "You are in [open] Open Hubs. Which is against our Rules. Connection Terminated!"
RKickMsg = "You are in [rehu] Open Hubs. Which is against our Rules. Connection Terminated!"
OKickMsg = "You are in [ophu] Open Hubs. 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 scanmyinfo(myinfo)
local _,_,Hubs,Slots,speed = strfind(myinfo, "H:([^,]+),S:(%d+).*>$ $(.-).%$")
local Guest,Reg,OP,slots,hubs,ratio
local Maxslotsforconn,Ratioforconn,Maxhubsforconn,minlimitforconn=slotperhub[spee
d].max_slots,slotperhub[speed].min_ratio,slotperhub[speed].max_hubs,slotperhub[speed].min_limit
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
local Share = format("%0.2f", tonumber(temp)/gb)
if limit1 then
return hubs,Guest,Reg,OP
elseif limit2 then
return hubs,Guest,Reg,OP
else
return hubs,Guest,Reg,OP
end
end
function DataArrival(user, data)
if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
local Guest,Reg,OP
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]", openhubs) )
user:Disconnect()
elseif ( tonumber(Reg) >= regLimit ) then
local msg = gsub(KickMsg, "%b[rehu]", Reg)
user:SendData(Bot_N, msg)-- gsub(RKickMsg, "%b[rehu]", Guest) )
user:Disconnect()
elseif ( tonumber(OP) >= opLimit ) then
local msg = gsub(KickMsg, "%b[ophu]", OP)
user:SendData(Bot_N, msg)-- gsub(OKickMsg, "%b[open]", OP) )
user:Disconnect()
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
whatever i do i only get this now
Syntax Error: bad argument #1 to `strfind' (string expected, got nil)
Syntax Error: bad argument #1 to `gsub' (string expected, got nil)
done some more shuffling but still get errors
Syntax Error: bad argument #1 to `strfind' (string expected, got nil)
Syntax Error: attempt to compare nil with number
excludeUsers = {
["Nick1"]=1, --// Users who will not be checked at all
} --// and so on...
Bot_N = "OpenHubCheck"
openLimit = 1 --// Amount of Open Hubs allowed
regLimit = 1 --// Amount of Reg Hubs allowed
opLimit = 0
ophubscount = 1 --// 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 [Reg] hubs as a registered User. Which is against our Rules. Connection Terminated!"
OKickMsg = "You are in [OP] 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 Hubs,Guest,Reg,OP = scanmyinfo(user.sMyInfoString)
if switch == 1 then
if ( tonumber(openhubs) > 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
i had it kicking every1 for not bein in open hubs but that also wasnt the point but now nothing works anymore :(
where do those errors happen ? lines ?
QuoteOriginally posted by Herodes
where do those errors happen ? lines ?
Thoes r the only Error messages given out by ptokax in the script editor part
try changing this
local Hubs,Guest,Reg,OP = scanmyinfo(user.sMyInfoString)
to this ...
local Hubs,Guest,Reg,OP = scanmyinfo(strsub(data, 1 ,-2) )
lets see if it works ..
nope ;( ;( ;(
No syntax errors in script file antiopenhub.lua
Syntax Error: attempt to compare nil with number
Syntax Error: attempt to compare nil with number
any more idea's ? i've tryied changing openhubs to Hubs and vica versaand get the same errors.
I dont get anything else reported to say in which line the error is so haven't a clue to where it lies
ophubscount can only be 1 or 0 and indicate whether op hubs count into total no. of hubs or not... sry i forgot 2 mention
yeah i noticed that and u see up in my post i only set the explanation in 1 line to low ^^ so i dont think it's that causing probs but much more something in this part
function DataArrival(user, data)
if strsub(data, 1,7) == "$MyINFO" and (not excludeUsers[user.sName]) then
local Hubs,Guest,Reg,OP = scanmyinfo(user.sMyInfoString)
if switch == 1 then
if ( tonumber(openhubs) > 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
just i dont have a clue what is wrong with it just a guess that it's somewhere in this part
This line;if ( tonumber(openhubs) > openLimit ) then
to this;if ( tonumber(Guest) > openLimit ) then
and try to change to "%b[]"
yea that is a prob 2 but the real is:
excludeUsers = {
["Nick1"]=1, --// Users who will not be checked at all
} --// and so on...
Bot_N = "OpenHubCheck"
openLimit = 1 --// Amount of Open Hubs allowed
regLimit = 1 --// Amount of Reg Hubs allowed
opLimit = 0
ophubscount = 1 --// 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 [Reg] hubs as a registered User. Which is against our Rules. Connection Terminated!"
OKickMsg = "You are in [OP] 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) -- renamed the value from Hubs to openhubs, cause openhubs was an undeclared value
if switch == 1 then
if ( tonumber(openhubs) > 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
well i tried that to but it doesnt seem top help...
the only one disconnecting at all so far is this on (had tried it earlier)
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
ophubscount = 1 --// 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 [Reg] hubs as a registered User. Which is against our Rules. Connection Terminated!"
OKickMsg = "You are in [OP] 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) -- renamed the value from Hubs to openhubs, cause openhubs was an undeclared value
if switch == 1 then
if ( tonumber(openhubs) > 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
elseif temp then
return hubs,Guest,Reg,OP
else
return hubs,Guest,Reg,OP
end
end
Edit: hadnt seen your Post beforehand
and also your version bastya just take all hubs your in as open hubs and therefore just kick they dont go on to the next profile
so open hubs u mean unreg hubs? then u have bad terminology... :S
hmm well yes with Open hubs i mean hubs in witch the user has Guest status
sorry but thats the translation from german to english ^^
Edit
I speak Swiss German most of the time :D
any idea's to what's wrong?
anybody?