mIRC Home    About    Download    Register    News    Help

Print Thread
#218443 14/02/10 01:34 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
Hi,

I'm trying to make my channel/nick popups so that if u don't have the status u don't see the popup.
I'm also trying to make it so that when (if u are room owner) u still can set +o or +% or +v etc when u only deop yourself.(u should still have the room owner status)
I have tryed different piece of codes to see what status i got when performing the command.
Here are some examples:

This in my alias file:
Code:
modenum return 0 $+ $replace($left($nick($1,$2).pnick,1),+,1,%,2,@,3,&,4,!,4,~,5,.,5)


and this in my popups file:
Code:
.$iif(($modenum($chan, $me) >= 3),Op,):/chanserv op # $$1
.$iif(($modenum($chan, $me) >= 3),Deop,):/mode # -o $$1 $2 $3


I also tryed this in my popup file:

Code:
 ($me($chan,$me,~)):/chanserv op # $$1


I also tryed this in my alias file:

Code:
/prefixof {
  if ($1 == $null || $2 == $null) { return $null }
  var %pnick $nick($1,$2).pnick
  var %pos $pos(%pnick,$2,1)
  if (%pos == $null) return $null
  if (%pos == 1) return $null
  return $left(%pnick,$calc(%pos - 1))
}
/isvoice {
  if (+ isin $prefixof($1,$2) || $ishalfop($1,$2)) { return $true }
  return $false
}
/ishalfop {
  if (% isin $prefixof($1,$2) || $ischop($1,$2)) { return $true }
  return $false
}
/ischop {
  if (@ isin $prefixof($1,$2) || $isadmin($1,$2)) { return $true }
  return $false
}
/isadmin {
  if ($isowner($1,$2)) return $true
  if (& == $null) return $false
  if ($ircdadminchar(prefix) isin $prefixof($1,$2)) return $true
  return $false
}
/isowner {
  if ($ircdownerchar == $null) return $false
  if ($ircdownerchar(prefix) isin $prefixof($1,$2)) return $true
  return $false
}
/ircdownerchar {
  return $iif($1 == prefix,$iif(~ isin $prefix,~,@),q)
}
/ircdadminchar {
  return $iif($1 == prefix,$iif(& isin $prefix,&,@),a)
}


and this in my popup file:

Code:
.$iif($isowner($chan,$me),Op,):/chanserv op # $$1
.$iif($isowner($chan,$me),Deop,):/mode # -o $$1 $2 $3


But somehow after deop myself i can't get the option to op myself again.
Or with the last codes when i join a room where i'm not a op i can see the options to op or deop.
I've been working on this for hours and i'm not able to fix what i want.
Is the code in the aliases working or not? What do i do wrong?
Please help me out.

Greetings

RiMaJoy #218445 14/02/10 02:42 PM
Joined: Nov 2009
Posts: 117
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
You don't need any of the rest of your code to do something like this in the menu:
Code:
$iif($nick(#,$me,~&@),Op):mode # +o $$1-


gooshie #218448 14/02/10 03:30 PM
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
u can use menu into remote & use $nick like gooshie told u

Code:
menu channel,nicklist {
  $iif($nick(#,$me,~&@),Owner)
  .Op:<op cmd>
  .HalfOp:<hop cmd>
  .Voice:<voice cmd>
}


so if u r ~, &, or @ u'll find Owner in channel or nick list menu or else not


WorldDMT
gooshie #218449 14/02/10 03:51 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
Somehow when i deop i don't see the popups anymore.
I joined my room as owner +q and +o.
I saw all the popups.
When i take my +o i still have my +q right?
+q is equal to ~ so i should be able to see all popups.
Why don't i ?

RiMaJoy #218455 14/02/10 05:42 PM
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
about "~" i use server DalNet so they dont have "~" prefix maby $nick can't see it if u want u can try this on your server

//echo -a $!nick can $+ $iif(!$nick(#,$me,~),'t) see it

that will help u to see if that identifer can see the "~" prefix

then if not u'll add a condition & use $nick with pnick property

Last edited by chacha; 14/02/10 08:45 PM.

WorldDMT
RiMaJoy #218462 14/02/10 08:22 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Just add the letter q to it. Problem solved:
Quote:
$iif($nick(#,$me,~&@q),Owner)
Instead of using the user mode prefix, you can use its nick mode. To find out the nick mode your network supports when connected, enter:
Code:
//echo $nickmode
If you insist on using the prefix or symbols, enter:
Code:
//echo $prefix
Then all you do is pick a nick mode or prefix you want to show for your popup by adding to it. Same for removing one that you don't want the popup to show.

Tomao #218463 14/02/10 08:47 PM
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
ok nice then smile


WorldDMT
Tomao #218465 15/02/10 04:56 AM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
$nickmode returns ohv, no idea what that means.

another thing:
in order to reop or give usermodes to other when deop i need to use
Code:
 /cs op # $nick.

Not all servers have chanserv ... my guess is
Code:
/mode # +o $nick
still works there.
Is there a way to see if a server has chanserv so that the right command is being done?
Ifso how how would the comman look like?
like this?:

Code:
menu channel,nicklist {
$iif($nick(#,$me,~&@q),Owner)
.Op: { if ($chanserv == 1) /cs op # $$1 } else { /mode # +o $$1 }

RiMaJoy #218470 15/02/10 02:50 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
If $nickmode returns "ohv", $prefix is most likely "@%+". This means the server/network supports op, halfop and voice chanmodes. Ops, i.e. "+o" chanmode will be represented by the nick prefix "@". "+v" chanmode (voice) will be represented by the nick prefix "+". +h / % is inbetween, thus it's the "halfop".
Note that different networks/IRCds may support different chanmodes, and may use different prefixes to represent them. Only "op" and "voice" are codified in an IRC RFC, although "h"="%" is a very common convention...
Now, as you get only "ohv" for $nickmode (and not for example "qaohv"), the server/network does not support a dedicated chanmode (like +q) for "owners", and hence no associated nick prefix(like ~). A check for owner via $nick(#,$me,q) or $nick(#,$me,~) thus won't work: mIRC works with the nick prefix/nickmode combination (alike to your initial check for $nick().prefix). If you connect to a network, mIRC receives the info for $prefix and $nickmode in the /version reply. If now for example you join a channel, mIRC will use the reply for a /names # to display the nicks and their status (the reply contains all the nicks AND the nick prefixes). Only if mIRC notices a chanmode change (e.g. +o <somenick>) it will update the $nick() data internally, will show the new prefixes in $nick().pnick, and will display the highest prefix in your nicklist. Hope you get the idea... smile
If there's no +q but chanserv supports "owner" none the less, you have to use a different method for your check. Maybe there's a specific services notice informing a user that he's now recognized as owner?

Horstl #218478 15/02/10 05:44 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
On joining my channel i do get +q an as admin i do get +a.
I found this code and it seems to work so far:

Code:
alias isowner {
  if ($isid) return $iif($nick($1,$2,q) || $istok($ial($2).mark,$1,32),$true,$false)
  .ialmark $2 $($+($,$3,tok($ial($2).mark,$1,32)),2)
}

on *:join:#:{ isowner # $nick rem }
on *:owner:#:{ isowner # $opnick add }
on *:deowner:#:{ isowner # $opnick rem }
raw 386:*:{ isowner $2- add }
raw 307:*: {
  haltdef
  $iif(%nickreg == 1,set %regvalue 1 ,set %regvalue 0)
}

alias isadmin {
  if ($isid) return $iif($nick($1,$2,$mid($prefix,$pos($nickmode,a),1)) || $istok($ial($2).mark,a $+ $1,32),$true,$false)
  .ialmark $2 $($+($,$3,tok($ial($2).mark,a $!+ $!1,32)),2)
}

on *:join:#:{ isadmin # $nick rem }
raw 388:*:{ isadmin $2- add } 


Now my problem only is chanserv because when deoped
Code:
/mode # +o $$1

doesn't work anymore.
It returns a your not a channel operator
because i am the owner i can use chanserv op command.
but on a server that has no chanserv (undernet) the chanserv command will not work.
as i asked in my post before is there a way to make an alias to see if the server has chanserv and then use a piece of code like this:

Code:
.Op: { if ($chanserv == 1) /cs op # $$1 } else { /mode # +o $$1 }

RiMaJoy #218485 15/02/10 06:15 PM
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Quote:
On joining my channel i do get +q an as admin i do get +a.
You're using a server that has +q/+a mode for owner/admin but that doesn't let you know about these information in a /names reply, there's no prefix for this mode.
This mean you can't check for owner and admin on this server without making your own list of nickmode.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
RiMaJoy #218491 15/02/10 08:09 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I read that undernet uses some sort of X command. X being the channel service bot given to registered channels on undernet and managed by CServices. And in Undernet, a check whether you're opped is not needed. As long as you are logged in to X, it does not matter if you're an op or not.
You should try:
Code:
/msg X Op # $$1
to see if it works.
Code:
.Op:msg X Op # $$1

RiMaJoy #218494 15/02/10 09:06 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
OK, just tried to explain why the other scripts failed smile
Regarding ChanServ...
If services appear as a pseudo-users on the net, you could use /notify and $notify().ison - but if you're working on a script for the public you might want to keep the notify list "clean". Or you could /who or /ison for ChanServ (infinite timer) - but the shorter the delay, the more load you'll add to the network; and the longer the delay, the less reliable your script...

Also note that many services allow for the manipulation of access levels to e.g. "OPDEOP" and "OPDEOPME". Even if you may generally have access to cs op/deop if you're the owner - if you're planning to expand your menu for e.g. SOPs and OPs, you cannot take chanserv access for granted any more.


Link Copied to Clipboard