PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Teddy on 26 July, 2005, 19:56:30

Title: NO Public Bot
Post by: Teddy on 26 July, 2005, 19:56:30
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
Title:
Post by: Madman on 26 July, 2005, 21:29:07
Code: [Select]
-- 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...
Title: Thanks alot
Post by: Teddy on 26 July, 2005, 22:01:51
Thanks you fix it
Title: No NO SORRY
Post by: Teddy on 26 July, 2005, 22:17:06
it seams to not work  X(
Title:
Post by: James on 26 July, 2005, 22:54:44
maybe this : anti-open-hub by ?????? and not tested.

Code: [Select]
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
Title: NO Sorry this not work!!
Post by: Teddy on 26 July, 2005, 23:24:56
Have test it in hub not work!!