mIRC Home    About    Download    Register    News    Help

Print Thread
#243773 24/12/13 04:19 AM
Joined: Dec 2013
Posts: 771
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
So, I have a code for a points system on my bot. These points are used to purchase song requests etc. She will automatically draw -50 points whenever someone buys a song. But what I want her to do is reply with the user's points before & after and make an if statement that if they haven't got enough coins, run another message.

This is what I have so far:

on *:text:!buysong:#kuyaace00: {
if ((%floodbuysong) || ($($+(%,floodbuysong.,$nick),2))) { return }
set -u10 %floodbuysong On
set -u30 %floodbuysong. $+ $nick On
msg $chan $nick just purchased a song request, from $chan $+ . Removed 50 coins from $nick $+ .
var %topic $+($chan,.,$nick)
var %points $calc($readini(Points.ini,%topic,Points) - 50)
writeini -n Points.ini %topic Points %points
return %points
}

and, for a full code of my points system, go here: http://pastebin.com/YXE8dvEf

Nillen #243783 24/12/13 09:21 PM
T
TestCoder
TestCoder
T
Try:

Code:
on *:text:!buysong:#kuyaace00: {
  if ((%floodbuysong) || ($($+(%,floodbuysong.,$nick),2))) { return }
  set -u10 %floodbuysong On
  set -u30 %floodbuysong. $+ $nick On
  var %topic $+($chan,.,$nick)
  var %points $iif($readini(Points.ini,%topic,Points) == $null,0,$v1)
  if (%points < 50) {
    msg $chan $nick does not have enough points to purchase a song.
    return
  }
  %points = $calc(%points - 50)
  msg $chan $nick just purchased a song request, from $chan $+ . Removed 50 coins from $nick (Had $calc(%points + 50) coins and now has %points coins).
  writeini -n Points.ini %topic Points %points
  return %points
}


#243788 26/12/13 02:12 AM
Joined: Dec 2013
Posts: 771
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
You are a christmas saint good sir. Thank you so much! smile

Merry christmas!


Link Copied to Clipboard