mIRC Home    About    Download    Register    News    Help

Topic Options
#244792 - 28/03/14 11:53 PM Need Help with this :D
The7Hero Offline
Bowl of petunias

Registered: 28/03/14
Posts: 2
Hell all,

this script works good, it does check for enough points, it does deduct the points, but when i do the !draw command, nothing happen, not sure if its not making the table cuz I can't find it anywhere.
Code:
on *:text:!ticket:#:{
  if ($hget($+(tickets.,#),$nick)) { msg # $nick You already have a ticket! | return }
  var %topic = $+(#,.,$nick)
  ; Check if enough points
  if ($readini(Points.ini,%topic,Points) >= 50) {
    ; Deduct the points
    var %a = $v1 - 50
    writeini Points.ini %topic Points %a
    ; Add the user to tickets.#channel hash table, creating the table if it doesn't exist
    hinc -m $+(tickets.,#) $nick
    msg # $nick You bought a ticket, you now have %a points.
  }
  else msg # $nick Sorry, you only have $v1 points.
}
on *:text:!draw:#:{
  if ($nick isop #) {
    if ($hget($+(tickets.,#))) {
      var %i = $r(1,$hget(,0).item
      msg # The winner is $hget($+(tickets.,#),%i).item
      ; The next line frees the table (all data in it is gone)
      hfree $+(tickets.,#)
    }
    else msg # Sorry $nick there is no such table $+(tickets.,#)  
  }
  else msg # $nick Only Mods can use that command.
}


whats wrong with the code?

Top
#244793 - 29/03/14 02:09 AM Re: Need Help with this :D [Re: The7Hero]
KindOne Offline
Fjord artisan

Registered: 23/02/11
Posts: 311
You can't have two on text events in the same script.

Either combine them into one on text script or put the second one into another script file.

You are also missing a ) at the end of this line:
Code:
var %i = $r(1,$hget(,0).item

_________________________
irc.swiftirc.net #msl (mIRC Scripting Language)

Top
#244794 - 29/03/14 02:21 AM Re: Need Help with this :D [Re: KindOne]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1268
Originally Posted By: KindOne
You can't have two on text events in the same script.


Of course you can. Those events don't interfere with each other at all. Not only is he missing the ), he's missing the table name.

Code:
var %i = $r(1,$hget($+(tickets.,#),0).item)

Top
#244854 - 01/04/14 07:02 AM Re: Need Help with this :D [Re: Loki12583]
The7Hero Offline
Bowl of petunias

Registered: 28/03/14
Posts: 2
thank you Loki12583 this helped a lot and made it work laugh

Top