PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: ?????k?? on 04 April, 2005, 18:04:45

Title: limited unregged users script
Post by: ?????k?? on 04 April, 2005, 18:04:45
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
Title:
Post by: [UK]Madman on 04 April, 2005, 18:33:48
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


Title:
Post by: ?????k?? on 04 April, 2005, 18:51:01
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
Title:
Post by: ??????Hawk?????? on 04 April, 2005, 18:55:29
Maby with this function added



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


 :P  :P  :P

Edited Code

??????Hawk??????
Title:
Post by: [UK]Madman on 04 April, 2005, 19:05:14
OOoooppppssssssyyyyyyy

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

Fancy forgetting to take leaving users into account  :P  :P
Title:
Post by: ??????Hawk?????? on 04 April, 2005, 19:17:31
hehehehehe   easy done m8  ...  

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


??????Hawk??????
Title:
Post by: Shurlock on 05 April, 2005, 01:39:20
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.