So I have this game based on CS:GO case openings, and I can't get it to work. Basically how it should work is that random numbers get selected and they correspond to what you get. However, the script doesn't work when you add the $rand commands to %stattrak and %color. Can you guys help me figure out why?
Click to reveal..

on *:text:!cc:#:{
if (!%comwait) {
set -u6 %comwait 1
var %topic $+($chan,.,$nick)
var %points $iif($readini(Points.ini,%topic,Points) == $null,0,$v1)
var %keys $iif($readini(CaseClicker.ini,%topic,Keys) == $null,0,$v1)
var %cases $iif($readini(CaseClicker.ini,%topic,Cases) == $null,0,$v1)
var %stattrak = $rand(0,100)
var %color = $rand(0,100)

if %cases < 1 { msg $chan You don't have enough cases. | halt }
if %keys < 1 { msg $chan You don't have enough keys. | halt }

%cases = $calc(%cases - 1)
writeini -n CaseClicker.ini %topic Cases %cases

%keys = $calc(%keys - 1)
writeini -n CaseClicker.ini %topic Keys %keys

msg # stattrak is %stattrak
msg # color is %color

/timer 1 3 msg # Opening the case!

if (%stattrak <= 40) {
%st == 1
}
if (%stattrak > 40) {
%st == 0
}
if (%color <= 50) {
%c == 1
}
if (%color <= 75 && > 50) {
%c == 2
}
if (%color <= 90 && > 75) {
%c == 3
}
if (%color <= 96 && > 75) {
%c == 4
}
if (%color <= 100 && > 96) {
%c == 5
}

msg # c is %c
msg # st is %st


/timer 1 6 msg # $nick, you opened the case and got...

if (%c = 1 && %st = 0) {
/timer 1 9 msg # a Mil-Spec Blue Gun! 40 points have been added.
%points = $calc(%points + 40)
writeini -n Points.ini %topic Points %points
return %points
}
if (%c = 2 && %st = 0) {
/timer 1 9 msg # a Restricted Purple Gun! 100 points have been added.
%points = $calc(%points + 100)
writeini -n Points.ini %topic Points %points
return %points
}
if (%c = 3 && %st = 0) {
/timer 1 9 msg # a Classified Pink Gun! 250 points have been added.
%points = $calc(%points + 250)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 4 && %st = 0) {
/timer 1 9 msg # a Covert Red Gun! 525 points have been added.
%points = $calc(%points + 525)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 5 && %st = 0) {
/timer 1 9 msg # a Exceedingly Rare Yellow Knife! Wow! 900 points have been added.
%points = $calc(%points + 900)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 1 && %st = 1) {
/timer 1 9 msg # a StatTrak Mil-Spec Blue Gun! 80 points have been added.
%points = $calc(%points + 80)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 2 && %st = 1) {
/timer 1 9 msg # a StatTrak Restricted Purple Gun! 200 points have been added.
%points = $calc(%points + 200)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 3 && %st = 1) {
/timer 1 9 msg # a StatTrak Classified Pink Gun! 350 points have been added.
%points = $calc(%points + 350)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 4 && %st = 1) {
/timer 1 9 msg # a StatTrak Covert Red Gun! 700 points have been added.
%points = $calc(%points + 700)
writeini -n Points.ini %topic Points %points
return %points
}

if (%c = 5 && %st = 1) {
/timer 1 9 msg # a StatTrak Exceedingly Rare Yellow Knife! WOW! 1200 points have been added.
%points = $calc(%points + 1200)
writeini -n Points.ini %topic Points %points
return %points
}
}
}
else {
msg $chan This command is on cooldown.
}

Thanks so much guys!

Last edited by AntiTeal; 25/01/16 03:02 AM.