Can this be fix to lua.5
-- Anti Open Hub Bot
-- by NightLitch
-- minor bugfix by psycho_chihuahua
DisconnectMessage = "### PLEASE close the public Hub ###."
function DataArrival( sUser , sData )
if strsub( sData , 1 , 7 ) == "$MyINFO" then
local _,_,openhubs = strfind( sData , ".+H:(%d+)" );
if ( openhubs ~= "0" ) then
SendToNick( sUser.sName , DisconnectMessage )
sUser:Disconnect()
end
end
end
-- Anti Open Hub Bot
-- by NightLitch
-- minor bugfix by psycho_chihuahua
-- Converted to lua5 by Madman
DisconnectMessage = "### PLEASE close the public Hub ###."
function MyINFOArrival( sUser , sData )
if ( sUser.iNormalHubs ~= "0" ) then
SendToNick( sUser.sName , DisconnectMessage )
sUser:Disconnect()
end
end
Give this a try...
Thanks you fix it
it seams to not work X(
maybe this : anti-open-hub by ?????? and not tested.
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", "Du bist in PublicHubs. Die Verbindung wird in "..iTimeAfter.." Secunden unterbrochen")
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." )
elseif user.iNormalHubs > 0 then
tBadOnes[nick] = tBadOnes[nick] - 1
if tBadOnes[nick] == 0 then
tBadOnes[nick] = nil
user:SendData( "PtokaX", "Disconnect wegen Publichubs." )
user:Disconnect()
elseif tBadOnes[nick] == math.floor( iTimeAfter / 2 ) then
user:SendData ( "PtokaX", " Bitte keine PublicHubs . Du hast noch "..math.floor( iTimeAfter / 2 ).." Secunden bis zur Trennung.." )
end
end
end
end
end
function UserDisconnected(user)
if tBadOnes[user.sName] then
tBadOnes[user.sName] = nil
collectgarbage();
end
end
Have test it in hub not work!!