mIRC Home    About    Download    Register    News    Help

Print Thread
#220520 17/04/10 12:00 AM
R
razor32
razor32
R
Hi,

I have this script which was kindly made for me for a game I play so when i'm ingame I can type
Quote:
@^!msg <message>
in the admin chat and it would get echo'd by the server bots and say the message ingame. However it appears anyone can use it apart from me, so I was wondering if theres a way so only a certain ingame nick can use it?

The original code is here:
Code:
on *:text:*:#CHANNELNAME: {
  if ($nick ishop $chan) && ($regex($nick,/^N[aeiou]w[aeiou]n[aeiou]$/i)) {
    if ($regex($1-,/^\*{3} Admin \S+ \(ID:\d+\): \^(.+)/S)) { msg $chan $regml(1) }
  }
}

and the original topic can be found here

If anyone can help me, i'd be really greatful

Kind regards

T
Tomao
Tomao
T
Your script currently will allow all the hops to use it. You can have a stricter control over whom you want this script to be triggered by using mirc's user list feature. Make a simple menu like this:
Code:
menu nicklist {
Add a user:auser -a grant $address($1,2)
Remove a user:ruser grant $address($1,2)
}

Then change
Quote:
on *:text:*:#CHANNELNAME: {

to:
Code:
on grant:text:*:#CHANNELNAME: {
Your whole code will end up looking like this:
Code:
menu nicklist {
  .Add $1:auser -a grant $address($1,2)
  .Remove $1:ruser grant $address($1,2)
}
on grant:text:*:#CHANNELNAME: {
  if ($regex($nick,/^N[aeiou]w[aeiou]n[aeiou]$/i)) {
    if ($regex($1-,/^\*{3} Admin \S+ \(ID:\d+\): \^(.+)/S)) { msg $chan $regml(1) }
  }
}
You are to use the menu via the popups nicklist.

R
razor32
razor32
R
Hi,

That's not what I meant, What I meant was if theres anyway so that only a certain user in-game (not mirc) can use the @^msg command?

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
It can be done, but you have to tell us how you are determining if the mIRC user is in the game or not. Is it stored somewhere?

R
razor32
razor32
R
Originally Posted By: Riamus2
It can be done, but you have to tell us how you are determining if the mIRC user is in the game or not. Is it stored somewhere?

If i understand correctly, the message will be sent by the people who has the script in remote. The user ingame who can use it is done by !setuser <nick> or something?

So if I did !setuser FriLLeT and then go ingame with the name 'FriLLeT' i would be able to use it and send this
Quote:
@!msg asd
@ being the ingame admin chat command.

You can see in the screenshots in the original topic how the server messages are sent.

PS: late reply, internet troubles

Last edited by razor32; 08/05/10 02:37 AM.
T
Tomao
Tomao
T
Originally Posted By: razor32

If i understand correctly, the message will be sent by the people who has the script in remote. The user ingame who can use it is done by !setuser <nick> or something?

So if I did !setuser FriLLeT and then go ingame with the name 'FriLLeT' i would be able to use it and send this
Quote:
@!msg asd
@ being the ingame admin chat command.

Code:
on $*:text:/^!(set|del)user/iS:#: {
  if (!%x) { inc -u10 %x | var %s = $regml(1)
    goto %s | :set | if ($istok(%nick,$2,32)) {
      notice $nick $2 already exists! | halt
    }
    else { 
      set %nick $addtok(%nick,$$2,32)
      notice $nick $2 has been added! | halt
    }
    :del | if ($istok(%nick,$2,32)) {
      set %nick $remtok(%nick,$$2,1,32)
      notice $nick $2 has been deleted! | halt
    }
    else { notice $nick $2 doesn't exist! | halt }
  }
}
on *:text:*:#CHANNELNAME: {
  if (($istok(%nick,$nick,32)) && ($regex($nick,/^N[aeiou]w[aeiou]n[aeiou]$/i))) {
    if ($regex($1-,/^\*{3} Admin \S+ \(ID:\d+\): \^(.+)/S)) { msg $chan $regml(1) }
  }
}


!setuser NICKHERE to set a nick
!deluser NICKHERE to remove a nick.

This script will now recognize nick that's been added to %nick variable.

There is a downside of using $nick. The reason being people can clone a nick to gain access to the script. Please also note that currently this script will allow every one to add and delete user, since you didn't mention you want to be the main person to do the adding or deleting.

C
chacha
chacha
C
i think no need to use goto command

Code:
on $*:text:/^!(set|del)user/iS:#: {
  if !%x {
    inc -u10 %x
    var %s $replace($regml(1),set,1,del,0)
    if %s && $istok(%nick,$2,32) || !%s && !$istok(%nick,$2,32) {
      notice $nick $2 $iif(%s,already,doesn't) exists!
      halt
    }
    set %nick $iif(%s,$addtok(%nick,$$2,32),$remtok(%nick,$$2,1,32))
    notice $nick $2 has been $iif(%s,added,deleted) $+ !
  }
}

P.S: not tested

R
razor32
razor32
R
Originally Posted By: Tomao
Originally Posted By: razor32

If i understand correctly, the message will be sent by the people who has the script in remote. The user ingame who can use it is done by !setuser <nick> or something?

So if I did !setuser FriLLeT and then go ingame with the name 'FriLLeT' i would be able to use it and send this
Quote:
@!msg asd
@ being the ingame admin chat command.

Code:
on $*:text:/^!(set|del)user/iS:#: {
  if (!%x) { inc -u10 %x | var %s = $regml(1)
    goto %s | :set | if ($istok(%nick,$2,32)) {
      notice $nick $2 already exists! | halt
    }
    else { 
      set %nick $addtok(%nick,$$2,32)
      notice $nick $2 has been added! | halt
    }
    :del | if ($istok(%nick,$2,32)) {
      set %nick $remtok(%nick,$$2,1,32)
      notice $nick $2 has been deleted! | halt
    }
    else { notice $nick $2 doesn't exist! | halt }
  }
}
on *:text:*:#CHANNELNAME: {
  if (($istok(%nick,$nick,32)) && ($regex($nick,/^N[aeiou]w[aeiou]n[aeiou]$/i))) {
    if ($regex($1-,/^\*{3} Admin \S+ \(ID:\d+\): \^(.+)/S)) { msg $chan $regml(1) }
  }
}


!setuser NICKHERE to set a nick
!deluser NICKHERE to remove a nick.

This script will now recognize nick that's been added to %nick variable.

There is a downside of using $nick. The reason being people can clone a nick to gain access to the script. Please also note that currently this script will allow every one to add and delete user, since you didn't mention you want to be the main person to do the adding or deleting.

Thanks but I just tested ingame and it doesn't seem to work, I added the user ok but when I go ingame and do @^!msg test it doesn't send the message : /

Last edited by razor32; 13/05/10 02:29 AM.

Link Copied to Clipboard