| View previous topic :: View next topic |
| Author |
Message |
Repdientu Voice
Joined: 30 Apr 2009 Posts: 33 Location: Viet Nam
|
Posted: Fri Jul 10, 2020 8:27 am Post subject: |
|
|
| simo wrote: | | the codes in the urls i posted do exactly that checking if user has a registered nick on join of vhost channel |
i not ower the network. i am only ircops on it. i want to make bot to used !vhost to give vhost user on the network too. the codes in your post is set vhost user. but i want to make only ower/master/op of the bot can used this command to give vhost for user. |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri Jul 10, 2020 10:38 am Post subject: |
|
|
| caesar wrote: | What's with the $args[0] in there CrazyCat? TCL doesn't know that stuff.
Anyway, here's something:
| Code: |
bind pub mn !vhost change:vhost
proc change:vhost {nick uhost hand chan text} {
if {[scan $text {%s%s} user host] != 2} {
puthelp "NOTICE $nick :Error, sytnax is: !vhost <nick> <vhost>"
return
}
puthelp "CHGHOST $user $host"
puthelp "NOTICE $nick :Changed $user host to $host"
}
|
|
Caesars Code does exactly that, it only allow's global +m and channel +n to change a user's vhost. _________________ ComputerTech |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Fri Jul 10, 2020 11:03 am Post subject: |
|
|
| only now you provided more info as to what the criteria are and the conditions you work with then indeed caesars code will do the job only the vhosts arent permant so they would have to come to channel to get vhost everytime |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri Jul 10, 2020 1:58 pm Post subject: |
|
|
Thats True, as simo says the vhost would only be active until the user disconnects  _________________ ComputerTech |
|
| Back to top |
|
 |
Repdientu Voice
Joined: 30 Apr 2009 Posts: 33 Location: Viet Nam
|
Posted: Fri Jul 10, 2020 9:52 pm Post subject: |
|
|
| Thank you. Can i set it work only channel ? |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Jul 11, 2020 8:18 am Post subject: |
|
|
| yes you can |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Jul 11, 2020 9:22 am Post subject: |
|
|
try this:
| Code: |
set scan(chan) "#vhost"
bind pub mn !vhost change:vhost
proc change:vhost {nick uhost hand chan text} {
global scan(chan)
if {$chan != "$scan(chan)"} {
putserv "NOTICE $tls_nick : Don't Use This Command Outside $scan(chan)"
return 0
}
if {[scan $text {%s%s} user host] != 2} {
puthelp "NOTICE $nick :Error, sytnax is: !vhost <nick> <vhost>"
return
}
puthelp "CHGHOST $user $host"
puthelp "NOTICE $nick :Changed $user host to $host"
}
|
|
|
| Back to top |
|
 |
Repdientu Voice
Joined: 30 Apr 2009 Posts: 33 Location: Viet Nam
|
Posted: Sun Jul 12, 2020 12:58 am Post subject: |
|
|
| thank you, i will try it |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Jul 16, 2020 9:24 am Post subject: |
|
|
| Code: |
global scan(chan)
if {$chan != "$scan(chan)"} {
putserv "NOTICE $tls_nick : Don't Use This Command Outside $scan(chan)"
return 0
}
|
@simo I see 3 issues with your code:
- it should be 'global scan' (notice the lack of (chan) part)
- there's no $tls_nick variable
- the if {$chan != "$scan(chan)"} will fail when the to names won't be at the upper or lower case, so use string equal -nocase to be sure the stuff will match no matter the case.
Updated code:
| Code: |
set scan(chan) "#vhost"
bind pub mn !vhost change:vhost
proc change:vhost {nick uhost hand chan text} {
global scan
if {![string equal -nocase $scan(chan) $chan]} {
puthelp "NOTICE $nick :Don't Use This Command Outside $scan(chan)"
return
}
if {[scan $text {%s%s} user host] != 2} {
puthelp "NOTICE $nick :Error, sytnax is: !vhost <nick> <vhost>"
return
}
puthelp "CHGHOST $user $host"
puthelp "NOTICE $nick :Changed $user host to $host"
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Jul 16, 2020 9:42 am Post subject: |
|
|
| tnx caesar |
|
| Back to top |
|
 |
Repdientu Voice
Joined: 30 Apr 2009 Posts: 33 Location: Viet Nam
|
Posted: Wed Jul 22, 2020 12:33 am Post subject: |
|
|
| thank you |
|
| Back to top |
|
 |
|