mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2006
Posts: 1
R
Mostly harmless
OP Offline
Mostly harmless
R
Joined: Dec 2006
Posts: 1
Here is part of an example of script I need timer on. The only thing I did not paste are the rest of the options and the two brackets at the end:
-------------

on 1:text:!spin:#: {

set %s $nick(#,$rand(1,$nick(#,0)),a)
msg $chan 2 $+ $nick 10Spins The Bottle And It Lands On....
msg $chan 12****2  $+ %s $+  12****
if (%s = $nick) msg $chan BOTTLE: The bottle lands on... $nick $+ ...? Oops.. spin again!
else {
var %chance = $rand(1,18)
if (%chance = 1) msg $chan $nick must now kiss %s $+ !
------------------
My question is this: People flood this script a lot as well as other scripts due to them being bored or simply wanting to abuse the script. I need a line of code that:

1.) leaves time between what the script says (for example a one second time delay between "blank spins the bottle" and "the bottle lands on blank") and
2.)I need a line of code that makes the script unusable for say 30 seconds, just to prevent flooding and so people don't spin to "Get the person they want" and that kinda stuff.

It'd be preferable to have a code that I can use on any script or that would require minimal changing (for example I'd just change the times).

Any help is appreciated, thank you very much!

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
When posting scripts (or part of scripts) please use the code tags (marked #)
Here's your code with a suggestion for a flood timer that will work in most cases with small alterations
Code:
on 1:text:!spin:#: {
  if %spin {
  ;  ^this checks for a variable called %spin
      set -u30 %spin $true
  ;   ^if the variable exists, then it will be set for another 30 seconds.  The code will only proceed if the variable does not exist.  This limits the usage of the command to once every 30 seconds.
  }
  else {
    set %s $nick(#,$rand(1,$nick(#,0)),a)
    msg $chan 2 $+ $nick 10Spins The Bottle And It Lands On....
    msg $chan 12****2  $+ %s $+  12****
    if (%s = $nick) msg $chan BOTTLE: The bottle lands on... $nick $+ ...? Oops.. spin again!
    else {
      var %chance = $rand(1,18)
      if (%chance = 1) msg $chan $nick must now kiss %s $+ !
    }
  }
}

Joined: Jan 2003
Posts: 53
Z
Babel fish
Offline
Babel fish
Z
Joined: Jan 2003
Posts: 53
btw

if (%chance = 1) does not do what you want...
for checking use if (%chance == 1)
yours sets %chance to 1 and since it exists, it evaluates to $true

so use ==

Regards

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can use single = in an if statement. It works fine. However, it's preferable to use the correct format of double == in case the allowed use of single = is removed at some point.

In either case, it wouldn't set a variable within an if statement.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard