
Cronus2
Members-
Posts
13 -
Joined
-
Last visited
-
Days Won
4
Cronus2 last won the day on November 28 2022
Cronus2 had the most liked content!
Recent Profile Visitors
503 profile views
Cronus2's Achievements
-
another chapter closed/opened in the mwg story good luck @FoohonPie, hope you have some ideas to get this place re-invigorated, or to somehow integrate it into your existing pbbg network very glad to see this place is not closing down for good
-
I can definitely do a little bit of a rework of that, no problem. Give me a bit to get it done.
-
Hello Everyone, I'd like to give back to the community a bit but as my project is mostly custom, it's difficult to come up with smaller ideas that won't give away anything that I'd like to keep unique for myself. Therefore, if perhaps you know of any staff/admin pages that do not exist but you often find yourself wishing there was a page for, please post it here. Preferably your suggestions would be for the base mccodes v2 so anyone can find use for it. I can't promise any time tables for these but I'd like to give back a bit if I could. Cheers
-
Congrats dayo
-
I have a folder with the old mods in it. Let me take a look tonight when I get home and I'll PM you with what I've got.
-
1. Check the time stamps, I edited it before you even posted. Take a chill pill. 2. I created those mods when I was a teenager, I am 32 now, i haven't coded anything in a decade. I supported them for a long time before I eventually stopped coding altogether, saying I screwed everyone who ever purchased anything is complete and total bullshit. I am coming back as a hobby but certainly if someone has questions on something I would help to my best ability, like I said, I haven't touched this stuff in a long time. 3. You're talking about $10 mods that I haven't been selling for over a decade, for an engine that is seldom used anymore, complaining that I didn't give 15 years of support. 4. When people join, or return, to pick this stuff up, try to be supportive. This is mostly a hobby for people and looking at your post history you have no problem complaining the community is dwindling, yet here you are being an ass hat in the introductions section. You're better than this. Or maybe you aren't, what do I know. Let's get this thread back on track instead of bickering like children in an introduction thread.
-
well I see this place is as friendly as it ever was, I suppose not everyone has grown some
-
I was indeed, still have the code for it stashed away for it somewhere....
-
Cron-less Energy/Will/Brave/HP Regen + Admin Panel
Cronus2 replied to Cronus2's topic in Free Modifications
Updated, now comes with easy admin panel for updating the regen settings. -
glad to hear it! what do you think is the most popular mccodes-based game currently active? I'm just curious
-
Cron-less Energy/Will/Brave/HP Regen + Admin Panel
Cronus2 replied to Cronus2's topic in Free Modifications
It does not update if no one is on the site, and also it only updates the user loading the page instead of the entire users table. Once the user comes back online, it catches them up though. -
I just jumped back into script writing and this was the first thing I added to my base MCCodes so things can regen without crons. This also includes the ability to adjust the regen settings through the admin panel. This script adds ZERO new queries to page loads, unless something is updated. It also adds 6 new variables to the game settings table in the database, so that you can adjust the regen amounts through the admin panel. 1. Add "lastupdate" to your users table as INT. 2. Add the following to your settings table, the ID values are not important: 3. Add the following code to your globals.php around line 138, right after the Force Logout function: //Crons for Energy, Will, Brave, and HP. $willadded=$set['willregen']; $braveadded=$set['braveregen']; $donatorenergy=$set['donatorenergyregen']; $nondonatorenergy=$set['nondonatorenergyregen']; $donatorhp=$set['donatorhpregen']; $nondonatorhp=$set['nondonatorhpregen']; $time=time(); $timediff=time()-$ir['lastupdate']; while($timediff > 299) { //Update Will, if needed. if($ir['will']<$ir['maxwill']) { $db->query("UPDATE `users` SET `will` = `will` + {$willadded} WHERE `userid` = {$userid}"); $ir['will']=$ir['will']+$willadded; } //Update Brave, if needed. if($ir['brave']<$ir['maxbrave']) { $db->query("UPDATE `users` SET `brave` = `brave` + {$braveadded} WHERE `userid` = {$userid}"); $ir['brave']=$ir['brave']+$braveadded; } //Determine how much Energy/HP should be added based on Donator Status. if($ir['donatordays']>0) { $energyadded=$donatorenergy; $hpadded=round($ir['hp']*$donatorhp); }else{ $energyadded=$nondonatorenergy; $hpadded=round($ir['hp']*$nondonatorhp); } //Update Energy, if needed. if($ir['energy']<$ir['maxenergy']) { $energyupdate=$ir['energy']+$energyadded; if($energyupdate>$ir['maxenergy']) { $db->query("UPDATE `users` SET `energy` = `maxenergy` WHERE `userid` = {$userid}"); $ir['energy']=$ir['maxenergy']; }else{ $db->query("UPDATE `users` SET `energy` = {$energyupdate} WHERE `userid` = {$userid}"); $ir['energy']=$energyupdate; } } //Update HP, if needed. if($ir['hp']<$ir['maxhp']) { $hpupdate=$ir['hp']+$hpadded; if($hpupdate>$ir['maxhp']) { $db->query("UPDATE `users` SET `hp` = `maxhp` WHERE `userid` = {$userid}"); $ir['hp']=$ir['maxhp']; }else{ $db->query("UPDATE `users` SET `hp` = {$hpupdate} WHERE `userid` = {$userid}"); $ir['hp']=$hpupdate; } } $timediff=$timediff-300; //Update our lastupdate field in the users table if we are finished. if($timediff<300) { $ir['lastupdate']=$time-$timediff; $db->query("UPDATE `users` SET `lastupdate` = {$ir['lastupdate']} WHERE `userid` = {$userid}"); } } This updates each as expected and will not let any of them regen over 100%. 4. Replace this section of your admin.php: With this: case 'regenset': regensettings(); break; default: index(); break; } function regensettings() { global $db, $ir, $c, $h, $userid, $set; if ($ir['user_level'] != 2) { echo 'You cannot access this area.<br /> > <a href="staff.php">Go Back</a>'; die($h->endpage()); } //Filter the inputs from the form. $_POST['willregen'] = (isset($_POST['willregen']) && is_numeric($_POST['willregen'])) ? abs(intval($_POST['willregen'])) : ''; $_POST['braveregen'] = (isset($_POST['braveregen']) && is_numeric($_POST['braveregen'])) ? abs(intval($_POST['braveregen'])) : ''; $_POST['donatorenergyregen'] = (isset($_POST['donatorenergyregen']) && is_numeric($_POST['donatorenergyregen'])) ? abs(intval($_POST['donatorenergyregen'])) : ''; $_POST['nondonatorenergyregen'] = (isset($_POST['nondonatorenergyregen']) && is_numeric($_POST['nondonatorenergyregen'])) ? abs(intval($_POST['nondonatorenergyregen'])) : ''; $_POST['donatorhpregen'] = (isset($_POST['donatorhpregen']) && is_numeric($_POST['donatorhpregen'])) ? abs(intval($_POST['donatorhpregen'])) : ''; $_POST['nondonatorhpregen'] = (isset($_POST['nondonatorhpregen']) && is_numeric($_POST['nondonatorhpregen'])) ? abs(intval($_POST['nondonatorhpregen'])) : ''; //If you haven't submitted the form yet, show the form. //If the form was submitted but not all fields were filled out yet, show the form. if (empty($_POST['willregen']) || empty($_POST['braveregen']) || empty($_POST['donatorenergyregen']) || empty($_POST['nondonatorenergyregen']) || empty($_POST['donatorhpregen']) || empty($_POST['nondonatorenergyregen']) ) { $csrf = request_csrf_html('staff_regenset'); //Convert the percentage settings from decimal to percent. $set['donatorhpregen']=$set['donatorhpregen']*100; $set['nondonatorhpregen']=$set['nondonatorhpregen']*100; echo " <h3>Regen Settings</h3> <hr /> <form action='staff.php?action=regenset' method='post'> <b>All values regen every 5 minutes.</b><br /><br /> Will Regen: <input type='text' name='willregen' value='{$set['willregen']}' /><br /> Brave Regen: <input type='text' name='braveregen' value='{$set['braveregen']}' /><br /> Donator Energy Regen: <input type='text' name='donatorenergyregen' value='{$set['donatorenergyregen']}' /><br /> Non-Donator Energy Regen: <input type='text' name='nondonatorenergyregen' value='{$set['nondonatorenergyregen']}' /><br /> Donator HP Regen %: <input type='text' name='donatorhpregen' value='{$set['donatorhpregen']}' /><br /> Non-Donator HP Regen %: <input type='text' name='nondonatorhpregen' value='{$set['nondonatorhpregen']}' /><br /> {$csrf} <input type='submit' value='Update Settings' /> </form> "; } //If the form was submitted and all fields were filled out, update the database. if ($_POST['willregen'] && $_POST['braveregen'] && $_POST['donatorenergyregen'] && $_POST['nondonatorenergyregen'] && $_POST['donatorhpregen'] && $_POST['nondonatorenergyregen']) { staff_csrf_stdverify('staff_regenset', 'staff.php?action=regenset'); //Convert the hp percentages to decimals. $_POST['donatorhpregen']=$_POST['donatorhpregen']*.01; $_POST['nondonatorhpregen']=$_POST['nondonatorhpregen']*.01; //Update all of the values. $db->query( "UPDATE `settings` SET `conf_value` = '{$_POST['willregen']}' WHERE `conf_name` = 'willregen'"); $db->query( "UPDATE `settings` SET `conf_value` = '{$_POST['braveregen']}' WHERE `conf_name` = 'braveregen'"); $db->query( "UPDATE `settings` SET `conf_value` = '{$_POST['donatorenergyregen']}' WHERE `conf_name` = 'donatorenergyregen'"); $db->query( "UPDATE `settings` SET `conf_value` = '{$_POST['nondonatorenergyregen']}' WHERE `conf_name` = 'nondonatorenergyregen'"); $db->query( "UPDATE `settings` SET `conf_value` = '{$_POST['donatorhpregen']}' WHERE `conf_name` = 'donatorhpregen'"); $db->query( "UPDATE `settings` SET `conf_value` = '{$_POST['nondonatorhpregen']}' WHERE `conf_name` = 'nondonatorhpregen'"); echo ' Regen settings updated!<br /> > <a href="staff.php">Back</a> '; stafflog_add("Updated the regen settings."); } } You will also need to add the following link to your staff admin panel menu under the area where only $ir['user_level']=2: > <a href='staff.php?action=regenset'>Regen Settings</a><br /> If you have any questions or if you think something is incorrect, let me know. --------------------------------- Also, if you carry the $timediff variable into your header function in header.php, it can give you the seconds remaining until the users next regen. I put it in the menu bar kind of like this, though it would probably look nicer as mins/secs:
-
To all of those who are still here from before, it's good to see you all again. For those who don't know me, in a past life I was an avid MCCodes Game Owner & Mod developer here. Unfortunately I could not figure out what my login was on my old account here, so I thought I'd start fresh as #2. Took a long hiatus from web development, but I'm picking it back up as a hobby for now, slowly building out a game in my free time. I recently took a new job writing scripts for my company and it has given me an itch to work on a side project. Cronwerks.com is currently my home base, however pretty much everything is hidden to outsiders so there isn't much to see at the moment. Maybe some day I'll actually add something worth a damn to that default template homepage, but for now it is not really important. I will be starting with base MCCodes however it will likely look nothing like MCCodes in pretty short order, that base game is.... well.. basic. I don't know if anyone still uses MCCodes as a source here, but if some do, I'll definitely post some of my work so that others can use it. Cheers to everyone. ~Cronus