i have been trying to adapt my old "anti-openhub-script" to the new hubsoft and all i have atm is this
function NewUserConnected(user)
if user.iNormalHubs then
if user.iNormalHubs>0 then
user:SendData( "PtokaX", "You are in unregistered hubs. This is against our rules. You will now be disconnected!")
user:Disconnect()
end
end
end
Now, could someone adapt it a bit so that it checks in intervalls instead of only when someone connects? Please, i need this one quit urgently :D
Give this a try:
-- Timed Anti-openhub-script by jiten
RegCheck = {}
function Main()
SetTimer(10*60*1000) -- Default Checking Time set for 10 minutes
StartTimer()
end
function NewUserConnected(user)
if user.iNormalHubs then
RegCheck[user.sName] = 1
if user.iNormalHubs>0 then
user:SendData( "PtokaX", "You are in unregistered hubs. This is against our rules. You will now be disconnected!")
user:Disconnect()
end
end
end
-- OpConnected = NewUserConnected
function OnTimer()
for i,v in RegCheck do
local nick = GetItemByName(i)
if GetItemByName(i).iNormalHubs > 0 then
nick:SendData( "PtokaX", "You are in unregistered hubs. This is against our rules. You will now be disconnected!")
nick:Disconnect()
end
end
end
function UserDisconnected(user)
if user.iNormalHubs and RegCheck[user.sName] ~= nil then
RegCheck[user.sName] = nil
end
end
-- OpDisconnected = UserDisconnected
*EDIT* Changed some code
Cheers
yikes, do my eyes deceive me, jiten, first script thats not a mod, :D
why not like this??
function MyINFOArrival(user)
if user.iNormalHubs then
if user.iNormalHubs>0 then
user:SendData( "PtokaX", "You are in unregistered hubs. This is against our rules. You will now be disconnected!")
user:Disconnect()
end
end
end
plop
hmm plop, because of this::
QuoteNow, could someone adapt it a bit so that it checks in intervalls instead of only when someone connects? Please, i need this one quit urgently :D
in intervals, ;)
Thnx a lot jiten, seems to be working ( i assume the SetTimer(10000) is 10 minutes, so i gotta wait a bit
QuoteOriginally posted by Dessamator
yikes, do my eyes deceive me, jiten, first script thats not a mod,
Indeed :D
QuoteOriginally posted by Psycho_Chihuahua
Thnx a lot jiten, seems to be working ( i assume the SetTimer(10000) is 10 minutes, so i gotta wait a bit
yw m8...
Btw, changed the script so now it checks in an interval of 10 minutes.
The "1000" meant 10 seconds ;)
Cheers
QuoteOriginally posted by Dessamator
hmm plop, because of this::
QuoteNow, could someone adapt it a bit so that it checks in intervalls instead of only when someone connects? Please, i need this one quit urgently :D
in intervals, ;)
ok, i take that as a nice excuse. lol
btw what if a user is in a so called open hub while entering.
but then he sees the rules and closes the open hub.
the user would still get kicked.
and for some users it might take 10 mins, while others could get kicked within 10 seconds.
plop
maybe this ? tBadOnes = {}
iTimeAfter = 15 -- how many seconds before disconnecting
function Main()
SetTimer( 1000 )
StartTimer()
end
function NewUserConnected(user)
if user.iNormalHubs then
if user.iNormalHubs > 0 then
tBadOnes[user.sName] = iTimeAfter
user:SendData( "PtokaX", "You are in unregistered hubs. This is against our rules. You will be disconnected in "..iTimeAfter.." seconds from now!")
end
end
end
function OnTimer()
for nick, v in tBadOnes do
local user = GetItemByName( nick )
if user.iNormalHubs then
if user.iNormalHubs == 0 then
tBadOnes[nick] = nil
user:SendData( "PtokaX", "Thanks for adjusting your unregistered hubs so that it conforms with our rules." )
elseif user.iNormalHubs > 0 then
tBadOnes[nick] = tBadOnes[nick] - 1
if tBadOnes[nick] == 0 then
tBadOnes[nick] = nil
user:SendData( "PtokaX", "You are being disconnected because you didn't conform to the hub rules. You were in unregistered hubs." )
user:Disconnect()
elseif tBadOnes[nick] == math.floor( iTimeAfter / 2 ) then
user:SendData ( "PtokaX", "You should really disconnect from the hubs that you aren't registered. it is not allowed in this hub. You have "..math.floor( iTimeAfter / 2 ).." seconds left disconnection follows after that.." )
end
end
end
end
end
function UserDisconnected(user)
if tBadOnes[user.sName] then
tBadOnes[user.sName] = nil
collectgarbage();
end
end
yea that looks like it.
plop
seems to be working ^^ thnx alot herodes
QuoteOriginally posted by Psycho_Chihuahua
seems to be working ^^ thnx alot herodes
you are welcome Psycho ;)
is it possible to allow someusers by the cmd !allow [nick] to not pass this check
QuoteOriginally posted by kunal
is it possible to allow someusers by the cmd !allow [nick] to not pass this check
Some users or certain user classes?
Only non-ops get checked.
not certain user class but some users.
can someone add a immune function for this script