need a touch
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

need a touch

Started by Psycho_Chihuahua, 24 April, 2005, 19:48:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Psycho_Chihuahua

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
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

jiten

#1
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

Dessamator

yikes, do my eyes deceive me, jiten, first script thats not a mod, :D
Ignorance is Bliss.

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

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,  ;)
Ignorance is Bliss.

Psycho_Chihuahua

Thnx a lot jiten, seems to be working ( i assume the SetTimer(10000) is 10 minutes, so i gotta wait a bit
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

jiten

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

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Herodes

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

plop

yea that looks like it.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Psycho_Chihuahua

seems to be working ^^ thnx alot herodes
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

QuoteOriginally posted by Psycho_Chihuahua
seems to be working ^^ thnx alot herodes
you are welcome Psycho ;)

kunal

is it possible to allow someusers by the cmd !allow [nick] to not pass this check

bastya_elvtars

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.
Everything could have been anything else and it would have just as much meaning.


kunal

can someone add a immune function for this script

SMF spam blocked by CleanTalk