Originally Posted By: Deega
Originally Posted By: Bullerbums
BUT if bot disconnects, it dont gives points again before the user disconnect and connect again.
Can some help me with fixing this ?
That's because they are online timers, meaning that they are turned off when you disconnect.
Change timer to an offline timer by adding the -o switch.
Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) -o 0 600 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
This means though that the timers of any users who quit/part before the bot re-joins will not be stopped.
Adding this should fix that
Code:
raw 366:*:{
  var %i = 1
  while ($timer(%i)) {
    if ($+(points.,$2,.,*) iswm $v1) {
      var %a = $v2
      if ($gettok(%a,-1,46) !ison $2) { .timer $+ %a off | continue }
    }
    inc %i
  }
}


Originally Posted By: Bullerbums
If some one wants to help me bit more.
If people use the command "!ticket 20" it should take 20 points from the points.ini file, and put it in a raffle.
Try this, note that the trigger is !ticket (not "!ticket 20")
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) >= 20) {
    ; Deduct the points
    var %a = $v1 - 20
    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.
}
Originally Posted By: Bullerbums
when i (moderator) say "!ticket roll" it will pick a random user and post the winner.
You need to change the ($nick == Yournick) below.
Code:
on *:text:!ticket roll:#:{
  if ($nick == Yournick) {
    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.
}


An ini file might not be the best way to store this data. There is a lot of file reading/writing going on here.
What other data gets kept in the ini file besides points?




This was so nice! Thank you alot

Atm i only have Points stored in the ini file.
They way i wanted the "!ticket" system to work, was that i says that , you have to pay 20 points now, and 50 points now to be a part of the raffle.

ehmm best is to come with an exemple i think smile

"admin says !ticket 20 (now it will cost 20 points pr tickets"
user: !tickets 3 --- user buy 3 tickets = 60 points taken

or is it to difficult to make?


and again, Thank you so much for the help