Page 1 of 1

Daily Prizes

Posted: Sat Sep 21, 2013 12:31 am
by Epiales
Was just sitting here thinking of things I could add to the game. Anyone have any ideas of how a daily prize thing could be implemented into php? I mean like, you see these games with a spinning wheel and you spin it and get the prize. Or you open up a treasure box and get a prize. Any way of doing something like this?

Re: Daily Prizes

Posted: Sat Sep 21, 2013 10:30 am
by vitinho444
Not hard at all.

There's a script that I'm not sure who "created" it, that is good for resource timers.

Example:

Code: Select all

<?php
$delay = 3600; //every hour
$Player_time = Query("Get timer blablabla from player etc etc");
$time = time();

if($time > $Player_time + $delay)
{
//one hour passed lets give some resources
$intervals = ($time - $Player_time) / $delay;

$resource1 = $base_per_hour * $intervals;
}
?>
So you could adapt it to be daily (24hours aka 3600 * 24) and instead of using $resource1 in that if sentence you would add the code for that spinning wheel that i believe should be javascript so it makes the effect of moving and etc and then just check what number it's on and give the player a prize :)