Jump to content

Dayo

Members
  • Content Count

    1,943
  • Joined

  • Last visited

  • Days Won

    40

Dayo last won the day on March 31

Dayo had the most liked content!

Community Reputation

195 Excellent

10 Followers

About Dayo

  • Rank
    Intermediate
  • Birthday 06/07/1992

Personal Information

  • Location
    England
  • Interests
    Football, Snooker, Pool, Cinema
  • Occupation
    Web Application Developer at Tensor PLC working on HeatingSave
  • Website
    http://www.cdcoding.com

Recent Profile Visitors

15,849 profile views
  1. Dayo

    Romewars

    Looking very good, as dave said you can make any layout responsive, you just have to focus on what is important and what isnt.
  2. Dayo

    Cronless Crons

    I am already adding the ability for that for when i build it directly into the core engine, it will support both the callback method and the methods above
  3. Dayo

    Cronless Crons

    Yeah that's why i like to separate user crons and system crons, as well as adding limits to how many times a cron can run. Plus features should be designed in a way so that if a game has no activity for 100 days does it really need to run 100 days worth of crons or can it run the past week. Yeah back in the days when people would find an illegal copy of McCodes and run it on a free host 😛
  4. The chat is $30 and the big bundle $35, you would have to buy the chat and something with a value of $5 or greater. Or i can sell you the big bundle for $5.
  5. Im a big fan of cronless crons and have been pushing this idea for 10 years now! (see here) Ive had a few people ask if i can make this easier to work with in GLv2 so i have created a simple Cron class that will hopefully make life easier and give you a better understanding of cronless crons. Cron Class <?php class Cron { public function __construct($cronName, $cronType, $interval, $maxRepetitions = 1000) { global $db, $user; $this->db = $db; $this->user = $user; $this->settings = new Settings(); $this->cronName = $cronName; $this->cronType = $cronType; $this->maxRepetitions = $maxRepetitions; $this->interval = $interval; } public function updateLastRun() { if (!$this->getRepetitionCount()) return $this; $key = "cron-" . $this->cronName; $newTime = time() - (time() % $this->interval); if ($this->cronType == "user" && $this->user) { $time = $this->user->updateTimer($key, $newTime); } else if ($this->cronType == "system") { $time = $this->settings->update($key, $newTime); } return $this; } public function getRepetitionCount () { $key = "cron-" . $this->cronName; if ($this->cronType == "user" && $this->user) { $time = $this->user->getTimer($key, false); } else if ($this->cronType == "system") { $time = $this->settings->loadSetting($key); } $count = floor((time() - $time) / $this->interval); return $count > $this->maxRepetitions?$this->maxRepetitions:$count; } public function getCronDates() { $key = "cron-" . $this->cronName; if ($this->cronType == "user" && $this->user) { $time = $user->getTimer($key); } else if ($this->cronType == "system") { $time = $this->settings->loadSetting($key); } $count = floor((time() - intval($time)) / $this->interval); if ($count > $this->maxRepetitions) { $count = $this->maxRepetitions; } if (!$count) return array(); $start = time() - time() % $this->interval; $dates = array(); while ($count) { $dates[] = $start - ($this->interval * ($count - 1)); $count--; } return $dates; } } Usage Examples (moduleExample.hooks.php) <?php new Hook("userInformation", function ($user) { global $page; if ($user) { $oneMinCron = new Cron("addUserEnergy", "user", 60, $this->user->info->US_maxEnergy); $howManyTimesTheCronWouldHaveRun = $oneMinCron->getRepetitionCount(); $newEnergy = $howManyTimesTheCronWouldHaveRun * 2 + $this->user->info->US_maxEnergy; if ($newEnergy > $this->user->info->US_maxEnergy) { $newEnergy = $this->user->info->US_maxEnergy; } $this->user->set("US_maxEnergy", $newEnergy); $oneMinCron->updateLastRun(); } $systemCron = new Cron("everyHour", "system", 3600, 24); $datesAndTimeThatTheCronWouldHaveRan = $systemCron->getCronDates(); foreach ($datesAndTimeThatTheCronWouldHaveRan as $date) { /* do something here */ } $systemCron->updateLastRun(); }); Documentation __construct($cronName, $cronType, $interval, $maxRepetitions) $cronName - A unique name given to this cron, this is used to identify it in the database $cronType - This can be "user" or "system" user - This cron will only run when the user is active and playing the game, if they have been AFK for a period of time it will run the cron as many times as needed.(capped by the maxRepetitions) system - This cron is run when there is any activity on the game, it can be a logged in user or someone visiting the login page, if it has not been run for a while it will run as many times as needed (capped by the maxRepetitions) $interval - How often should the cron run (seconds) $maxRepetitions - The maximum times this cron will run getRepetitionCount() Returns how many times the cron would have ran if it was running away in the background getCronDates() Same as getRepetitionCount but instead of returning a numerical value it will return an array of dates and times when the cron would have ran. updateLastRun Updates the database storing when the cron was last run. If the cron was not run
  6. I am also opening this up to other GLv2 modules brought on the market place. So if you buy any module on the GLv2 Market place you have up to that value to buy any of MY mods. I.e. if you brought Dave's chat mod you can get one of my bundles FREE! Please note that this may take some time to process as i have to confirm purchase with the original owner so allow up to a few days. This only applies to purchases after the date of this post! Also to clarify this offer stacks for purchases within 3 hours of each other i.e. if you brought SwiftGamers point market (currently $5) and BenNiiiBoii's Inventory (currently $20) you could get my Gambling module ($25) free!
  7. For the next two weeks i will be offering a free module or bundle with every purchase, just go to the marketplace as you normally would and buy any module. After purchase send me a PM with the modules you would like and i will credit them to your account. (this process may take up to 1-24 hours depending on if Im sleeping) TERMS AND CONDITIONS This only applies to modules that i have made! The free module must be of equal or less value to the module you have paid for. i.e. you cant buy a $10 module and ask for a $30 bundle free. If for example you buy a bundle for $30, you then have up to $30 to spend on any of my other modules i.e. you could get the OC and Investments. If you have for example $4 left over this CAN NOT be used in the future
  8. You can go onto the market place and see who purchased it and send out a PM 😉
  9. Dayo

    Investments

    Version 1.0.0

    This module allows users to invest their money in various different investment options. Within the ACP you are able to make, edit and delete investments. Investment Setup Minimum payout - The minimum payout that the user will get if the minimum was -10% and they invested $100m the minimum return is $90m Maximum payout - The maximum payout that the user will get if the maximum was 10% and they invested $100m the maximum return is $110m Maximum Investment - Limit how much a user can invest in this investment Investment Time - After this period has elapsed the investment matures and the user is payed out. Users can only invest in one item at a time. How to Install Open up your game Go to the admin Panel Go to Modules & Themes Open the Module Manager Click on Install Module Upload the ZIP file Follow the instructions

    $11.50

  10. My bad I was upgrading a module, now fixed
  11. I have been working on Dystopian Life with a few partners for over a year now! We are finally ready to move from alpha into beta. You can pre-register at https://dystopian.life enjoy;)
  12. Dont forget to add a decline fight, and try to use btn-success and btn-danger classes to help the user better understand what they mean (good for people with bad eyesight)
  13. With the new MWG marketplace I've had no issues with payments, Dave has been great!
×
×
  • Create New...