|
KlasicKumputerz
|
KlasicKumputerz
|
I’m looking for a script that sets it so only Ops or channel owner can use bot commands I.E. “!rules” etc.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
That is best done on a script by script basis, rather than having one script try to check before the other scripts execute. Generally the format you are looking for would be on *:text:!command:#:{
if $nick($chan,$nick,a,hrv) {
;rest of code for the specified command
}
}
|
|
|
|
KlasicKumputerz
|
KlasicKumputerz
|
So as an example it would be something like this:
on *:text:!command:#:{ if $nick($chan,$nick,a,hrv) { ;!rules1 ;!rules2 ;!websites } }
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
Yeah the easiest way you can do is add a bunch of if statements for the commands to trigger. on *:text:*:#: {
if $nick($chan,$nick,a,hrv) {
if ($1 == !rules1) {
;code here
}
if ($1 == !rules2) {
;code here
}
if ($1 == !websites) {
;code here
}
}
}
|
|
|
|
gooshie
|
gooshie
|
$nick($chan,$nick,a,hrv) != $nick($chan,$nick,~&@) If an op, admin, or founder also has mode +h or +v set it will fail.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Please don't make statements regarding parts of my code when showing your altered code.
The code I posted will work since the hrv excludes those levels, but an op/admin/founder that also has those levels will return multiple levels.
eg: When I join a channel that I'm the founder of, I get mode +qo set If I then use //mode #channel +hrv $me $me $me That gives me modes qohvr thus $nick(#channel,$me,a,hrv) would still return $true as I also have the modes qo on my nick.
|
|
|
|
gooshie
|
gooshie
|
Are you sure? Have you actually tried it? Because I have long ago and I just tested it again. ...thus $nick(#channel,$me,a,hrv) would still return $true ... Maybe you should test it again because it does not return $true or $false it returns nothing or a number indicating nicklist position. This is usefull in an if statement since mIRC evaluates $true everything except $false, $null, $chr(0), 0 or nothing. If I then use //mode #channel +hrv $me $me $me You can NOT set mode +r BTW, you don't even need to test it by being a founder.. /join #anychannelnotownedandempty to automatically get ops.. then //mode # +hv $me $me then.. //echo test $nick(#,$me,a,hrv) != $nick(#,$me,~&@) Please don't make statements regarding parts of my code when showing your altered code. How do you propose I bring it to your attention when you are wrong?
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
The way to show that you think that I'm incorrect is to show a comparison of the two codes, not just one code.
As to your statement, I have just re-tested and found something very interesting.
On the network where I am a Network Admin (IRCops access), my code works fine, but when I removed my IRCops access, I got the same results that you did.
It appears that my IRCops access gives a different return, although why I do not know.
Thus, I apologize for the code I posted as most people would not have the access which I was getting correct results from.
|
|
|
|
gooshie
|
gooshie
|
Interresting.. when I am Network Admin it doesn't change the results of //echo test $nick(#,$me,a,hrv) != $nick(#,$me,~&@)
Many people misinterpet $nick(#,$me,a,hrv) to mean 'all nicks minus those who have no user modes (regulars) and minus nicks who ONLY have voice and helpop' ... more accurate interpretation is 'all nicks except regulars or nicks that have voice and helpop mode'
|
|
|
|
Joined: Nov 2006
Posts: 1,552
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,552 |
Albeit a bit late, here's a different approach. It should account for "fancy" prefixes/nickmodes too: ; $reqmode(<prefix or nickmode>[,<chan>,<nick>])
; a) if <prefix or nickmode> is provided only, return corresponding and all higher prefixes
; example: on a default unreal IRCd, both $reqmode(a) and $reqmode(&) will return: "~&"
; b) if chan and nick are provided, return $true if <nick> has at least <prefix or nickmode>-status on <chan>
; example: if you're "&%" in #chan, $reqmode(~,#chan,$me) returns $false and $reqmode(o,#chan,$me) returns $true
alias reqmode {
var %p = $iif(($1 isincs $prefix) || ($1 isincs $nickmode),$mid($prefix,1,$poscs($v2,$v1,1)))
return $iif(($2 == $null),%p,$iif(($3 !isreg #$2) && ($left($nick($v2,$v1).pnick,1) isincs %p),$true,$false))
} Edit: comments typo
|
|
|
|
s00p
|
s00p
|
Lets do battle and then have a cup of tea! alias reqmode {
var %p $iif($poscs($prefix,$1) || $poscs($nickmode,$1),$left($prefix,$v1))
if ($0 <= 1) return %p
return $iif($left($nick(#$2,$3).pnick,1) isincs %p,$v1)
} It's not the same, I know... returns the prefix on match, or nothing on mismatch.
Last edited by s00p; 15/01/10 04:39 AM.
|
|
|
|
|