mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2015
Posts: 9
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jul 2015
Posts: 9
I'm quite a beginner to mIRC scripting so...

I need a command that has a cooldown to prevent people from spamming it, if the command is on cooldown, it has to reply to them how long they have to wait to use the request again.

Also I need a command for moderators so they can reset a person's cooldown.

This is what I have so far, the !cd command is not working, !request replies 'You have recently requested, try again inseconds.' without showing the time.

Code:
on *:TEXT:*!request*:#: {
  if (!%xrequest. [ $+ [ $nick ] ]) {
    ; set -u20 %xrequest. $+ $nick 1
    set -z %xrequest. $+ $nick 60
    msg $chan $2- has been added to the playlist.
    /write requests.txt $nick , $2
  }
  else {
    if (!%xspamfilter. [ $+ [ $nick ] ]) {
      set -z %xspamfilter. $+ $nick 10
      msg $chan [ You have recently requested, try again in ] $+ [ %xrequest ] $+ [ seconds. ]
    }
  }
}

on *:TEXT:*!cd*:#: {
  if (!%xrequest. [ $+ [ $nick ] ]) {
    set -z %xrequest. $+ $2 1
    msg $2 , your cooldowns have been reset.
  }
}

Last edited by Fattyshow; 01/10/15 02:04 PM.

Digital Rocker on Twitch TV - Bassist
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Code:
on *:TEXT:*:#: {
if ($strip($1) == !request) {
if (!$($+(%,xrequest.,$nick),2)) {
set -z $+(%,xrequest.,$nick) 60
msg $chan $2- Has Been Added To The Playlist
write requests.txt $2-
}
elseif ($($+(%,xrequest.,$nick),2)) {
msg $chan You Have Requested Recently. $($+(%,xrequest.,$nick),2) Seconds Left.
}
}
elseif ($strip($1) == !cd) {
if ($($+(%,xrequest.,$2),2)) {
unset $+(%,xrequest.,$2)
msg $chan $2 Your CoolDown Was Reseted.
}
}
}

The !cd wasn't working because if you put the same event more than once in the same remote only the 1st works. Generally you should either use if statements or put each same event in a different remote. Try this script it should work! smile
EDIT: I made a mistake on the !cd. $nick instead of $2 ,I corrected to $2 Now

Last edited by OrFeAsGr; 01/10/15 03:44 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: OrFeAsGr
The !cd wasn't working because if you put the same event more than once in the same remote only the 1st works. Generally you should either use if statements or put each same event in a different remote. Try this script it should work! smile


There's absolutely nothing wrong with having multiple text events in a single file if the matchtext is exclusive. Combining all text events into a single catch-all is not the preferred way to structure a script.

The problem is that in your first event you're checking a dynamic %xrequest. [ $+ [ $nick ] ] and displaying a nonexistant %xrequest. In your second event you're checking %xrequest. [ $+ [ $nick ] ] for some reason and you may as well use unset %xrequest. $+ $2 instead of set -z

Last edited by Loki12583; 01/10/15 04:04 PM.
Joined: Jul 2015
Posts: 9
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jul 2015
Posts: 9
Thank you very much, I got it all working perfectly now.


Digital Rocker on Twitch TV - Bassist
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Well thanks for correcting the event mistake... I never used multiple text events so I Didn't know much about it.. I always prefer using if / else / elseif
I don't know what you meant by "catch-all" but i think everyone is free to choose his own way to "structure" a script if it does what it supposed to wink

Last edited by OrFeAsGr; 01/10/15 06:54 PM.

Link Copied to Clipboard