Jump to content

Magictallguy

Moderators
  • Content Count

    1,740
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Magictallguy

  1. Magictallguy

    Just do it.

    What does your gratitude get me?
  2. That would seem to fit the logic - not a clue what the crons are, I didn't make this mod
  3. Change $i=mysqli_fetch_array($query); to $i = $db->fetch_row($query); mine_globals.php <?php require_once 'globals.php'; //Call upon database for mining values. //Item ID's can be altered. They are //located at the bottom of this file. $q = $db->query("SELECT `m_power`, `m_Mpower`, `m_mopower`, `m_level`, `mEXP`, `mNEXP` FROM `Mining` WHERE `userid` = $userid"); $row = $db->fetch_row($q); $power = $row['m_power']; $maxpower = $row['m_Mpower']; $mopower = $row['m_mopower']; $level = $row['m_level']; $exp = $row['mEXP']; $nexp = $row['mNEXP']; $laber = $ir['IQ']; $place = $ir['location']; $db->free_result($q); //End DB. //Status bars. //Mining power bar $mpower = min((int) ($power / $maxpower * 100), 100); //Mining Bar Not Used $mpower2 = 100 - $mpower; //Mining bar used7 //End Mining bar //Start experience bar $miexp = min((int) ($exp / $nexp * 100), 100); $miexp2 = 100 - $miexp; //End experience bar //End Status Bars //Experience gained? if ($nexp <= $exp) { $db->query("UPDATE `Mining` SET `m_level` = `m_level` + 1, `mEXP` = 0, `mNEXP` = (`mNEXP`*1.25)+50, `m_mopower` = `m_mopower` + 1 WHERE `userid` = $userid"); } if ($ir['hospital'] > 0) { die('Mining is for those who are healthy! You are in the infirmary, thus, you are not healthy.'); } if ($ir['jail'] > 0) { die("Mining is for the good warrior. You're in the dungeon, so thus, you are not a good warrior."); } //Edit below for items. $pick = 3; //Mining pickaxe value. $silverflakesid = 9; //Silver flakes ID $copperflakeid = 10; //Copper Flakes ID $goldflakeid = 11; //Gold Flakes ID $rocksid = 12; //Rocks item id $sapphireitem = 13; //Small Sapphire item id $bpick = 14; //Broken pickaxe item id $diamonditem = 15; //Small diamond item id. $emeralditem = 16; //Small emerald item. mine.php <?php /* Mining Mod by TheMasterGeneral Cost: FREE Use: Allows users to mine up flakes and gems, which can be used to create items*. *=Does not include crafting mod. If you want to use a crafting mod, I use Sniko's crafting mod along side this. SQL: CREATE TABLE IF NOT EXISTS `Mining` ( `userid` bigint(11) NOT NULL DEFAULT '1' COMMENT 'Userid', `m_level` bigint(11) NOT NULL DEFAULT '1' COMMENT 'Mining Level', `mEXP` decimal(11,0) NOT NULL DEFAULT '0' COMMENT 'Mining Exp', `mNEXP` decimal(11,0) NOT NULL DEFAULT '100' COMMENT 'Exp needed to level', `m_power` bigint(11) NOT NULL DEFAULT '100' COMMENT 'User''s mining power.', `m_Mpower` bigint(11) NOT NULL DEFAULT '100' COMMENT 'User''s MAX mining power.', `m_mopower` bigint(11) NOT NULL DEFAULT '1' COMMENT 'How much more power can one buy? (In 10 power sets)', PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; */ $macropage = 'mine.php'; require_once 'globals.php'; require 'mine_globals.php'; echo '<h3>Dangerous Mines</h3><hr />'; if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'mine': mine1(); break; case 'mine2': mine2(); break; case 'mine3': mine3(); break; case 'buyp': minepb(); break; case 'mine4': mine4(); break; case 'mine5': mine5(); break; case 'mine6': mine6(); break; default: mine_home(); break; } function minepb() { global $db, $ir, $c, $userid, $h; require 'mine_globals.php'; echo '<h3>Dangerous Mines</h3><hr />'; if ($level <= 10) { //If mining level is 1-10, 100 is the cost to add more power. $cost = 10; } if ($level <= 20 && $level >= 10) { //If mining level is 10-20, 1000 is the cost to add more power. $cost = 100; } if ($level <= 30 && $level >= 20) { //If mining level is 20-30, 5000 is the cost to add more power. $cost = 1000; } if ($level <= 75 && $level >= 30) { //If mining level is 75-30, 2000 is the cost to add more power. $cost = 2000; } if ($level <= 125 && $level >= 75) { //If mining level is 125-75, 5000 is the cost to add more power. $cost = 5000; } if (!isset($_POST['amount'])) { echo "<form action='mine.php?action=buyp' method='post'> You can currently buy $mopower sets of 10 mining power. How many do you wish to buy? Each set will cost you $cost IQ. <br><input type='text' name='amount' /><br> <input type='submit' value='Buy Power (No Prompt, so be sure!)' /> </form>"; } else { //Secure the ID input. $_GET['amount'] = (isset($_GET['amount']) && is_numeric($_GET['amount'])) ? abs(intval($_GET['amount'])) : ''; if ($_POST['amount'] > $mopower) { echo 'You do not have that many sets available to you. Try again.'; exit; } //Fix: Checks the input for negative values //To prevent users from inputting negative //values and give themselves labor //at the cost of losing mining power. if ($_POST['amount'] < 0) { echo 'Stop trying to abuse a game bug. You can be placed in Federal Jail for that.'; exit; } if (0 == $_POST['amount']) { echo 'Input must be a number larger than zero.'; exit; } if ($laber < $cost) { echo "You do not have enough IQ to add {$_POST['amount']} sets of mining power."; exit; } $poweradd = (10 * $_POST['amount']); $subtractlaber = ($cost * $_POST['amount']); $db->query("UPDATE `userstats` SET `IQ` = `IQ` - {$subtractlaber} WHERE `userid` = $userid"); $db->query("UPDATE `Mining` SET `m_Mpower` = `m_Mpower` + {$poweradd}, `m_mopower` = `m_mopower` - {$_POST['amount']} WHERE `userid` = $userid"); echo "You have purchased {$_POST['amount']} sets of mining power for $subtractlaber IQ."; } } function mine_home() { global $db, $ir, $c, $userid, $h; require 'mine_globals.php'; echo " This here be the ye'old mining shack. The mining hole is out back. Feel free to use it if ye got the right gear. There's six mining locations. You've gotta have the minimum level to mine there AND be within the same location. You also gotta make sure you've got the right gear! You will be able to purchase more mining power as well! You can mine up gems, rocks, and of course, <font color=silver>Silver Flakes</font>!<br> <hr /> You have $power / $maxpower mining power.<br> <img src='yellowbar.png' width='$mpower' height='10' /><img src='redbar.png' width='$mpower2' height='10' /><br /> You currently have $miexp % experience.<br> <img src='yellowbar.png' width='$miexp' height='10' /><img src='redbar.png' width='$miexp2' height='10' /><br /> You are level $level in mining.<br> <br> <br> <br> [<a href='mine.php?action=mine'>Cornrye - Level 1</a>]<br> [<a href='mine.php?action=mine2'>Falconworth - Level 10</a>]<br> [<a href='mine.php?action=mine3'>Rome - Level 20</a>]<br> [<a href='mine.php?action=mine4'>Timberwolf - Level 40</a>]<br> [<a href='mine.php?action=mine5'>Tel Yaga - Level 75</a>]<br> [<a href='mine.php?action=mine6'>Dion - Level 125</a>]<br> <br> <br> [<a href='mine.php?action=buyp'>Buy Mining Power</a>]<br> "; } function mine6() { global $db, $ir, $c, $userid, $h; $chance = rand(1, 130); require 'mine_globals.php'; $query = $db->query('SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid` = '.$pick." && `inv_userid` = $userid"); $i = $db->fetch_row($query); if (9 != $place) { echo 'You are not in Dion!'; exit; } //if ($level > 124) //{ //echo "This mine is way too easy for you. Leave it to the kiddies.<br> //<a href='mine.php'>Back</a>"; //exit; //} if ($level < 125) { die('Your mining level is too low for this mine.'); } if ($power < 100) { die("You need 100 mining power to mine here. You have $power."); } if (!$i['inv_itemid'] == $pick) { echo 'You need a basic pickaxe before you can even consider mining.'; exit; } if ($laber < 50000) { echo 'You need 50000 IQ to mine here! Come back when you have it!'; exit; } //Copper Flakes if ($chance <= 35) { $flakes = rand(250, 290); $expgain = (2.5 * $flakes); echo "While mining away, you have uncovered {$flakes} <font color=brown>Copper Flakes</font>!"; item_add($userid, $copperflakeid, $flakes); } //Rocks if (($chance >= 36) && ($chance <= 50)) { $rocks = rand(60, 80); $expgain = (2.25 * $rocks); echo "While mining away, you have managed to break away {$rocks} rock(s)!"; item_add($userid, $rocksid, $rocks); } //Infirmary if (($chance >= 51) && ($chance <= 55)) { $hosptime = (int) rand(550, 750); echo "You collapse a column holding the mineshaft up and caused a cave-in. You are later found under the rubble, barely breathing. You have been escorted to the infirmary for {$hosptime} minutes."; $reasonhosp = 'Mining Cave In'; $db->query("UPDATE users SET `hospital`=$hosptime,`hospreason`='$reasonhosp',`hp`=1 WHERE userid=$userid", $c); } //Dungeon if (($chance >= 56) && ($chance <= 60)) { $jailtime = (int) rand(550, 800); echo "While mining, a swarm of bugs overcrowd you. In attempt to get rid of them, you rip off your clothing and run into the nearest source of water. A guard sees you and escorts you into the dungeon for {$jailtime} minutes on the account of indecency exposure."; $reasonjail = 'Indecency Exposure'; $db->query("UPDATE users SET `jail` = $jailtime, `jail_reason` = '$reasonjail' WHERE userid=$userid", $c); } //Failed if (($chance >= 61) && ($chance <= 90)) { echo 'You gained nothing by mining.'; } //Gem if (($chance >= 91) && ($chance <= 93)) { $expgain = (2000); echo 'While mining away, you chip away a <font color=silver>Medium Sized Emerald</font>. Hold on this, you can use this in crafting!'; item_add($userid, 149, 1); //Replace 71 with your Small Sapphire item id. } //Break if (($chance >= 94) && ($chance <= 95)) { echo "While mining away, you struck a tough rock and broke your pickaxe. You're going to need to fix that before you can mine again."; item_add($userid, $bpick, 1); item_remove($userid, $pick, 1); } //Gold Flakes if (($chance >= 96) && ($chance <= 110)) { $gflake = rand(120, 200); $expgain = (3.5 * $gflake); echo "While mining away, you have managed to break away {$gflake} <font color=yellow>Gold Flakes</font>!"; item_add($userid, $goldflakeid, $gflake); } //Silver Flakes if (($chance >= 111) && ($chance <= 130)) { $sflake = rand(150, 250); $expgain = (3 * $sflake); echo "While mining away, you have managed to break away {$sflake} <font color=silver>Silver Flakes</font>!"; item_add($userid, $silverflakesid, $sflake); } //All done. Run this! if ($expgain) { $db->query("UPDATE `Mining` SET `mEXP` = `mEXP` + {$expgain} WHERE `userid` = $userid"); } $db->query("UPDATE `Mining` SET `m_power` = `m_power` - 100 WHERE `userid` = $userid"); die("<hr /> <a href='mine.php?action=mine6'>Mine Again</a><br /> <a href='mine.php'>>Back</a>"); } function mine5() { global $db, $ir, $c, $userid, $h; $chance = rand(1, 130); require 'mine_globals.php'; $query = $db->query('SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid` = '.$pick." && `inv_userid` = $userid"); $i = $db->fetch_row($query); if (6 != $place) { echo'You are not in Timberwolf!'; exit; } if ($level > 124) { echo "This mine is way too easy for you. Leave it to the kiddies.<br> <a href='mine.php'>Back</a>"; exit; } if ($level < 75) { die('Your mining level is too low for this mine.'); } if ($power < 50) { die("You need 50 mining power to mine here. You have $power."); } if (!$i['inv_itemid'] == $pick) { echo 'You need a basic pickaxe before you can even consider mining.'; exit; } if ($laber < 10000) { echo 'You need 1000 IQ to mine here! Come back when you have it!'; exit; } //Copper Flakes if ($chance <= 35) { $flakes = rand(220, 260); $expgain = (2 * $flakes); echo "While mining away, you have uncovered {$flakes} <font color=brown>Copper Flakes</font>!"; item_add($userid, $copperflakeid, $flakes); } //Rocks if (($chance >= 36) && ($chance <= 50)) { $rocks = rand(40, 56); $expgain = (1.75 * $rocks); echo "While mining away, you have managed to break away {$rocks} rock(s)!"; item_add($userid, $rocksid, $rocks); } //Infirmary if (($chance >= 51) && ($chance <= 55)) { $hosptime = (int) rand(300, 550); echo "You collapse a column holding the mineshaft up and caused a cave-in. You are later found under the rubble, barely breathing. You have been escorted to the infirmary for {$hosptime} minutes."; $reasonhosp = 'Mining Cave In'; $db->query("UPDATE users SET `hospital`=$hosptime,`hospreason`='$reasonhosp',`hp`=1 WHERE userid=$userid", $c); } //Dungeon if (($chance >= 56) && ($chance <= 60)) { $jailtime = (int) rand(330, 550); echo "While mining, a swarm of bugs overcrowd you. In attempt to get rid of them, you rip off your clothing and run into the nearest source of water. A guard sees you and escorts you into the dungeon for {$jailtime} minutes on the account of indecency exposure."; $reasonjail = 'Indecency Exposure'; $db->query("UPDATE users SET `jail` = $jailtime, `jail_reason` = '$reasonjail' WHERE userid=$userid", $c); } //Failed if (($chance >= 61) && ($chance <= 90)) { echo 'You gained nothing by mining.'; } //Gem if (($chance >= 91) && ($chance <= 93)) { $expgain = (1500); echo 'While mining away, you chip away a <font color=silver>Medium Sized Diamond</font>. Hold on this, you can use this in crafting!'; item_add($userid, 148, 1); //Replace 71 with your Small Sapphire item id. } //Break if (($chance >= 94) && ($chance <= 95)) { echo "While mining away, you struck a tough rock and broke your pickaxe. You're going to need to fix that before you can mine again."; item_add($userid, $bpick, 1); item_remove($userid, $pick, 1); } //Gold Flakes if (($chance >= 96) && ($chance <= 110)) { $gflake = rand(60, 160); $expgain = (2.75 * $gflake); echo "While mining away, you have managed to break away {$gflake} <font color=yellow>Gold Flakes</font>!"; item_add($userid, $goldflakeid, $gflake); } //Silver Flakes if (($chance >= 111) && ($chance <= 130)) { $sflake = rand(110, 230); $expgain = (2.5 * $sflake); echo "While mining away, you have managed to break away {$sflake} <font color=silver>Silver Flakes</font>!"; item_add($userid, $silverflakesid, $sflake); } //All done. Run this! if ($expgain) { $db->query("UPDATE `Mining` SET `mEXP` = `mEXP` + {$expgain} WHERE `userid` = $userid"); } $db->query("UPDATE `Mining` SET `m_power` = `m_power` - 50 WHERE `userid` = $userid"); die("<hr /> <a href='mine.php?action=mine5'>Mine Again</a><br /> <a href='mine.php'>>Back</a>"); } function mine1() { global $db, $ir, $c, $userid, $h; $chance = rand(1, 130); require 'mine_globals.php'; $query = $db->query('SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid` = '.$pick." && `inv_userid` = $userid"); $i = $db->fetch_row($query); if (1 != $place) { echo'You are not in Cornrye!'; exit; } if ($level > 9) { echo "This mine is way too easy for you. Leave it to the kiddies.<br> <a href='mine.php'>Back</a>"; exit; } if ($power < 10) { die("You need 10 mining power to mine here. You have $power."); } if (!$i['inv_itemid'] == $pick) { echo 'You need a basic pickaxe before you can even consider mining.'; exit; } if ($laber < 10) { echo 'You need 10 IQ to mine here! Come back when you have it!'; exit; } //Copper Flakes if ($chance <= 35) { $flakes = rand(20, 120); $expgain = (0.5 * $flakes); echo "While mining away, you have uncovered {$flakes} <font color=brown>Copper Flakes</font>!"; item_add($userid, $copperflakeid, $flakes); } //Rocks if (($chance >= 36) && ($chance <= 50)) { $rocks = rand(2, 10); $expgain = (0.3 * $rocks); echo "While mining away, you have managed to break away {$rocks} rock(s)!"; item_add($userid, $rocksid, $rocks); } //Infirmary if (($chance >= 51) && ($chance <= 55)) { $hosptime = (int) rand(30, 120); echo "You collapse a column holding the mineshaft up and caused a cave-in. You are later found under the rubble, barely breathing. You have been escorted to the infirmary for {$hosptime} minutes."; $reasonhosp = 'Mining Cave In'; $db->query("UPDATE users SET `hospital`=$hosptime,`hospreason`='$reasonhosp',`hp`=1 WHERE userid=$userid", $c); } //Dungeon if (($chance >= 56) && ($chance <= 60)) { $jailtime = (int) rand(30, 180); echo "While mining, a swarm of bugs overcrowd you. In attempt to get rid of them, you rip off your clothing and run into the nearest source of water. A guard sees you and escorts you into the dungeon for {$jailtime} minutes on the account of indecency exposure."; $reasonjail = 'Indecency Exposure'; $db->query("UPDATE users SET `jail` = $jailtime, `jail_reason` = '$reasonjail' WHERE userid=$userid", $c); } //Failed if (($chance >= 61) && ($chance <= 90)) { echo 'You gained nothing by mining.'; } //Gem if (($chance >= 91) && ($chance <= 93)) { $expgain = (35); echo 'While mining away, you chip away a <font color=blue>Small Sapphire</font>. Hold on this, you can use this in crafting!'; item_add($userid, $sapphireitem, 1); //Replace 71 with your Small Sapphire item id. } //Break if (($chance >= 94) && ($chance <= 95)) { echo "While mining away, you struck a tough rock and broke your pickaxe. You're going to need to fix that before you can mine again."; item_add($userid, $bpick, 1); item_remove($userid, $pick, 1); } //Gold Flakes if (($chance >= 96) && ($chance <= 110)) { $gflake = rand(5, 50); $expgain = (1 * $gflake); echo "While mining away, you have managed to break away {$gflake} <font color=yellow>Gold Flakes</font>!"; item_add($userid, $goldflakeid, $gflake); } //Silver Flakes if (($chance >= 111) && ($chance <= 130)) { $sflake = rand(15, 75); $expgain = (0.75 * $sflake); echo "While mining away, you have managed to break away {$sflake} <font color=silver>Silver Flakes</font>!"; item_add($userid, $silverflakesid, $sflake); } //All done. Run this! if ($expgain) { $db->query("UPDATE `Mining` SET `mEXP` = `mEXP` + {$expgain} WHERE `userid` = $userid"); } $db->query("UPDATE `Mining` SET `m_power` = `m_power` - 10 WHERE `userid` = $userid"); die("<hr /> <a href='mine.php?action=mine'>Mine Again</a><br /> <a href='mine.php'>>Back</a>"); } function mine2() { global $db, $ir, $c, $userid, $h; $chance = rand(1, 130); require 'mine_globals.php'; $query = $db->query('SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid` = '.$pick." && `inv_userid` = $userid"); $i = $db->fetch_row($query); if (4 != $place) { echo'You are not in Falconworth!'; exit; } if ($level > 19) { echo "This mine is way too easy for you. Leave it to the kiddies.<br> <a href='mine.php'>Back</a>"; exit; } if ($level < 10) { die('Your mining level is too low for this mine.'); } if ($power < 20) { die("You need 20 mining power to mine here. You have $power."); } if (!$i['inv_itemid'] == $pick) { echo 'You need a basic pickaxe before you can even consider mining.'; exit; } if ($laber < 100) { echo 'You need 100 IQ to mine here! Come back when you have it!'; exit; } //Copper Flakes if ($chance <= 35) { $flakes = rand(40, 140); $expgain = (0.75 * $flakes); echo "While mining away, you have uncovered {$flakes} <font color=brown>Copper Flakes</font>!"; item_add($userid, $copperflakeid, $flakes); } //Rocks if (($chance >= 36) && ($chance <= 50)) { $rocks = rand(5, 12); $expgain = (0.5 * $rocks); echo "While mining away, you have managed to break away {$rocks} rock(s)!"; item_add($userid, $rocksid, $rocks); } //Infirmary if (($chance >= 51) && ($chance <= 55)) { $hosptime = (int) rand(50, 150); echo "You collapse a column holding the mineshaft up and caused a cave-in. You are later found under the rubble, barely breathing. You have been escorted to the infirmary for {$hosptime} minutes."; $reasonhosp = 'Mining Cave In'; $db->query("UPDATE users SET `hospital`=$hosptime,`hospreason`='$reasonhosp',`hp`=1 WHERE userid=$userid", $c); } //Dungeon if (($chance >= 56) && ($chance <= 60)) { $jailtime = (int) rand(50, 200); echo "While mining, a swarm of bugs overcrowd you. In attempt to get rid of them, you rip off your clothing and run into the nearest source of water. A guard sees you and escorts you into the dungeon for {$jailtime} minutes on the account of indecency exposure."; $reasonjail = 'Indecency Exposure'; $db->query("UPDATE users SET `jail` = $jailtime, `jail_reason` = '$reasonjail' WHERE userid=$userid", $c); } //Failed if (($chance >= 61) && ($chance <= 90)) { echo 'You gained nothing by mining.'; } //Gem if (($chance >= 91) && ($chance <= 93)) { $expgain = (150); echo 'While mining away, you chip away a <font color=silver>Small Diamond</font>. Hold on this, you can use this in crafting!'; item_add($userid, $diamonditem, 1); //Replace 71 with your Small Sapphire item id. } //Break if (($chance >= 94) && ($chance <= 95)) { echo "While mining away, you struck a tough rock and broke your pickaxe. You're going to need to fix that before you can mine again."; item_add($userid, $bpick, 1); item_remove($userid, $pick, 1); } //Gold Flakes if (($chance >= 96) && ($chance <= 110)) { $gflake = rand(10, 55); $expgain = (1.25 * $gflake); echo "While mining away, you have managed to break away {$gflake} <font color=yellow>Gold Flakes</font>!"; item_add($userid, $goldflakeid, $gflake); } //Silver Flakes if (($chance >= 111) && ($chance <= 130)) { $sflake = rand(25, 85); $expgain = (1 * $sflake); echo "While mining away, you have managed to break away {$sflake} <font color=silver>Silver Flakes</font>!"; item_add($userid, $silverflakesid, $sflake); } //All done. Run this! if ($expgain) { $db->query("UPDATE `Mining` SET `mEXP` = `mEXP` + {$expgain} WHERE `userid` = $userid"); } $db->query("UPDATE `Mining` SET `m_power` = `m_power` - 20 WHERE `userid` = $userid"); die("<hr /> <a href='mine.php?action=mine2'>Mine Again</a><br /> <a href='mine.php'>>Back</a>"); } function mine3() { global $db, $ir, $c, $userid, $h; $chance = rand(1, 130); require 'mine_globals.php'; $query = $db->query('SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid` = '.$pick." && `inv_userid` = $userid"); $i = $db->fetch_row($query); if (5 != $place) { echo'You are not in Rome!'; exit; } if ($level > 39) { echo "This mine is way too easy for you. Leave it to the kiddies.<br> <a href='mine.php'>Back</a>"; exit; } if ($level < 20) { die('Your mining level is too low for this mine.'); } if ($power < 20) { die("You need 20 mining power to mine here. You have $power."); } if (!$i['inv_itemid'] == $pick) { echo 'You need a basic pickaxe before you can even consider mining.'; exit; } if ($laber < 500) { echo 'You need 500 IQ to mine here! Come back when you have it!'; exit; } //Copper Flakes if ($chance <= 35) { $flakes = rand(60, 160); $expgain = (1 * $flakes); echo "While mining away, you have uncovered {$flakes} <font color=brown>Copper Flakes</font>!"; item_add($userid, $copperflakeid, $flakes); } //Rocks if (($chance >= 36) && ($chance <= 50)) { $rocks = rand(8, 16); $expgain = (0.75 * $rocks); echo "While mining away, you have managed to break away {$rocks} rock(s)!"; item_add($userid, $rocksid, $rocks); } //Infirmary if (($chance >= 51) && ($chance <= 55)) { $hosptime = (int) rand(75, 175); echo "You collapse a column holding the mineshaft up and caused a cave-in. You are later found under the rubble, barely breathing. You have been escorted to the infirmary for {$hosptime} minutes."; $reasonhosp = 'Mining Cave In'; $db->query("UPDATE users SET `hospital`=$hosptime,`hospreason`='$reasonhosp',`hp`=1 WHERE userid=$userid", $c); } //Dungeon if (($chance >= 56) && ($chance <= 60)) { $jailtime = (int) rand(75, 225); echo "While mining, a swarm of bugs overcrowd you. In attempt to get rid of them, you rip off your clothing and run into the nearest source of water. A guard sees you and escorts you into the dungeon for {$jailtime} minutes on the account of indecency exposure."; $reasonjail = 'Indecency Exposure'; $db->query("UPDATE users SET `jail` = $jailtime, `jail_reason` = '$reasonjail' WHERE userid=$userid", $c); } //Failed if (($chance >= 61) && ($chance <= 90)) { echo 'You gained nothing by mining.'; } //Gem if (($chance >= 91) && ($chance <= 93)) { $expgain = (500); echo 'While mining away, you chip away a <font color=green>Emerald</font>. Hold on this, you can use this in crafting!'; item_add($userid, $emeralditem, 1); //Replace 71 with your Small Sapphire item id. } //Break if (($chance >= 94) && ($chance <= 95)) { echo "While mining away, you struck a tough rock and broke your pickaxe. You're going to need to fix that before you can mine again."; item_add($userid, $bpick, 1); item_remove($userid, $pick, 1); } //Gold Flakes if (($chance >= 96) && ($chance <= 110)) { $gflake = rand(10, 55); $expgain = (1.5 * $gflake); echo "While mining away, you have managed to break away {$gflake} <font color=yellow>Gold Flakes</font>!"; item_add($userid, $goldflakeid, $gflake); } //Silver Flakes if (($chance >= 111) && ($chance <= 130)) { $sflake = rand(25, 85); $expgain = (1.25 * $sflake); echo "While mining away, you have managed to break away {$sflake} <font color=silver>Silver Flakes</font>!"; item_add($userid, $silverflakesid, $sflake); } //All done. Run this! if ($expgain) { $db->query("UPDATE `Mining` SET `mEXP` = `mEXP` + {$expgain} WHERE `userid` = $userid"); } $db->query("UPDATE `Mining` SET `m_power` = `m_power` - 20 WHERE `userid` = $userid"); die("<hr /> <a href='mine.php?action=mine3'>Mine Again</a><br /> <a href='mine.php'>>Back</a>"); } function mine4() { global $db, $ir, $c, $userid, $h; $chance = rand(1, 130); require 'mine_globals.php'; $query = $db->query('SELECT `inv_itemid` FROM `inventory` WHERE `inv_itemid` = '.$pick." && `inv_userid` = $userid"); $i = $db->fetch_row($query); if (6 != $place) { echo'You are not in Timberwolf!'; exit; } if ($level > 74) { echo "This mine is way too easy for you. Leave it to the kiddies.<br> <a href='mine.php'>Back</a>"; exit; } if ($level < 40) { die('Your mining level is too low for this mine.'); } if ($power < 50) { die("You need 50 mining power to mine here. You have $power."); } if (!$i['inv_itemid'] == $pick) { echo 'You need a basic pickaxe before you can even consider mining.'; exit; } if ($laber < 1000) { echo 'You need 1000 IQ to mine here! Come back when you have it!'; exit; } //Copper Flakes if ($chance <= 35) { $flakes = rand(80, 180); $expgain = (1.5 * $flakes); echo "While mining away, you have uncovered {$flakes} <font color=brown>Copper Flakes</font>!"; item_add($userid, $copperflakeid, $flakes); } //Rocks if (($chance >= 36) && ($chance <= 50)) { $rocks = rand(20, 36); $expgain = (1.25 * $rocks); echo "While mining away, you have managed to break away {$rocks} rock(s)!"; item_add($userid, $rocksid, $rocks); } //Infirmary if (($chance >= 51) && ($chance <= 55)) { $hosptime = (int) rand(200, 300); echo "You collapse a column holding the mineshaft up and caused a cave-in. You are later found under the rubble, barely breathing. You have been escorted to the infirmary for {$hosptime} minutes."; $reasonhosp = 'Mining Cave In'; $db->query("UPDATE users SET `hospital`=$hosptime,`hospreason`='$reasonhosp',`hp`=1 WHERE userid=$userid", $c); } //Dungeon if (($chance >= 56) && ($chance <= 60)) { $jailtime = (int) rand(225, 325); echo "While mining, a swarm of bugs overcrowd you. In attempt to get rid of them, you rip off your clothing and run into the nearest source of water. A guard sees you and escorts you into the dungeon for {$jailtime} minutes on the account of indecency exposure."; $reasonjail = 'Indecency Exposure'; $db->query("UPDATE users SET `jail` = $jailtime, `jail_reason` = '$reasonjail' WHERE userid=$userid", $c); } //Failed if (($chance >= 61) && ($chance <= 90)) { echo 'You gained nothing by mining.'; } //Gem if (($chance >= 91) && ($chance <= 93)) { $expgain = (1000); echo 'While mining away, you chip away a <font color=blue>Medium Sized Sapphire</font>. Hold on this, you can use this in crafting!'; item_add($userid, 147, 1); //Replace 71 with your Small Sapphire item id. } //Break if (($chance >= 94) && ($chance <= 95)) { echo "While mining away, you struck a tough rock and broke your pickaxe. You're going to need to fix that before you can mine again."; item_add($userid, $bpick, 1); item_remove($userid, $pick, 1); } //Gold Flakes if (($chance >= 96) && ($chance <= 110)) { $gflake = rand(30, 85); $expgain = (2.25 * $gflake); echo "While mining away, you have managed to break away {$gflake} <font color=yellow>Gold Flakes</font>!"; item_add($userid, $goldflakeid, $gflake); } //Silver Flakes if (($chance >= 111) && ($chance <= 130)) { $sflake = rand(55, 115); $expgain = (2 * $sflake); echo "While mining away, you have managed to break away {$sflake} <font color=silver>Silver Flakes</font>!"; item_add($userid, $silverflakesid, $sflake); } //All done. Run this! if ($expgain) { $db->query("UPDATE `Mining` SET `mEXP` = `mEXP` + {$expgain} WHERE `userid` = $userid"); } $db->query("UPDATE `Mining` SET `m_power` = `m_power` - 50 WHERE `userid` = $userid"); die("<hr /> <a href='mine.php?action=mine4'>Mine Again</a><br /> <a href='mine.php'>>Back</a>"); }
  4. In your error class (in, uh.., /lib, I think), there's a line like define('DEBUG', false); Change that false to true and attempt to access the mines again. Note that all users will be able to see the error messages if encountered.
  5. Have you edited mine_globals.php to configure your corresponding item IDs?
  6. Confirmed working for me too. Throwing a guess at wrong lib version?
  7. This was a support request from around 2 years ago. You're likely missing the SQL, which is why you're encountering that error Spotted the SQL in OP's post, disregard
  8. Did things with MCCLite (PDO wrapper, BS4, FontAwesome, etc.)
    GitLab: Magictallguy/mcclite-pdo

    1. Magictallguy

      Magictallguy

      Conversion to PDO is complete and will remain available as a release (once I've cleaned up the branches).
      Considering using it (on another branch) for various experiments

  9. My tests show this working as intended
  10. I edited the code. It was displaying the hospital minutes in the "Heal" URL. It now displays userid. If you've definitely updated from my edits, you shouldn't be getting that issue
  11. Reason for your staff colours not overriding donator is because you've added them after the donator colouring condition. Flip 'em round (see example below) if ($r['user_level'] == 2) { $r['username'] = "<font color=blue>{$r['username']}</font>"; $d = ''; } elseif ($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>"; $d = "<img src='donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />"; } If you don't mind your staff members also having the donator icon (if applicable), you can set $d between your colour conditions and username output <?php $color = null; if($r['user_level'] == 2) { $color = 'blue'; } elseif($r['donatordays'] > 0) { $color = 'red'; } if($r['donatordays'] > 0) { $titleAlt = 'Donator: '.$r['donatordays'].' Day'.($r['donatordays'] == 1 ? '' : 's').' Left'; $d = ' <img src="donator.gif" title="'.$titleAlt.'" alt="'.$titleAlt.'" />'; } else { $d = ''; } if($color !== null) { $r['username'] = '<span style="color:'.$color.';">'.$r['username'].'</span>'; } // Output echo $r['username'],$d; That being said, I would recommend throwing this logic into a function seeing as there are 120 instances of a username being echoed out somewhere - that's a lot of places to update in order to unify your changes. @Shades's function would get you off the ground. Tweak to your liking and implement across the board!
  12. You'll have to edit all instances of a username being displayed. What have you got and what have you tried so far?
  13. Tested and sure ain't guaranteeing perfection here.. hospital.php [v1] <?php $globals = __DIR__.'/globals.php'; if (file_exists($globals)) { require_once $globals; } else { session_start(); if (!array_key_exists('loggedin', $_SESSION) or !$_SESSION['loggedin']) { exit(header('Location: /login.php')); } $userid = array_key_exists('userid', $_SESSION) && ctype_digit($_SESSION['userid']) && $_SESSION['userid'] > 0 ? $_SESSION['userid'] : null; if (!$userid) { exit(header('Location: /login.php')); } require_once __DIR__.'/mysql.php'; global $c; require_once __DIR__.'/global_func.php'; require_once __DIR__.'/header.php'; $selectMe = mysql_query('SELECT u.*, us.* FROM users AS u INNER JOIN userstats AS us ON u.userid = us.userid WHERE u.userid = '.$userid, $c) or exit(mysql_error()); if (!mysql_num_rows($selectMe)) { session_unset(); session_destroy(); exit(header('Location: /login.php')); } $ir = mysql_fetch_assoc($selectMe); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h = new headers(); $h->startheaders(); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); } $_GET['heal'] = array_key_exists('heal', $_GET) && ctype_digit($_GET['heal']) && $_GET['heal'] > 0 ? $_GET['heal'] : null; echo '<h3><u>Hospital</u></h3>'; if (null !== $_GET['heal']) { if ($ir['hospital'] < 1) { if ($_GET['heal'] != $ir['userid']) { $selectPatient = mysql_query('SELECT userid, username, hospital, level, gender FROM users WHERE userid = '.$_GET['heal'], $c) or exit(mysql_error()); if (mysql_num_rows($selectPatient)) { $row = mysql_fetch_assoc($selectPatient); $name = '<a href="viewuser.php?u='.$row['userid'].'">'.stripslashes(htmlspecialchars($row['username'])).'</a>'; if ($row['hospital'] > 0) { $cost = $row['hospital'] * $row['level']; $himHer = 'Male' == $row['gender'] ? 'him' : 'her'; $extra = 'To heal '.$name.' with '.$row['hospital'].' minute'.(1 == $row['hospital'] ? '' : 's').' remaining, it would cost $'.number_format($cost); if ($ir['money'] >= $cost) { if (array_key_exists('ans', $_GET)) { mysql_query('UPDATE users SET hospital = 0, hp = maxhp WHERE userid = '.$row['userid'], $c) or exit(mysql_error()); mysql_query('UPDATE users SET money = money - '.$cost.' WHERE userid = '.$ir['userid'], $c) or exit(mysql_error()); event_add($row['userid'], 'You were healed by <a href="viewuser.php?u='.$ir['userid'].'">'.$ir['username'].'</a>'); echo 'You\'ve healed '.$name.' for $'.number_format($cost); } else { echo $extra.'<br> <a href="hospital.php?heal='.$row['userid'].'&ans=yes">Ok, heal '.$himHer.'</a>'; } } else { echo 'You don\'t have enough money. '.$extra; } } else { echo $name.' isn\'t in hospital'; } } else { echo 'Your intended patient doesn\'t exist'; } } else { echo 'You can\'t heal yourself'; } } else { echo 'You can\'t heal others whilst in hospital'; } } $selectPatients = mysql_query('SELECT userid, username, hospital, hospreason, level FROM users WHERE hospital > 0 ORDER BY hospital DESC', $c) or exit(mysql_error()); ?> <table class="table"> <thead> <tr> <th>Patient</th> <th>Level</th> <th>Time</th> <th>Reason</th> <th>Actions</th> </tr> </thead> <tbody><?php if (!mysql_num_rows($selectPatients)) { ?> <tr> <td colspan="5" class="center">There are currently no patients</td> </tr><?php } else { while ($row = mysql_fetch_assoc($selectPatients)) { ?> <tr> <td><a href="viewuser.php?u=<?php echo $row['userid']; ?>"><?php echo stripslashes(htmlspecialchars($row['username'])); ?></a></td> <td><?php echo number_format($row['level']); ?></td> <td><?php echo $row['hospital'].' minute'.(1 == $row['hospital'] ? '' : 's'); ?></td> <td><?php echo stripslashes($row['hospreason']); ?></td> <td><?php if (!$ir['hospital']) { ?> <a href="hospital.php?heal=<?php echo $row['userid']; ?>">Heal</a><?php } ?> </td> </tr><?php } } ?> </tbody> </table><?php $h->endpage(); hospital.php [v2] <?php require_once __DIR__.'/globals.php'; $_GET['heal'] = array_key_exists('heal', $_GET) && ctype_digit($_GET['heal']) && $_GET['heal'] > 0 ? $_GET['heal'] : null; echo '<h3><u>Hospital</u></h3>'; if (null !== $_GET['heal']) { if ($ir['hospital'] < 1) { if ($_GET['heal'] != $ir['userid']) { $selectPatient = $db->query('SELECT userid, username, hospital, level, gender FROM users WHERE userid = '.$_GET['heal']); if ($db->num_rows($selectPatient)) { $row = $db->fetch_row($selectPatient); $name = '<a href="viewuser.php?u='.$row['userid'].'">'.stripslashes(htmlspecialchars($row['username'])).'</a>'; if ($row['hospital'] > 0) { $cost = $row['hospital'] * $row['level']; $himHer = 'Male' == $row['gender'] ? 'him' : 'her'; $extra = 'To heal '.$name.' with '.$row['hospital'].' minute'.(1 == $row['hospital'] ? '' : 's').' remaining, it would cost $'.number_format($cost); if ($ir['money'] >= $cost) { if (array_key_exists('ans', $_GET)) { $db->query('UPDATE users SET hospital = 0, hp = maxhp WHERE userid = '.$row['userid']); $db->query('UPDATE users SET money = money - '.$cost.' WHERE userid = '.$ir['userid']); event_add($row['userid'], 'You were healed by <a href="viewuser.php?u='.$ir['userid'].'">'.$ir['username'].'</a>'); echo 'You\'ve healed '.$name.' for $'.number_format($cost); } else { echo $extra.'<br> <a href="hospital.php?heal='.$row['userid'].'&ans=yes">Ok, heal '.$himHer.'</a>'; } } else { echo 'You don\'t have enough money. '.$extra; } } else { echo $name.' isn\'t in hospital'; } } else { echo 'Your intended patient doesn\'t exist'; } } else { echo 'You can\'t heal yourself'; } } else { echo 'You can\'t heal others whilst in hospital'; } } $selectPatients = $db->query('SELECT userid, username, hospital, hospreason, level FROM users WHERE hospital > 0 ORDER BY hospital DESC'); ?> <table class="table"> <thead> <tr> <th>Patient</th> <th>Level</th> <th>Time</th> <th>Reason</th> <th>Actions</th> </tr> </thead> <tbody><?php if (!$db->num_rows($selectPatients)) { ?> <tr> <td colspan="5" class="center">There are currently no patients</td> </tr><?php } else { while ($row = $db->fetch_row($selectPatients)) { ?> <tr> <td><a href="viewuser.php?u=<?php echo $row['userid']; ?>"><?php echo stripslashes(htmlspecialchars($row['username'])); ?></a></td> <td><?php echo number_format($row['level']); ?></td> <td><?php echo $row['hospital'].' minute'.(1 == $row['hospital'] ? '' : 's'); ?></td> <td><?php echo stripslashes($row['hospreason']); ?></td> <td><?php if (!$ir['hospital']) { ?> <a href="hospital.php?heal=<?php echo $row['userid']; ?>">Heal</a><?php } ?> </td> </tr><?php } } ?> </tbody> </table><?php $h->endpage();
  14. As this topic was tagged with mccodes-lite, the code above won't work without conversion
  15. Welcome back! There is indeed still a market for text-based games
  16. S'pose I can spare the time 😛 MCC Lite, aye?
  17. Not to my knowledge, but one can be created for you
  18. Can you clear anything up for us, @sniko?
  19. Happy to help, glad to hear you're up and running ^.^
  20. Alright, let's try a slightly different method. Replace if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } with if (isset($argv)) { $args = parse_str($argv[1], $param); $_GET['code'] = $param['code']; } if(!array_key_exists('code', $_GET) or $_GET['code'] != $cron_code) { exit; }
  21. You haven't passed the cron token to your command either. So, the top of your cron file (using the snippet you posted as reference) require_once dirname(__DIR__).'/mysqli.php'; $cron_code = '672bb9f5a0b168da99fbbf74980175ecd'; if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } And your command should be php /home/battlefo/public_html/crons/cron_fivemins.php code=672bb9f5a0b168da99fbbf74980175ecd
  22. You've passed a cron command to a variable that shouldn't be there. Change your $cron_code var to hold, funnily enough, your cron's code (an override token that allows it to run). $cron_code = '672bb9f5a0b168da99fbbf74980175ecd'; You may also wish to generate a new cron token as that one is now public - note that, if you do, you will need to update the cron commands with the new token too
×
×
  • Create New...