On my forum, we have 2 irc channels--one for staff, and one for all of my users. I got tired of people forgetting the password to the staff channel, so I wrote this little script. Only people with operator and above can use this command. Otherwise, it sends you a notice saying that you do not meet criteria to join the staff room. The but must also be op in the channel as to which you want the user invited you.
!staffme is the only command you have to use.
On the third line, change #insertstaffchanhere to the channel that you want to have the user to be invited to.
First script :-)
on *:TEXT:!staffme:#: {
if ($nick isop $chan) {
invite $nick #insertstaffchanhere
notice $nick Invite sent.
}
else {
msg $chan Sorry, you dont meet the criteria, $nick
notice $nick No staff, no invite ..
}
}
Heres a Time Saver...
/*
If you did this in your server config, Saves time, when your staff get their O-Lines points it to your Staff channel, just a thought.
....
Instead of using
on *:TEXT:!staffme:#: {
if ($nick isop $chan) {
You can set the channel to a variable and make it to only pick up on the command IN that channel. Let me break down my code for you.
;When you load the script it will run this..
on *:load: {
;setting the channel set for the staff only
set %StaffChan $$?="What is the staff channel?"
;setting the channel the StaffChan is set to look for ops in
set %UserChan $$?="What is the user channel?"
}
;This uses %UserChan because that would be the channel you want the ops to be able to ;get access to your staffchan
on *:text:!StaffMe:%UserChan: {
;checking if the user has op in %UserChan, if they do it will invite them to %StaffChan
if ($nick isop #) { invite $nick %StaffChan | notice $nick Invite sent. }
;But if they aren't
else {
notice $nick Denied. You aren't op in %UserChan $+ .
msg %StaffChan $nick tried to get in.
;It will deny them, and notify %StaffChan that they tried to get in.
}
}
What would you do if someone who was op in another channel you were in typed the command to gain access to the staff channel that was for the staff of your user channel?
on *:TEXT:!staffme:#: {
if ($nick isop $chan) {
invite $nick #insertstaffchanhere
notice $nick Invite sent.
}
else {
msg $chan Sorry, you dont meet the criteria, $nick
notice $nick No staff, no invite ..
}
}
Your code is functional, but only to a degree.
Try...
on *:load: {
set %StaffChan $$?="What is the staff channel?"
set %UserChan $$?="What is the user channel?"
}
on *:text:!StaffMe:%UserChan: {
if ($nick isop #) { invite $nick %StaffChan | notice $nick Invite sent. }
else {
notice $nick Denied. You aren't op in %UserChan $+ .
msg %StaffChan $nick tried to get in.
}
}