mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2014
Posts: 3
A
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Dec 2014
Posts: 3
[Twitch]
I want to be able to use !trust NICKNAME and then it set the nick name to be trusted and save it as a variable. I want it too be moderator+ only. How would I do that? Also how would I make other commands only work for users who are trusted?

Here's what I have so far

Code:
on *:text:!trust &:#:{
  if ($nick isop #) { 
    set %trusted. $+ $2 On
    msg $chan $2 is now trusted!
  }
  else { msg # Sorry you cannot use this command $nick }
}
on *:text:!test:#:{
  if (%trusted.,$nick == On) { 
    msg # $nick is trusted!
  }
  else { msg # Sorry you cannot use this command $nick }
}


When I add myself to trusted It saves as a variable but I can't get it to say $nick is trusted when I type !test. it only says Sorry you cannot use this command $nick

Last edited by awesomenessispur; 30/12/14 05:43 AM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
May I suggest going about it a different way? Instead of using tons of dynamic variables like that you have tons of different options to store values. My favorite is ini files. Here's an example:
Code:
on *:text:!trust &:#: { 
if ($nick isop #) {
writeini trust.ini # $2 $nick
msg # $2 is now trusted by $nick $+ !
}
else msg # Sorry, you cannot use this command $nick $+ .
}
on *:text:!test*:#: { 
var %user $iif($2,$2,$nick)
if ($readini(trust.ini,#,%user)) msg # %user is trusted by $v1 $+ .
else msg # %user is not trusted.
}


You can read more about it on
/help $ini
/help $readini
/help /writeini

You can test it out now by typing either
!test
or
!test user


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Dec 2014
Posts: 3
A
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Dec 2014
Posts: 3
Now how would I make a command that when a trusted user types !timeout NAME the other other user gets timed out with message NAME was timed out by NAME!

If user is trusted I want to run .timeout $2

Last edited by awesomenessispur; 30/12/14 07:51 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
As you can see in the example I showed, I used $readini to see if there was a value for $nick or $2.
For a bit more advanced I suggest using an alias.
Code:
alias trusted return $readini(trust.ini,#,$1)

on *:text:!timeout &:#: { 
if ($trusted($nick)) .timeout $2
else msg # You're not trusted, so you can't time out
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Dec 2014
Posts: 3
A
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Dec 2014
Posts: 3
Thank You @Nillen!


Link Copied to Clipboard