PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Marco52 on 22 September, 2004, 20:50:39

Title: NEED BOT WHO KICK TWISTING USERS
Post by: Marco52 on 22 September, 2004, 20:50:39
Hi. I have small dc-hub. Some of my users enter and leave my hub many times a day. Is there any
bot who kick user who enter hub too many times? E.g BOT kick users who enter and leave more than
four times a day.

Thanks for any help.
Title:
Post by: Herodes on 22 September, 2004, 21:02:37
TYPING ALL CAPS DOESNT DRAW ATTENTION !!!!!
IN TEXT BASED INTERNET COMMUNICATION IT IS TREATED AS SCREAMING !

so pls dont do that again because many many ppl have sensitive ears around here ... :)

--- disconnect Users
--- by Herodes
--- request by Marco52
maxTimes=4

tUsers = {}

function Main()
SetTimer(24*60*60*1000)
StartTimer()
end

function NewUserConnected(user)
if tUsers[user.sName] == nil then
tUsers[user.sName] = 1
elseif tUsers[user.sName] >= 1 then
tUsers[user.sName] = tUser[user.sName] + 1
elseif tUsers[user.sName] == maxTimes then
user:SendData("Disconnector", "You cant login more than "..maxtimes.." in this hub ..")
user:Disconnect()
end
end

I dont think that this is excatly what u need eventhough it does what u asked for exactly :)
.. but try it ..
Title:
Post by: Marco52 on 23 September, 2004, 01:24:19
Hi. Thanks for script but unfortunately it doesnt work :/
I tried to log in and logout to hub more than four times but Bot didnt kick me. I noticed that when I log to hub second time serwer showed a syntax error in script:

Syntax Error: attempt to index global `tUser' (a nil value)

Thanks. Maybe you will be able to correct it. ;)
Title:
Post by: nErBoS on 23 September, 2004, 01:38:55
Hi,

Fixed...

--- disconnect Users
--- by Herodes
--- request by Marco52
maxTimes=4

tUsers = {}

function Main()
SetTimer(24*60*60*1000)
StartTimer()
end

function NewUserConnected(user)
if tUsers[user.sName] == nil then
tUsers[user.sName] = 1
elseif tUsers[user.sName] >= 1 then
tUsers[user.sName] = tUsers[user.sName] + 1
elseif tUsers[user.sName] == maxTimes then
user:SendData("Disconnector", "You cant login more than "..maxtimes.." in this hub ..")
user:Disconnect()
end
end

Best regards, nErBoS
Title: something missing..
Post by: tezlo on 23 September, 2004, 18:17:24
function OnTimer()
tUsers = {}
end
Title:
Post by: Herodes on 24 September, 2004, 01:45:59
as tezlo has brilliantly observed--- disconnect Users
--- by Herodes
--- request by Marco52
maxTimes=4

tUsers = {}

function Main()
SetTimer(24*60*60*1000)
StartTimer()
end

function OnTimer()
tUsers = {}
end

function NewUserConnected(user)
if tUsers[user.sName] == nil then
tUsers[user.sName] = 1
elseif tUsers[user.sName] >= 1 and tUsers[user.sName] < maxTimes then
tUsers[user.sName] = tUsers[user.sName] + 1
elseif tUsers[user.sName] == maxTimes then
user:SendData("Disconnector", "You cant login more than "..maxTimes.." in this hub ..")
user:Disconnect()
end
end
Title:
Post by: Marco52 on 24 September, 2004, 23:24:02
Thanks for help but it still doesnt work :( Have you tried this script on your computer? I tried it several times but bot doesnt work... I have very poor knowledge about lua script language that's why if you want to help me .. please paste whole code in the forum.

Thanks for your help and still waiting for working BOT

Marco
Title:
Post by: Herodes on 25 September, 2004, 15:58:01
yeah I just tested and made some small edits ... it works as expected ...

[*note*] last post by me with code edited