Simple little snippet that auto kills anyone connecting when turned on. YOU MUST BE IRCOP OR ADMIN. It does allow people from a safelist to still connect just fine. Usefull if your server is getting attacked.
menu menubar {
Protections
.Server LockDown
.. -
.. $iif($group(#lock) == on,$style(1) Enabled,Enabled): enable #lock | set %lock on | msg $chan 4Server Locked Down now started.
.. $iif($group(#lock) == off,$style(1) Disabled,Disabled): disable #lock | set %lock off | msg $chan 4Server Lockdown now terminated.
}
#lock off
on *:snotice:*Client connecting*:{
if (%lock == on) {
var %tempfilea $read(server.txt,w,$gettok($remove($9,$chr(40)),1,64))
if ($gettok(%tempfilea,0,32) != $null) { globops $9 a 4Safelist User has Connected }
else { kill $9 4Server Is Locked Down
unset %tempfilea
}
}
}
#lock end
Ohai from EzzyChat!
Besides what I've said in IRC, there are other things that you can change towards the script.
menu menubar {
Protections
.Server LockDown
.. -
.. $iif($group(#lock) == on,$style(1) Enabled,Enabled): enable #lock | set %lock on | msg $chan 4Server Locked Down now started.
.. $iif($group(#lock) == off,$style(1) Disabled,Disabled): disable #lock | set %lock off | msg $chan 4Server Lockdown now terminated.
}
#lock off
on *:snotice:*Client connecting*:{
if (%lock == on) {
var %tempfilea $read(server.txt,w,$gettok($remove($9,$chr(40)),1,64))
if ($gettok(%tempfilea,0,32) != $null) { globops $9 a 4Safelist User has Connected }
else { kill $9 4Server Is Locked Down
unset %tempfilea
}
}
}
#lock end
This code does work, but can be better.
I asked you earlier why you put set %lock on/off, and I've reconsidered to what you told me on IRC. However, I'm taking back my initial theory.
Because you are using groups, it takes care of the whole event. You don't need to have double protection for assurance.
As for the variable %tempfilea; I wouldn't use /var or /set if I am to only use it in the script once. In this case, it is only used once, so it can be removed and replaced. /unset %tempfilea can also be removed because you were only using /var.
So, from what I said, it can be shrunk down to this:
menu * {
Protections
.$iif($group(#lock) == On,$style(1)) Server Lockdown
..$iif($group(#lock) == On,$style(2)) On: .enable #lock | msg # 4Server Locked Down now started.
..$iif($group(#lock) == Off,$style(2)) Off: .disable #lock | 4Server Lockdown now terminated.
}
#lock off
on *:snotice:*Client connecting*:{
if ($gettok($read(server.txt,w,$gettok($remove($9,$chr(40)),1,64)),0,32) != $null) { globops $9 a 4Safelist User has Connected }
else { kill $9 4Server Is Locked Down }
}
#lock end
I changed the menu a little bit, because this one says if the lockdown is on or not, and disables selection for the one that is "active".
Other than that, I would explain two more things in your introduction: