Daily Prizes
Daily Prizes
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?
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: Daily Prizes
Not hard at all.
There's a script that I'm not sure who "created" it, that is good for resource timers.
Example:
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 
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;
}
?>