mIRC Home    About    Download    Register    News    Help

Print Thread
#248533 11/10/14 01:40 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
What is wrong with this if I add someone as user level admin "($level($nick) != admin)" it don't work, however being op does.
Code:
on $*:text:/^!addcom !?(\S+)/iS:#:{
  if ($nick !isop #) || ($level($nick) != admin) { msg # Sorry $nick - You don't have permission to do that. | return }
  writeini commands.ini # $regml(1) $$3-
  msg # $nick - The command $$2 has been added.
}

Last edited by CEG; 11/10/14 03:20 AM.
CEG #248540 11/10/14 06:46 AM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
I think you have a completely different vision as to what $level is supposed to do.
Originally Posted By: Help files regarding $level
$level(address)
Finds a matching address in the remote users list and returns its corresponding levels list.
$level(*!*@mirc.com) returns =5,10,20,21,32
If you however have an alias that overwrites this, please do share so we can understand what it does and what the cause might be.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #248545 11/10/14 07:51 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Hi Nillen

You can't call a custom identifier if a built-in identifier of the same name exists, as it will always call the built-in identifier rather than the custom one, unless you use either the $. or $/ prefixes:

E.g. (Please note that running this script will delete your 'time' alias if you have one, so make sure you back that up before running it!)

Code:
//alias time return hello world | time | echo -a called as command: $result | echo -a called as identifier: $time | echo -a called with $!.: $.time | echo -a called with $!/: $/time | alias time


Cheers

CEG #248546 11/10/14 07:53 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You can use $ulevel rather than $level($nick):

Code:
if ($nick !isop #) || ($ulevel != admin) { ... }

hixxy #248547 11/10/14 07:54 AM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Yeah, that confirms what I thought. I wasn't sure though as I've never tried having an alias the same name as a mSL identifier, so I figured I'd just ask


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
hixxy #248548 11/10/14 07:55 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
Yeah i tried $ulevel still didn't work..

CEG #248549 11/10/14 07:56 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
If you type //echo -a user level: $level($address(<the nickname>,5)) what do you see?

hixxy #248550 11/10/14 08:00 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
user level: 10

Last edited by CEG; 11/10/14 08:29 AM.
CEG #248551 11/10/14 08:54 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That means the user is level 10, not level admin.

You need to remove them from level 10.

If you have someone who is in the user list twice, then whichever level comes first is their level.

hixxy #248552 11/10/14 08:58 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
i just changed their level to 10 and it still doesn't work.. thanks for trying to help guys i'll just stick to if they are ops smile

CEG #248554 11/10/14 09:02 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
No you need to remove them from level 10, and keep them only on level admin, otherwise your script won't trigger.

hixxy #248555 11/10/14 09:17 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
I have this and the user is admin but it wont trigger for admin but does for op... I still can't figure it out... however if I type //echo -a user level: $level($address(CEG,5)) it returns user level: 1 however I do have the user as admin:ceg

Code:
on $*:text:/^!addcom !?(\S+)/iS:#:{
  if ($nick !isop #) || ($ulevel != admin) { msg # Sorry $nick - You must be a stream MOD! | return }
  writeini commands.ini # $regml(1) $$3-
  msg # $nick - The command $$2 has been added.
}

Last edited by CEG; 11/10/14 09:20 AM.
CEG #248556 11/10/14 09:32 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
seems like no matter if i set a user as admin or say level 10 //echo -a user level: $level($address(ceg,1)) still return 1 something isn't right..

CEG #248558 11/10/14 10:17 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Can you try this and paste the results:

Code:
//var %i = 1 | while ($ulist(CEG!,*,%i) != $null) { echo -a $v1 | inc %i }

hixxy #248568 11/10/14 05:10 PM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
ceg was returned. Now I must say that this is a fresh install of mIRC on a fresh installed OS if that helps any...

Last edited by CEG; 11/10/14 06:34 PM.

Link Copied to Clipboard