limited unregged users script
 

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

limited unregged users script

Started by ?????k??, 04 April, 2005, 18:04:45

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

?????k??

Hi there, i was wondering if anyone could help me, i'm looking for a basic script to run along side Robocop v10.01c The point of the new script would be to be able to set my maximum users as high or low as i want but to put a limit on the amount of unregisterd users that can connect to the hub, for example 100.
Thanks in advance for any help in this matter, Sneeks

[UK]Madman

#1
Done quickly and not tested....

-- Limit unregged users
-- By [UK]Madman

sBot = "Unreg-counter"
iMaxunreg = 100
iCurrentunreg = 0

function Main()
	for key,value in frmHub:GetOnlineUsers() do
		if not value.bRegistered then
				iCurrentunreg = iCurrentunreg + 1
		end
	end
end

function NewUserConnected(tCuruser)
	if not tCuruser.bRegistered then
		iCurrentunreg = iCurrentunreg + 1
		if iCurrentunreg >= iMaxunreg then
			tCuruser:SendData(sBot,"Unfortunatly, there are too many unregistered users in the hub, Please try again later!")
			tCuruser:Disconnect()
		end
	end
end

function UserDisconnected(tCuruser) 
	if not tCuruser.bRegistered then
		iCurrentunreg = iCurrentunreg - 1
	end
end

?????k??

That seems to be working great, i knew that to someone in the know it would be a simple task thank you very much for your time, Sneeks

??????Hawk??????

#3
Maby with this function added


function UserDisconnected(tCuruser) 
	if not tCuruser.bRegistered then
		iCurrentunreg = iCurrentunreg - 1
	end
end


 :P  :P  :P

Edited Code

??????Hawk??????

[UK]Madman

OOoooppppssssssyyyyyyy

Thanks hawk, ill add that to the above  :P  :P

Fancy forgetting to take leaving users into account  :P  :P

??????Hawk??????

hehehehehe   easy done m8  ...  

youll notice  every post i make with code  is always  edited  ...  lolol


??????Hawk??????

Shurlock

Nice option!

Maybe NOT so nice, but..... would it also be possible to give preference to REGGED users once the max number of users has been reached?

What I would like is:
if a regged users wishes to enter while hub is full, then (at random) disconnect an unregged user after having sent him/her an apologizing PM.

Just wondering if it can be done.
If it can, I'll do it.  8)

Thnx in advance.
If it's raining and your roof leaks, fix the roof. DON'T try to stop the rain!!

SMF spam blocked by CleanTalk