Daily Prizes

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Daily Prizes

Post 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?
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Daily Prizes

Post 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 :)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
Post Reply

Return to “Beginner Help and Support”