PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: ????????? on 28 June, 2004, 16:44:10

Title: Script to dissconnect non reg users after a certain amount of time
Post by: ????????? on 28 June, 2004, 16:44:10
Is There any way too kick non regged users after a set amount of time??
Any help would be great thx :)
 :P
Title:
Post by: [UK]Madman on 28 June, 2004, 18:37:16
I have a script like this at home, i will try to remember to post it when i get in.  :))
Title:
Post by: ????????? on 28 June, 2004, 20:56:12
Thx madman ;c) appreciate it :)
Title:
Post by: ????????? on 29 June, 2004, 12:58:57
Thx Mutor :)

Not tested it yet but looks like just the script we are looking for :)

Will test it and let u know how we go on....

Thx again for your time and effort :c)

Really appreciate it :)

?????????  :P
Title:
Post by: ????????? on 29 June, 2004, 13:25:43
getting an error  :(

stack traceback:
   1:  function `OnTimer' at line 27

any help would be appreciated.....

thx ?????????
Title:
Post by: oblivion on 29 June, 2004, 13:35:42
Syntax Error: attempt to index local `kicked' (a nil value)
Syntax Error: attempt to index local `kicked' (a nil value)
Syntax Error: attempt to index local `kicked' (a nil value)
Syntax Error: attempt to index local `kicked' (a nil value)
Title:
Post by: ????????? on 29 June, 2004, 15:36:45
nope still the same problem :(

I'm Running 0.3.3.0 15.25 debug

Thx for ya help :) and your efforts

?????????
Title: redirect
Post by: Psycho_Chihuahua on 29 June, 2004, 16:54:20
Is it possible to redirect instead of kick?
Title:
Post by: [UK]Madman on 29 June, 2004, 17:02:16
Heres the one i pulled out of another bot i wrote.

theres 1 command .. ?notreg
this will cause the bot to pm you a list of ppl in hub not regged.

Also added a warning after half their time has elapsed.

restarting the scripts will cause the timers to go blank tho, so ppl already in the hub will stay :(


-- reg to stay bot --

var = {["bot"] = "Reg_to_stay", ["time"] = 10, ["ban"] = 10, ["command"] = "?notreg"}
times = {}


function Main()
frmHub:RegBot(var.bot)
SetTimer(60000*(tonumber(var.time)/4))
StartTimer()
end

function NewUserConnected(Curuser)

if Curuser.iProfile == -1 then
times[Curuser.sName] = var.time
Curuser:SendData (var.bot, "You have to register to stay in this hub, you currently have: "..var.time.." mins to register!")
end
end

function UserDisconnected (Curuser)
times[Curuser.sName] = Nil
end

function OnTimer()
for key, value in times do
value = value - (var.time/4)
times[key] = value

if value == 0 then tokick = GetItemByName(key)
times[tokick] = nil
tokick:SendData (var.bot, "You did not register, so are now temp banned for: "..var.ban.." mins!")
tokick:TimeBan(var.ban)

elseif value == (var.time - tonumber(var.time)/2) then towarn = GetItemByName(key)
towarn:SendData (var.bot, "You have not registered, you will be kicked in: "..value.." mins unless you register!")
end
end
end

function DataArrival(Curuser,data)
data = strsub(data, 1, strlen(data)-1)
if strsub(data, 1, 1) == "<" then
s,e,cmd = strfind(data, "%b<>%s+(%S+)")

if cmd == var.command and Curuser.bOperator then
Curuser:SendPM (var.bot, "The following users are currently not regged:")
for key, value in times do
Curuser:SendPM (var.bot, key.." Has approx "..value.." mins till a kick!")
end
return 1; end
end
end



Im still very new to this, so plz tell me if this is the long way round :P

and it is possible to set it to redirect and not kick, cant remember how at the mo tho :P

PS. not tested until i get home
Title:
Post by: ????????? on 29 June, 2004, 19:42:43
sorry madman :( no joy with that 1 either............

T.I.A

?????????
Title:
Post by: [UK]Madman on 29 June, 2004, 20:37:06
ooppsssss,

ammended above post, works fine now :)
Title:
Post by: Herodes on 29 June, 2004, 22:48:32
QuoteOriginally posted by [UK]Madman
[...]
and it is possible to set it to redirect and not kick, cant remember how at the mo tho :P

maybe this could give a hint ..

user:SendData("$ForceMove "..frmHub:GetRedirectAddress())
good idea for a script ...

how could we have it triggering time indepentent, for each user >?
--- maybe clock() could help ? but i don't know how to use it efficiently atm ...
I think it returns milliseconds ... I am not sure thought .
Title:
Post by: ????????? on 30 June, 2004, 01:00:28
Nice work mad man :)

Works a treat just gone from 200+ in one off our network hubs to 48 users :)

Like to say ty too all who have replyed and given time in doing so        it s apprecitatted big time :)

Many Thx again :)

?????????
Title:
Post by: [UK]Madman on 30 June, 2004, 01:19:49
Good Idea Herodes, you cud replace the banning command with your $fourcemove :)



tokick:TimeBan(var.ban)


with

tokick:SendData ("$ForceMove "..frmHub:GetRedirectAddress())


Ill have a play with the clock command :)

and yvw ????????? :)
Title:
Post by: Reefa on 02 July, 2004, 12:10:45
The script is great!!! Thank you :)

Any way to get the bot to notify them every 5 minutes?

Ta :P

EDIT: I have set the ban time to 30minutes and both of the (var.time)/4 to (var.time)/6 so it will notify every 5 minutes, but the unregged still only get 1 PM message after 5 minutes have elapsed... Can anyone help?

Changed:

elseif value == (var.time - tonumber(var.time)/2) then towarn = GetItemByName(key)

To

elseif value == (value) then towarn = GetItemByName(key)

Seems to be ok now :)
Title:
Post by: Reefa on 02 July, 2004, 16:28:15
What's the lua to make the kick message appear in the hub bot please?

Ta :)
Title:
Post by: Psycho_Chihuahua on 02 July, 2004, 16:35:29
       --???????????????????????????????????????????????????????????????????????????????
--?               ???????????? HELVETIA REG HUB ????????????               ?
        --???????????????????????????????????????????????????????????????????????????????
addy="oberlausitzer.homeip.net" -- ? <<<<< Hier die UmleitungsAdresse angeben ?
-- ??????????????????????????????????????????????
text= "This Hub is for RegUsers only\n"..
"  <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n"..
" Here some info to show the Unreg User\n"..
"  <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n"..
" Here some more info to show\n" -- ? <<<<< Hier denn zusendenen Text angeben ?
        --???????????????????????????????????????????????????????????????????????????????
--?                        ???????????? Oberlausitzer Open Hub ????????????                        ?
        --???????????????????????????????????????????????????????????????????????????????
function NewUserConnected(user)
 if (user.iProfile == -1) then
  if (user.sName =="{HubListPinger}") then
  else
user:SendData(text.."|$ForceMove "..addy.."|")
  end
 end
end
function DataArrival(user,data)
 if (strsub( data, 1, 8 ) == "$MyINFO ") and (user.iProfile == -1) then
  if (user.sName =="{HubListPinger}") then
  else
user:SendData(text.."|$ForceMove "..addy.."|")
  end
 end
end

This is what i do at the moment......to redirect all UnregUsers to my Parttnerhub except the HubListPinger
Title:
Post by: [UK]Madman on 02 July, 2004, 19:34:07
Not sure what ya mean reefa .. wen a user is kicked, show it in main chat, or opchat ??
Title:
Post by: Reefa on 02 July, 2004, 20:15:39
We are running RC 8.0b as our security bot and when a user is kicked/regged/timebanned it appears in the security bot window...

So it would be nice to continue to have that so we know who's come and gone, i.e. <-=Hub-Bot=-> user Joe_Bloggs has been banned> for: 0 hours : 30 minutes - Reason: You have failed to register

hope that makes sense!
Title:
Post by: [UK]Madman on 09 July, 2004, 01:27:57
replace the function ontimer with this 1


function OnTimer()
for key, value in times do
value = value - (var.time/4)
times[key] = value

if value == 0 then tokick = GetItemByName(key)
times[tokick] = nil
tokick:SendData (var.bot, "You did not register, so are now temp banned for: "..var.ban.." mins!")
tokick:TimeBan(var.ban)
SendPmToOps(var.bot, " User "..tokick.." has been banned for: 0 hours : "..var.ban.." minutes - Reason : You have failed to register")

elseif value == (var.time - tonumber(var.time)/2) then towarn = GetItemByName(key)
towarn:SendData (var.bot, "You have not registered, you will be kicked in: "..value.." mins unless you register!")
end
end
end


and change the bot name at the top to the same name as the hub bot...

e.g.


var = {["bot"] = "-=Hub-Bot=-", ["time"] = 10, ["ban"] = 10, ["command"] = "?notreg"}

Title:
Post by: Reefa on 09 July, 2004, 21:30:48
Ah, so simple, many thanks :)

EDIT: Slight problem...

QuoteSyntax error: attempt to concat global `tokick' (a table value)
stack traceback:
   1:  function `OnTimer' at line 34 [file `...tware [Robo v8.0b]\scripts\Unreg Timer Kick.lua']

?(
Title:
Post by: NightLitch on 10 July, 2004, 00:30:42
code fixing:

function OnTimer()
for key, value in times do
value = value - (var.time/4)
times[key] = value

if value == 0 then tokick = GetItemByName(key)
times[tokick] = nil
tokick:SendData (var.bot, "You did not register, so are now temp banned for: "..var.ban.." mins!")
tokick:TimeBan(var.ban)
SendPmToOps(var.bot, " User "..tokick.sName.." has been banned for: 0 hours : "..var.ban.." minutes - Reason : You have failed to register")

elseif value == (var.time - tonumber(var.time)/2) then towarn = GetItemByName(key)
towarn:SendData (var.bot, "You have not registered, you will be kicked in: "..value.." mins unless you register!")
end
end
end
var = {["bot"] = "-=Hub-Bot=-", ["time"] = 10, ["ban"] = 10, ["command"] = "?notreg"}

/NL
Title:
Post by: Reefa on 10 July, 2004, 22:31:49
Perfect, thanks :)