Jump to content
MakeWebGames

Mine Mod [Free]


Recommended Posts

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 by realmoflegends
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...