Reputation: 19
I have a game built in PHP and javascript that allows users to spin a bottle around a circular board. I'm including a snippet of code from the php file that interprets the rewards users get when landing on a certain section. I'm trying to edit the '5 points' message part and change it so that it awards a random number of points between 1 and 50. This is more of a syntax thing, because I tried putting in
45 => array(
'message' => '5 Points',
'callback' => array('point_add', array rand(1,50))
),
but that didn't work. What is the correct syntax?
SpinBubble::$rewards = array(
0 => array(
'message' => 'MINI Cooper Sweepstakes Entry',
'callback' => array('sweepstakes_entry', array('cooper'))
),
15 => array(
'message' => 'Spin Again',
'callback' => array('credit_add', array(1))
),
30 => array(
'message' => 'Designated Driver',
),
45 => array(
'message' => '5 Points',
'callback' => array('point_add', array(5))
),
Upvotes: 0
Views: 183
Reputation: 391
Try this
45 => array(
'message' => '5 Points',
'callback' => array('point_add', array(mt_rand(1, 50)))
),
Upvotes: 1