|
Joined: Jun 2004
Posts: 124
Vogon poet
|
OP
Vogon poet
Joined: Jun 2004
Posts: 124 |
how can i make OP immune to this scripts its a anti-swear script? anyone? alias swear {
return swear1 swear2 swear3
}
On *:Text:*:#channel: {
if (!$hget(swear)) hmake swear 10
var %swr = 1
while ($gettok($swear,%swr,32)) {
if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
hinc swear $nick
var %swear = $gettok($swear,%swr,32)
if ($hget(swear,$nick) == 1) do something here
if ($hget(swear,$nick) == 3) .do something here
}
inc %swr
}
}
On *:Action:*:#channel: {
if (!$hget(swear)) hmake swear 10
var %swr = 1
while ($gettok($swear,%swr,32)) {
if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
hinc swear $nick
var %swear = $gettok($swear,%swr,32)
if ($hget(swear,$nick) == 1) do something here
if ($hget(swear,$nick) == 3) do something here
}
inc %swr
}
}
|
|
|
|
Joined: Jan 2010
Posts: 6
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Jan 2010
Posts: 6 |
Hey there, To make your code immune to OPs and yourself... Here is one way you can do it alias swear {
return swear1 swear2 swear3
}
On !*:Text:*:#channel: {
if ($nick !isop #) {
if (!$hget(swear)) hmake swear 10
var %swr = 1
while ($gettok($swear,%swr,32)) {
if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
hinc swear $nick
var %swear = $gettok($swear,%swr,32)
if ($hget(swear,$nick) == 1) do something here
if ($hget(swear,$nick) == 3) .do something here
}
inc %swr
}
}
}
On !*:Action:*:#channel: {
if ($nick !isop #) {
if (!$hget(swear)) hmake swear 10
var %swr = 1
while ($gettok($swear,%swr,32)) {
if ($+(*,$gettok($swear,%swr,32),*) iswm $1-) {
hinc swear $nick
var %swear = $gettok($swear,%swr,32)
if ($hget(swear,$nick) == 1) do something here
if ($hget(swear,$nick) == 3) do something here
}
inc %swr
}
}
} By adding a ! prefix to your on EVENTs, this halts proceeding with the event if you have triggered it yourself.. So in this case if you have typed a swear word you will be ignored By adding if ($nick !isop #) { } This says if a $nick is not an op, then proceed with the command... If you remove the ! character from this, it would say if $nick is an op proceed.. Which is not what you want to do in this case.. Hope this helps Kind Regards, Daniel
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
You can also do so that this script only gets triggered for voiced and regular users. If you want to exclude the voiced, just remove the letter v. Then if that's to mainly address the regular user, a positive approach would become: $nick isreg $chan Anyway, this if ($nick !isop #) { if (!$hget(swear)) hmake swear 10
Can just be: if ($nick !isop #) && (!$hget(swear)) {
hmake swear 10 saves yourself a if and a bracket. The whole script, as a matter of fact, can just be: On *:Text:*:#channel: { swear $1- }
On *:Action:*:#channel: { swear $1- }
alias -l swear {
if ($nick !isop #) && (!$hget(swear)) hmake swear 10
var %swr = 1
while ($gettok($swear,%swr,32)) {
if ($+(*,$gettok($swear,%swr,32),*) iswm $strip($1-)) {
hinc swear $nick
var %swear = $gettok($swear,%swr,32)
if ($hget(swear,$nick) == 1) do something here
if ($hget(swear,$nick) == 3) .do something here
}
inc %swr
}
}
|
|
|
|
Joined: Sep 2009
Posts: 52
Babel fish
|
Babel fish
Joined: Sep 2009
Posts: 52 |
The channel has to be passed to the alias though. Also, I don't think the table creation has anything to do with the rest of the code, which should execute if it's not an op.
On *:Text:*:#channel: { swear $chan $1- }
On *:Action:*:#channel: { swear $chan $1- }
alias -l swear {
if ($nick !isop $1) {
if (!$hget(swear)) hmake swear 10
var %swr = 1
while %swr <= $lines($mircdirswear.txt) {
if ($+(*,$read($mircdirswear.txt,%swr),*) iswm $strip($2-)) {
hinc swear $nick
if ($hget(swear,$nick) == 1) .do something here
if ($hget(swear,$nick) == 3) .do something here
}
inc %swr
}
}
This should work perfectly fine, you can place cos words in a text file called swear.txt, one on every line. The file should be placed in your mIRC directory, in Win7 this is C:\Users\YOUR-USER-NAME\App-Data\Roaming\mIRC\ Enjoy, ziv.
|
|
|
|
Joined: Feb 2009
Posts: 133
Vogon poet
|
Vogon poet
Joined: Feb 2009
Posts: 133 |
"iswm" isnt a good idea bcz if u say hotel, campus or other thing this will be taken as a swear!!
WorldDMT
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
ziv, you don't need to pass it. The $chan or # will work. Why go the extra mile for when you can just do swear $1- ? Try it for yourself. Yes, I agree with chacha. It'd be better to use $istok then: On *:Text:*:#: { swear $1- }
On *:Action:*:#: { swear $1- }
alias -l swear {
if ($nick !isop #) {
if (!$hget(swear)) hmake swear 10
var %swr = 1
while %swr <= $lines($mircdirswear.txt) {
if ($istok($strip($1-),$read($mircdirswear.txt,%swr),32)) {
hinc swear $nick
if ($hget(swear,$nick) == 1) .do something here
if ($hget(swear,$nick) == 3) .do something here
}
inc %swr
}
}
}
|
|
|
|
Joined: Sep 2009
Posts: 52
Babel fish
|
Babel fish
Joined: Sep 2009
Posts: 52 |
I stand corrected!...well...seat corrected... Anyways, thank you.
ziv.
|
|
|
|
|