mIRC Homepage

!bet

Posted By: michaelukz

!bet - 27/02/15 01:14 AM

So I am working on a basic bet system as you may have figured if you look at my previous posts, whiles't testing I ran accros a problem.

Here is the code :
Click to reveal..
Code:
on *:TEXT:!bet *:#: {
  set %rand $rand(1,6)
  var %cash $readini(rxcoin.ini,%user,coins)
  var %spend $2
  var %calc calc(%spend * 4)
  var %user $nick
  if (%cash == 0) { 
    msg $chan sorry $nick you have no credits to bet on!
    halt
  }
  $rand(1,6)
  if (%rand == 1) {
    msg $chan number one has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 2) { 
    msg $chan number two has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 3) { 
    msg $chan number three has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 4) { 
    msg $chan number four has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 5) { 
    msg $chan number five has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 6) { 
    msg $chan number six has been called, you win %calc credits!
    set %money.add calc($readini(rxcoin.ini,$nick,coins) + %calc)
    writeini -n rxcoin.ini $nick coins %money.add
    unset %money.add
  }
}


Here's is the problem, It removes the points if you lose, but if you win it put's this into the ini file
Click to reveal..

[michaelukz]
coins=calc($readini(rxcoin.ini,$nick,coins) +


Anyone know why this is happening?
Posted By: Sakana

Re: !bet - 27/02/15 02:04 AM

You probably realized by now, but you wrote calc( ) instead of $calc( )
Posted By: michaelukz

Re: !bet - 27/02/15 06:39 AM

I honestly, didn't even think to check for that mistake -- ironically -- I had that issue earlier haha.
© 2020 mIRC Discussion Forums