Jump to content
MakeWebGames

Joshua

Members
  • Posts

    1,271
  • Joined

  • Last visited

Everything posted by Joshua

  1. Well I finished mine and I'm posting it anyways :P
  2. omg i could kill you lmao I started on this 20 minutes ago, am finishing the staff function bit now lol
  3. /e thinks MTG needs to get out more ^_^
  4. So it's been awhile since I've done many Free mods, I'd like to change that. Throw me your Ideas here and I'll see what I can do :-)
  5. Agreed >,< Makes me wonder how many times i've posted something and it didnt post right :O
  6. No need it's not worth my time.   I posted a fixed mod for free for the users of mwg, you're the one flaming in it, i'm just replying :)   as far as using the class for ease, yes, it is easier to use $db But it's "better" to use mysql_ so if i slap it together using mysql_ and take my own time doing it, i dont see why anyone would have a problem with it and I wouldnt even change it as i've already done the hard work for you :D
  7. If you look at the "link" at the beginning of the post you would realize that this mod was already posted and has been floating around forever. it was just missing some vital parts to actually make it work, so i fixed it. Nothing huge.   like immortal said he had to discuss it with another coder so im sure he now knows everything.   Funny, I was just thinking you felt that way about yourself and i'm coming to terms with you dont know half as much as what you claim to think you know.   I see nothing wrong with discussing PHP with other coders and perhaps learning something from them. It's educational and beneficial. We cant all just think we know everything like you or no one would ever progress.
  8. $this->result=mysql_query($this->last_query, $this->connection_id) or $this->query_error();   That's $db->query :P mysql_query $c or die(mysql_error());   Exact same thing only not calling to a seperate file to do the work i can do as I type :P   ANYwho It does look better Nicholas, thanks :)
  9.   After a lengthy conversation with Equinox, and a bit of php.net surfing It's just the same to use mysql_query only differance is speed. mysql_query is faster. Have you looked at the $db->query in the class file?   function query($query) { $this->last_query=$query; $this->num_queries++; $this->result=mysql_query($this->last_query, $this->connection_id) or $this->query_error(); return $this->result; }
  10.   Not if you use $c the connection identifier, plus it's faster not filtering it through the class files :-) the only REAL differance is $db has it's own "error handler" But if script is written properly it shouldn't error, as well as if you wanted you could just add OR die(mysql_error()); to the end of the statements and will get the exact same thing $db does only faster :P
  11. To start them off with full Power open up register.php find   $db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')");   in the above query, after lastip_signup change to lastip_signup, power, maxpower) Further in that query find '$IP' change to '$IP', 10, 10) Now you can alter the above SQL where the Defaults are set to 0   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 '0';
  12. Wasnt sure if players needed/wanted them I added a snippet on the actual mod that tells you how much power you have left / max power at top :p Might also want to add something in Register.php to set their power to max when they sign up, or they'll start with 0 but again, optional :P
  13. lol wth? :P   An Umbrella ^_-
  14. [mccode v2] Mining V2 Converted Was a few functions missing as well as a few other nic nac things. So here's the one i have managed to get working for you.   First. mine.php   <?php require_once("globals.php"); $thug = mysql_query("SELECT `userid`,`power`,`jail`,`hospital`,`mine_exp`,`mine_needed`,`mine_level`,`power`,`max_power` FROM `users` WHERE (`userid`=".$_SESSION['userid'].")",$c); $s = mysql_fetch_array($thug); mine_check(); $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; switch($_GET['action']) { case 'mine': mine_1(); break; case 'minesub': mine_1_sub(); break; case 'mine2': mine_2(); break; case 'mine2sub': mine_2_sub(); break; case 'mine3': mine_3(); break; case 'mine3sub': mine_3_sub(); break; case 'mine4': mine_4(); break; case 'mine4sub': mine_4_sub(); break; case 'mine5': mine_5(); break; case 'mine5sub': mine_6_sub(); break; case 'mine6': mine_6(); break; case 'mine6sub': mine_6_sub(); break; default: mine_index(); break; } /** ** Calls the cases so mine.php?mine **/ function mine_index() { global $h,$s,$c; echo "<center>Welcome to the mine shaft. There are 3 spots to go mining but thay are restricted depending on your mine level. Your mining level is ".number_format($s['mine_level'])." and you have ".number_format($s['mine_exp'])."/".number_format($s['mine_needed'])." mining experience. Power: ".number_format($s['power'])."/".number_format($s['max_power'])." </center>"; echo "<center> <u>Crystal Mines</u> [[url='mine.php?action=mine']Level 1 mine[/url]] [[url='mine.php?action=mine2']Level 20 mine[/url]] [[url='mine.php?action=mine3']Level 40 mine[/url]] <u>Money Mines</u> [[url='mine.php?action=mine4']Level 10 mine[/url]] [[url='mine.php?action=mine5']Level 30 mine[/url]] [[url='mine.php?action=mine6']Level 40 mine[/url]] </center>"; } if ($s['jail'] > 0) { echo "<center>The mine is closed to jail birds come back when thay release you</center>"; $h->endpage(); exit; } if ($s['hospital'] > 0) { echo "<center>You cant go mining while in hospital</center>"; $h->endpage(); exit; } function mine_1() { global $s,$h,$c; if($s['power'] < 10) { echo "You need 10 power to mine here your have ".number_format($s['power']).""; $h->endpage(); exit; } mysql_query("UPDATE `users` SET `power`=`power`-10 WHERE (`userid`=".$_SESSION['userid'].")",$c); $rand_gems = rand(1,5); $rand_exp = rand(1,100); echo "<center>You begin mining in the level 1 mine and found $rand_gems crystal(s).</center> "; mysql_query("UPDATE `users` SET `crystals`=`crystals`+".abs((int) $rand_gems).",`mine_exp`=`mine_exp`+".abs((int) $rand_exp)." WHERE (`userid`=".$_SESSION['userid'].")",$c); echo "<center>[[url='mine.php?action=mine']Mine again[/url]]</center> "; echo "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_2() { global $s,$h,$c; if($s['power'] < 15) { echo "<center>You need 15 power to mine here your have ".number_format($s['power'])."</center>"; $h->endpage(); exit; } if($s['mine_level'] < 20) { echo "<center>You need to be mining level 20 to mine here you are mining level ".number_format($s['mine_level'])."</center>"; $h->endpage(); exit; } mysql_query("UPDATE `users` SET `power`=`power`-15 WHERE (`userid`=".$_SESSION['userid'].")",$c); $rand_gems = rand(1,20); $rand_exp = rand(1,300); echo "<center>You begin mining in the level 20 mine and found ".number_format($rand_gems)." crystal(s).</center> "; mysql_query("UPDATE `users` SET `crystals`=`crystals`+".abs((int) $rand_gems).",`mine_exp`+".abs((int) $rand_exp)." WHERE (`userid`=".$_SESSION['userid'].")",$c); echo "<center>[[url='mine.php?action=mine2']Mine again[/url]]</center> "; echo "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_3() { global $s,$h,$c; if($s['power'] < 25) { echo "<center>You need 25 power to mine here your have {$s['power']}</center>"; $h->endpage(); exit; } if($s['mine_level'] < 40) { echo "<center>You need to be mining level 40 to mine here you are mining level ".number_format($s['mine_level'])."</center>"; $h->endpage(); exit; } mysql_query("UPDATE `users` SET `power`=`power`-25 WHERE (`userid`=".$_SESSION['userid'].")",$c); $rand_gems = rand(1,40); $rand_exp = rand(1,600); echo "<center>You begin mining in the level 40 mine and found ".abs((int) $rand_gems)." crystal(s).</center> "; mysql_query("UPDATE `users` SET `crystals`=`crystals`+".abs((int) $rand_gems).",`mine_exp`+".abs((int) $rand_exp)." WHERE (`userid`=".$_SESSION['userid'].")",$c); echo "<center>[[url='mine.php?action=mine3']Mine again[/url]]</center> "; echo "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_4() { global $s,$h,$c; if($s['power'] < 10) { echo "You need 10 power to mine here your have ".number_format($s['power']).""; $h->endpage(); exit; } if($s['mine_level'] < 10) { echo "<center>You need to be mining level 10 to mine here you are mining level ".number_format($s['mine_level'])."</center>"; $h->endpage(); exit; } mysql_query("UPDATE `users` SET `power`=`power`-10 WHERE (`userid`=".$_SESSION['userid'].")",$c); $rand_money = rand(1,1000); $rand_exp = rand(1,100); echo "<center>You begin mining in the level 10 mine and found $".number_format($rand_money)." .</center> "; mysql_query("UPDATE `users` SET `money`=`money`+".abs((int) $rand_money).",`mine_exp`=`mine_exp`+".abs((int) $rand_exp)." WHERE (`userid`=".$_SESSION['userid'].")",$c); echo "<center>[[url='mine.php?action=mine4']Mine again[/url]]</center> "; echo "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_5() { global $s,$h,$c; if($s['power'] < 15) { echo "<center>You need 15 power to mine here your have {$s['power']}</center>"; $h->endpage(); exit; } if($s['mine_level'] < 30) { echo "<center>You need to be mining level 30 to mine here you are mining level ".number_format($s['mine_level'])."</center>"; $h->endpage(); exit; } mysql_query("UPDATE `users` SET `power`=`power`-15 WHERE (`userid`=".$_SESSION['userid'].")",$c); $rand_money = rand(1,3000); $rand_exp = rand(1,300); echo "<center>You begin mining in the level 30 mine and found $".number_format($rand_money)." .</center> "; mysql_query("UPDATE `users` SET `money`=`money`+".abs((int) $rand_money).",`mine_exp`+".abs((int) $rand_exp)." WHERE (`userid`=".$_SESSION['userid'].")",$c); echo "<center>[[url='mine.php?action=mine5']Mine again[/url]]</center> "; echo "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_6() { global $s,$h,$c; if($s['power'] < 25) { echo "<center>You need 25 power to mine here your have ".number_format($s['power'])."</center>"; $h->endpage(); exit; } if($s['mine_level'] < 40) { echo "<center>You need to be mining level 40 to mine here you are mining level ".number_format($s['mine_level'])."</center>"; $h->endpage(); exit; } mysql_query("UPDATE `users` SET `power`=`power`-25 WHERE (`userid`=".$_SESSION['userid'].")",$c); $rand_money = rand(1,8000); $rand_exp = rand(1,600); echo "<center>You begin mining in the level 40 mine and found $".number_format($rand_money)." .</center> "; mysql_query("UPDATE `users` SET `money`=`money`+".abs((int) $rand_money).",`mine_exp`+".abs((int) $rand_exp)." WHERE (`userid`=".$_SESSION['userid'].")",$c); echo "<center>[[url='mine.php?action=mine6']Mine again[/url]]</center> "; echo "<center>[[url='mine.php']Back[/url]]</center> "; } ?>   Next open up global_func.php Find ?> Above that add   function mine_check() { $thug = mysql_query("SELECT `mine_level`,`mine_exp`,`mine_needed` FROM `users` WHERE (`userid`=".$_SESSION['userid'].")"); $s = mysql_fetch_array($thug); $s['mine_needed']=(int) (($s['mine_level']+1)*($s['mine_level']+1)*($s['mine_level']+1)*2.2); if($s['mine_exp'] >= $s['mine_needed']) { $expu=$s['mine_exp']-$s['mine_needed']; $s['mine_level']+=1; $s['mine_exp']=$expu; $s['power']=+2; $s['max_power']=+2; $s['mine_needed']=(int) (($s['mine_level']+1)*($s['mine_level']+1)*($s['mine_level']+1)*2.2); mysql_query("UPDATE `users` SET `mine_level`=`mine_level`+1,`mine_exp`=$expu WHERE (`userid`=".$_SESSION['userid'].")"); } }   Open up cron_fivemins in your queries add   $thug = "UPDATE `users` SET `power`=`power`+(max_power/(12.5)) WHERE `power`<`max_power`"; mysql_query($thug);   SQLS   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';   Run this Query Once in phpmyadmin UPDATE `users` SET `power`=`max_power`   You should be good to go, any errors fix here. ALL Credits go to whomever originally designed this mod. Thanks.
  15. lol ^
  16. lol lame. :P thanx
  17. Can't login just refreshes the page when I click login :P
  18. Type Link wrong? ^_-
  19. Yucky scrunchy code! hehe ;)
  20. You "could" but now all the users that want to use it would have to do that also, so would need the header tutorial ^ hehe ^_-
  21. Forgot to mention +1
  22. Perhaps show an example of your work :P
  23. I know <font> is depricated but 80% of the users on the forums still use it, gotta cater to them ^_^   And for 2 queries adding the mysql bit is fine, but if i'm making a script that is 800+ lines i'm not going to do that for each one when i can just use $db :P
  24. Nope :)
  25. You just did what I just did lol.....................   I dont htmlentities the name as most use the typical <font color> and the htmlentities will strip that.   Also prefer $db as it has it's own error handler :P
×
×
  • Create New...