realmoflegends Posted May 31, 2011 Share Posted May 31, 2011 (edited) Hey all, I decided to go ahead and offer this one for free: Here's a Mine Mod where players can search for cash and crystals, with power levels and experience needed to advance that change over time. I've never posted a free mod before too, so I wanted to offer this to the community. This one is an altered and bug fixed version of the 'Mines--Fixed' thread that was posted over a year ago now. The main difference: This one actually works. That code was buggy, not attractive and required numerous fixes to work correctly. The leveling system didn't really work, and max power wasn't being updated when you gained levels either. Now i've fixed it and all of that works great and has been tested a lot with my new game. Some text tailored to my game (Crowns, Gems, etc.) may need to be changed obviously. This new mod is nicely formatted, and has even added possible events too: a chance of finding nothing when you dig, or a chance for a cave-in and going to the hospital, all easily adjustable. Create mine.php with this code (no spaces should be in the word power, ignore any that are there, forum software inserts those strangely): You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. - Open up cron_fivemins and in your queries add: $thug = "UPDATE `users` SET `power`=`power`+(max_power/(12.5)) WHERE `power`<`max_power`"; mysql_query($thug); - Open phpmyadmin and run this query: ALTER TABLE `users` ADD`mine_level` INT(11) NOT NULL DEFAULT '1'; ALTER TABLE `users` ADD`mine_exp` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `users` ADD`mine_needed` INT(11) NOT NULL DEFAULT '100'; ALTER TABLE `users` ADD`power` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `users` ADD`max_power` INT(11) NOT NULL DEFAULT '10'; - Insert this at the bottom of your global_func.php file: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. 3. Set the max_power and mine_needed increments where you want them. 4. Link to the mine.php where you want players to access it. That's it. Screenshot of the mod in action: Screenshot Easy to install and adjust for any economy, and its for v2 or higher of McCodes. Enjoy! Derek Edited May 31, 2011 by realmoflegends Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted May 31, 2011 Share Posted May 31, 2011 Why do this $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; When you have this default: mine_index(); break; Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 31, 2011 Share Posted May 31, 2011 Not a bad mod by the looks of it thanks for contributing. Just some small things after a quick scan - 1) why do a query for the userdata? You already have $ir with everything in. 2) Some deprecated html in there e.g. <center> 3) you abs( (int)) numbers that come from rand(). There is no point as it's always going to be a number, and no user input seems to be able to manipulate it here. 4) I would suggest since you have the query there anyway, and nothing linking it to the user table indefinitely why not give it its own table? Called once, on one page but it's increasing your larger user query. Quote Link to comment Share on other sites More sharing options...
realmoflegends Posted May 31, 2011 Author Share Posted May 31, 2011 I should note about 85% of this was written ages ago, not by me, and not changed since it worked fine. My intent with this free mod was to correct clear bugs that kept it from working. Yes, I know <center> is being depreciated, but it works, and using CSS for this task is a little more cumbersome. :) ruler and Dominion, some good calls on small stuff (I like to learn too), but the bottom line on this one was to fix stuff that didn't work so the mod could just plug in and work, without all the bug hunting that seems to happen much of the time with the free mods. Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 31, 2011 Share Posted May 31, 2011 Fair enough many feel that about using css rather than things like that. As I said nice mod. :) Quote Link to comment Share on other sites More sharing options...
Casey Posted June 6, 2011 Share Posted June 6, 2011 its an ok mod but aint msql_query v1 and v2 is $db-> .. Looks a nice coded script and very layed out fair play. Quote Link to comment Share on other sites More sharing options...
Dominion Posted June 6, 2011 Share Posted June 6, 2011 its an ok mod but aint msql_query v1 and v2 is $db-> .. Looks a nice coded script and very layed out fair play. $db->query is just mysql_query() or die(mysql_error()) it's find to use mysql_query here... Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted June 7, 2011 Share Posted June 7, 2011 I would create a new table instead of adding it to the users. Would make more sense after all mc2 default code has a habit of doing this select * from users You do not need int(11) for those fields mediumint would have been better or even smallint. What is with the mine sub in the switch I didnt actually see any sub functions in the code. Quote Link to comment Share on other sites More sharing options...
realmoflegends Posted June 7, 2011 Author Share Posted June 7, 2011 These are the functions: function cavein() { function nothing() { for the variable things that may happen during a mine search. Each type of mine is also a separate function, that way the odds and awards can be varied. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.