mIRC Homepage
Posted By: CEG Help please. - 11/10/14 01:40 AM
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.
}
Posted By: Nillen Re: Help please. - 11/10/14 06:46 AM
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.
Posted By: hixxy Re: Help please. - 11/10/14 07:51 AM
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
Posted By: hixxy Re: Help please. - 11/10/14 07:53 AM
You can use $ulevel rather than $level($nick):

Code:
if ($nick !isop #) || ($ulevel != admin) { ... }
Posted By: Nillen Re: Help please. - 11/10/14 07:54 AM
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
Posted By: CEG Re: Help please. - 11/10/14 07:55 AM
Yeah i tried $ulevel still didn't work..
Posted By: hixxy Re: Help please. - 11/10/14 07:56 AM
If you type //echo -a user level: $level($address(<the nickname>,5)) what do you see?
Posted By: CEG Re: Help please. - 11/10/14 08:00 AM
user level: 10
Posted By: hixxy Re: Help please. - 11/10/14 08:54 AM
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.
Posted By: CEG Re: Help please. - 11/10/14 08:58 AM
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
Posted By: hixxy Re: Help please. - 11/10/14 09:02 AM
No you need to remove them from level 10, and keep them only on level admin, otherwise your script won't trigger.
Posted By: CEG Re: Help please. - 11/10/14 09:17 AM
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.
}
Posted By: CEG Re: Help please. - 11/10/14 09:32 AM
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..
Posted By: hixxy Re: Help please. - 11/10/14 10:17 AM
Can you try this and paste the results:

Code:
//var %i = 1 | while ($ulist(CEG!,*,%i) != $null) { echo -a $v1 | inc %i }
Posted By: CEG Re: Help please. - 11/10/14 05:10 PM
ceg was returned. Now I must say that this is a fresh install of mIRC on a fresh installed OS if that helps any...
© mIRC Discussion Forums