Jump to content
MakeWebGames

Savager

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Savager's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Re: [mccode v2] User Search well time to shorten this mod up a few million lines and do it in AJAX.
  2. Re: [mccodes] Battle Mechs [$15] wow outstanding idea! nice little addon for sure.
  3. Re: [mccode v2] Battle Arena [$35.00] willing to sell 1 copy for $5 to save my testing site from going. please help or i will pretty much lose everything i had on there. Which would suck.
  4. Re: [mccode v2] Battle Arena [$35.00] just so you guys know i did reduce the price to $25.00 usd... So come get a copy
  5. Re: [v2] Will pay for a fix... lol that would of been an easy fix.
  6. Re: Help Re Doing Search an area Modd your coder is horrible at coding. i hope you didnt pay him.
  7. Re: [mccode] Very small mod to restrict reg name size if(strlen($_POST['newname']) < 4 OR strlen($_POST['newname'])>12) { die("Sorry, the username is too short or too long >Back"); }
  8. Re: Farming [v2] thats because the one who created it missed it so i didnt add it.
  9. Re: Farming [v2] that would take another 30 minutes... yeah right. they could learn how to do it in phpmyadmin
  10. Re: Farming [v2] And for the sqls   CREATE TABLE IF NOT EXISTS `farmdb` ( `id` int(7) NOT NULL auto_increment, `owner` int(6) NOT NULL default '0', `barnlevel` int(2) NOT NULL default '1', `plots` int(3) NOT NULL default '5', `plotage` int(3) NOT NULL default '0', `assists` int(3) NOT NULL default '5', `water` int(5) NOT NULL default '0', `food` int(5) NOT NULL default '0', `waterpump` int(4) NOT NULL default '0', `foodmach` int(4) NOT NULL default '0', PRIMARY KEY (`id`), KEY `owner` (`owner`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; INSERT INTO `farmdb` (`id`, `owner`, `barnlevel`, `plots`, `plotage`, `assists`, `water`, `food`, `waterpump`, `foodmach`) VALUES (1, 1, 1, 5, 0, 5, 0, 0, 0, 0); CREATE TABLE IF NOT EXISTS `farm_animdb` ( `id` int(9) NOT NULL auto_increment, `owner` int(6) NOT NULL default '0', `animalname` varchar(20) NOT NULL default '', `matureage` int(3) NOT NULL default '0', `age` int(3) NOT NULL default '0', `cost` int(7) NOT NULL default '0', `prod_name` varchar(20) NOT NULL default '', `prod_amount` int(2) NOT NULL default '0', `assist_need` int(3) NOT NULL default '0', `food_need` int(3) NOT NULL default '0', `water_need` int(3) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `farm_anim_listdb` ( `id` int(9) NOT NULL auto_increment, `animalname` varchar(20) NOT NULL default '', `matureage` int(3) NOT NULL default '0', `cost` int(7) NOT NULL default '0', `prod_name` varchar(20) NOT NULL default '', `prod_amount` int(2) NOT NULL default '0', `assist_need` int(3) NOT NULL default '0', `food_need` int(3) NOT NULL default '0', `water_need` int(3) NOT NULL default '0', `instock` int(5) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; INSERT INTO `farm_anim_listdb` (`id`, `animalname`, `matureage`, `cost`, `prod_name`, `prod_amount`, `assist_need`, `food_need`, `water_need`, `instock`) VALUES (1, 'Cow', 15, 10000, 'Milk', 5, 1, 1, 1, 49), (2, 'Astelite', 10, 30000, 'Black Ice', 10, 3, 1, 0, 91), (3, 'Giant Morebor', 40, 100000, 'Skin Plate', 10, 5, 10, 3, 90); CREATE TABLE IF NOT EXISTS `farm_cropdb` ( `id` int(6) NOT NULL auto_increment, `owner` int(6) NOT NULL default '0', `cropname` varchar(20) NOT NULL default '0', `age` int(3) NOT NULL default '0', `sellvalue` int(10) NOT NULL default '0', `nectadded` int(3) NOT NULL default '0', `plot` int(10) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; INSERT INTO `farm_cropdb` (`id`, `owner`, `cropname`, `age`, `sellvalue`, `nectadded`, `plot`) VALUES (1, 1, 'Carrot', 0, 1000, 0, 0), (2, 1, 'Pea', 0, 1250, 0, 0), (3, 1, 'Cabbage', 0, 1400, 0, 0); CREATE TABLE IF NOT EXISTS `farm_crop_listdb` ( `id` int(6) NOT NULL auto_increment, `cropname` varchar(20) NOT NULL default '0', `ripeage` int(3) NOT NULL default '0', `spoilage` int(3) NOT NULL default '0', `sellvalue` int(10) NOT NULL default '0', `buyvalue` int(10) NOT NULL default '0', `instock` int(10) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; INSERT INTO `farm_crop_listdb` (`id`, `cropname`, `ripeage`, `spoilage`, `sellvalue`, `buyvalue`, `instock`) VALUES (1, 'Carrot', 5, 7, 1000, 500, -7097), (2, 'Pea', 6, 7, 1250, 600, 7663), (3, 'Cabbage', 6, 8, 1400, 650, 6483), (4, 'Potato', 5, 6, 1500, 1000, 9080), (5, 'Tomato', 9, 11, 2500, 1250, 9794), (6, 'Cucumber', 10, 11, 2750, 1300, 8767), (7, 'Blackfire Sprout', 15, 18, 4000, 1500, 6216), (8, 'Dragonglade Grass', 20, 21, 5000, 2300, 6725);
  11. Took about 2 hours out of my day to make this farm mod that m5kk or whatever his name is came up with work. there was so many things wrong with it, but fixed them all. the queries didnt work, Inserts were wrong, functions were wrong, and much much more i had to recode it from scratch. decided to do this because i might actually edit it to fit my game. So here it is the fixed mod of farming   <?php include "globals.php"; echo "<font size='4'>Farm</font><hr/> "; switch($_GET['action']) { case barnfi: barnfi(); break; case barnbou: barnbou();break; case upgrade: upgrade();break; case produce: produce();break; case animals: animals();break; case farm: farm();break; case viewcrop: viewcrop();break; case sellall: sellall();break; case sellcrop: sellcrop();break; case land: land();break; default: index();break; } //////INDEX////// function index() { global $ir,$db,$userid,$h; $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); echo "Welcome to the the city outskirts. Farming ain't just for old losers. Out here we live off the land,"; echo "and make our own living rather than battling. What would you like to do? "; if($farminfo['barnlevel']==0){echo "[url='farm.php?action=barnfi']Buy a barn[/url] ";} if($farminfo['barnlevel']<10){echo "[url='farm.php?action=upgrade']Upgrade barn[/url] ";} if($farminfo['plots']<50){echo "[url='farm.php?action=land']Purchase Additional Land[/url] ";} echo "[url='farm.php?action=animals']Buy livestock[/url] "; echo "[url='farm.php?action=produce']Seed Store[/url] "; echo "[url='farm.php?action=hire']Hire equipment[/url] "; echo "[url='farm.php?action=farm']Visit Farm[/url] "; } //////BARN FIND////// function barnfi() { echo "Registration for farmland and the cost of the initial barn will be 1000 gold. Would you like to buy it? "; echo "[url='farm.php?action=barnbou']Yes[/url]"; } //////BARN BOUGHT////// function barnbou() { global $ir,$db,$userid,$h; $cnt=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); if($ir['money']<1000){die("You cant afford it");} if($db->num_rows($cnt)==1){die("You already have a barn");} echo "Here is your license and the keys to your [b][url='farm.php?action=farm']farm[/url][/b]"; $db->query("UPDATE users SET money=money-1000 WHERE userid=$userid"); $db->query("INSERT INTO farmdb(id,owner) VALUES('', '$userid')"); } //////UPGRADE////// function upgrade() { global $ir,$db,$userid,$h; $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); if($farminfo['barnlevel']==1){$cost=10000;$next=2;} if($farminfo['barnlevel']==2){$cost=50000;$next=3;} if($farminfo['barnlevel']==3){$cost=150000;$next=4;} if($farminfo['barnlevel']==4){$cost=500000;$next=5;} if($farminfo['barnlevel']==5){$cost=1000000;$next=6;} if($farminfo['barnlevel']==6){$cost=2000000;$next=7;} if($farminfo['barnlevel']==7){$cost=5000000;$next=8;} if($farminfo['barnlevel']==8){$cost=10000000;$next=9;} if($farminfo['barnlevel']==9){$cost=50000000;$next=10;} if($farminfo['barnlevel']==10){$next=0;} if($next==0){die("You are already upgraded to the best barn");} echo "Upgrading your barn is easy. As your barn gets bigger, it can process and handle more land."; echo "The next updgrade to your barn will cost {$cost}. It will be to level {$next}. Agree? "; echo "[url='farm.php?action=upgrade&action2=yes'][Yes][/url] "; if($_GET['action2']==yes AND $ir['money']<$cost){die("<font color='red'>You cant afford to upgrade</font>");} if($_GET['action2']==yes) { echo "<font color='green'>Barn successfully upgraded.</font>"; $db->query("UPDATE farmdb SET barnlevel='{$next}' WHERE owner=$userid"); $db->query("UPDATE users SET money=money-$cost WHERE userid=$userid"); } } //////PRODUCE////// function produce() { global $ir,$db,$userid,$h; $arraypick=$db->query("SELECT * FROM farm_crop_listdb"); $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); if($farminfo['barnlevel']>0) { echo "[b]Billy-bob:[/b] Welcome to the seed store. Here you can find the seeds which other farmers delivered to me in exchange for some quick money. You plant these seeds on your land and let um grow until you can harvest and sell. But if you leave them too long, they'll dry up and die. "; echo "[b]Billy-bob:[/b] So what would you like? "; echo "<table><tr class='h'> <th>Crop Picture</th> <th>Crop Name</th> <th>Crop Price</th> <th>Max Sell value</th> <th>Amount Left</th> <th>Buy amount</th> </tr>"; } while($display=$db->fetch_row($arraypick)) { echo "<tr bgcolor='gray'> <td>[img=image/farm/{$display[]</td> <td>{$display['cropname']}</td> <td>{$display['buyvalue']}</td> <td>{$display['sellvalue']}</td> <td>{$display['instock']}</td> <td>[url='farm.php?action=produce&step=buycrop&id={$display[']Buy One[/url] [url='farm.php?action=produce&step=buycrop&id={$display[']Buy Ten[/url] [url='farm.php?action=produce&step=buycrop&id={$display[']Buy Fifty[/url]</td> </tr>"; } echo "</table>"; if ($_GET['step']==buycrop AND $_GET['amount']>0) { $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); $cropload=$db->query("SELECT * FROM farm_crop_listdb WHERE id='{$_GET['id']}'"); $crop=$db->fetch_row($cropload); $cropcheck=$db->query("SELECT * FROM farm_cropdb WHERE owner=$userid"); $cropnum=$db->num_rows($cropcheck)+$_GET['amount']; $animload=$db->query("SELECT * FROM farm_animdb WHERE owner=$userid"); $animnum=abs($db->num_rows($animload)*$_GET['amount']); $total=$animnum+$cropnum; $amount=$_GET['amount']; $newmoney=abs($crop['buyvalue']*$amount); echo " "; if($total>$farminfo['plots']*$amount){die("<font color='red'>You do not have enough space to plot this</font>");} if($ir['money']<$crop['buyvalue']*$_GET['amount']){die("<font color='red'>You cannot afford this</font>");} echo "<font color='green'>[b]{$amount}[/b] Seed(s) bought and planted.</font>"; $db->query("UPDATE users SET money=money-$newmoney WHERE userid=$userid"); for($i=0; $i<$_GET['amount']; $i++) {$db->query("INSERT INTO farm_cropdb(id, owner, cropname, sellvalue) VALUES('', '$userid', '{$crop['cropname']}', '{$crop['sellvalue']}')");} $db->query("UPDATE farm_crop_listdb SET instock=instock-$amount WHERE id='{$crop['id']}'"); } } //////ANIMALS////// function animals() { global $ir,$db,$userid,$h; $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); $arraypick=$db->query("SELECT * FROM farm_anim_listdb"); if($farminfo['barnlevel']>0) { echo "[b]Sarah:[/b] Hi! This is the animals shop. Here you can find the animals that you can use to get you lots of money! You buy these animals, then you feed them and eventually you'll start making money back from their produce. Cool huh? But if you leave them unattended with no assistants, they'll die! "; echo "[b]Sarah:[/b] So what would you like? "; echo "<table><tr class='h'> <th>Animal name</th> <th>Animal Price</th> <th>Needs</th> <th>Produces</th> <th>Amount Left</th> <th>Buy</th> </tr>"; } while($display=$db->fetch_row($arraypick)) { echo "<tr bgcolor='gray'> <td>{$display['animalname']}</td> <td>{$display['cost']}</td> <td>{$display['assist_need']} assistants {$display['food_need']} food {$display['water_need']} water</td> <td>{$display['prod_amount']} {$display['prod_name']}</td> <td>{$display['instock']}</td> <td>[url='farm.php?action=animals&step=buyanimal&id={$display[']Buy[/url]</td> </tr>"; } echo "</table>"; if ($_GET['step']==buyanimal) { $animload=$db->query("SELECT * FROM farm_anim_listdb WHERE id='{$_GET['id']}'"); $anim=$db->fetch_row($animload); $cropcheck=$db->query("SELECT * FROM farm_cropdb WHERE owner=$userid"); $cropnum=$db->num_rows($cropcheck)+1; $animload=$db->query("SELECT * FROM farm_animdb WHERE owner=$userid"); $animnum=$db->num_rows($animload)*10; $total=$animnum+$cropnum; echo " "; if($total>$farminfo['plots']*10){die("<font color='red'>You do not have enough space to contain this animal</font>");} if($ir['money']<$anim['cost']){die("<font color='red'>You cannot afford this</font>");} echo "[b]Sarah:[/b] <font color='green'>I'll send that animal right over!</font>"; $rem_money=$db->query("UPDATE users SET money=money-{$anim['cost']} WHERE userid=$userid"); $add_crop=$db->query("INSERT INTO farm_animdb(id, owner, animalname, cost, matureage, prod_name, prod_amount, assist_need, food_need, water_need) VALUES('', '$userid', '{$anim['animalname']}', '{$anim['cost']}', '{$anim['matureage']}', '{$anim['prod_name']}', '{$anim['prod_amount']}', '{$anim['assist_need']}', '{$anim['food_need']}', '{$anim['water_need']}')"); $red_stock=$db->query("UPDATE farm_anim_listdb SET instock=instock-1 WHERE id='{$anim['id']}'"); } } //////FARM////// function farm() { global $ir,$db,$userid,$h; $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); $animpick=$db->query("SELECT * FROM farm_anim_listdb"); $arraypick=$db->query("SELECT * FROM farm_crop_listdb"); echo "You make your way to your dusty, damp old farm. You gaze over your {$farminfo['plots']} acres of land and head towards your barn. "; echo "<table width='50%'><tr class='h'> <th>Crop Picture</th> <th>Crop Name</th> <th>Amount</th> <th>Options</th> </tr>"; while($display=$db->fetch_row($arraypick)) { $amount=$db->query("SELECT * FROM farm_cropdb WHERE cropname='{$display['cropname']}' AND owner=$userid"); $amount3=$db->num_rows($amount); if($amount3>0) { echo "<tr bgcolor='gray'> <td>[img=image/farm/{$display[]</td> <td>{$display['cropname']}</td> <td>{$amount3}</td> <td>[url='farm.php?action=viewcrop&name={$display[']View[/url]</td> </tr>"; } } echo "</table> "; echo "<table width='50%'><tr class='h'> <th>Animal Name</th> <th>Amount</th> <th>Options</th> </tr>"; while($display=$db->fetch_row($animpick)) { $amount2=$db->query("SELECT * FROM farm_animdb WHERE animalname='{$display['animalname']}' AND owner=$userid"); $amount4=$db->num_rows($amount2); if($amount4>0) { echo "<tr bgcolor='gray'> <td>{$display['animalname']}</td> <td>{$amount4}</td> <td>[url='farm.php?action=viewanimal&name={$display[']View[/url]</td> </tr>"; } } print "</table> "; echo "[b]Equipment:[/b] "; echo "Water pump ({$farminfo['waterpump']}) "; echo "Food machine ({$farminfo['foodmach']}) "; echo "[b]Resources:[/b] "; echo "Food: {$farminfo['food']} "; echo "Water: {$farminfo['water']} "; } //////VIEW CROP////// function viewcrop() { global $ir,$db,$userid,$h; $croppick=$db->query("SELECT * FROM farm_cropdb WHERE cropname='{$_GET['name']}' AND owner=$userid"); $arraypick=$db->query("SELECT * FROM farm_crop_listdb WHERE cropname='{$_GET['name']}'"); $cropcheck=$db->fetch_row($arraypick); $cropcheck2=$db->num_rows($croppick); $cropget=$db->fetch_row($croppick); if(!$cropcheck){die("<font color='red'>This crop does not exist</font>");} if($cropcheck2==0){die("<font color='red'>You do not have any of this crop</font>");} echo "<table width='50%'><tr> <th>Age</th> <th>Options</th> <th>Crop evaluation</th> </tr>"; echo "[b]<u>Viewing crop {$cropget['cropname']}[/b]</u>"; while($cropget=$db->fetch_row($croppick)) { if($cropget['age']==0){$advice="There has been no growth yet.";} if($cropget['age']>0 AND $cropget['age']<3){$advice="This crop is now visible.";} if($cropget['age']>2 AND $cropget['age']<5){$advice="This crop is still growing.";} if($cropget['age']>4 AND $cropget['age']<10){$advice="This crop looks edible.";} if($cropget['age']>9 AND $cropget['age']<20){$advice="This crop looks perfect.";} echo "<tr> <td>{$cropget['age']}</td> <td>[url='farm.php?action=sellcrop&id={$cropget[']Sell[/url]</td> <td>{$advice}</td> </tr>"; } echo "</table>"; echo "<form action='farm.php?action=sellall' method='POST'> <input type='hidden' name='action' value='sellall'> <input type='hidden' name='crop' value='{$_GET['name']}'> [b]Sell all {$_GET['name']} at: <select name='age' size='1'>"; for($i=1; $i<31; $i++){echo "<option value='{$i}'>{$i}</option>";} echo "</select> days old. <input type='submit' value='Confirm'></form>"; } //////SELL ALL////// function sellall() { global $ir,$db,$userid,$h; $crop=$_POST['crop']; $age=$_POST['age']; $arraypick=$db->query("SELECT * FROM farm_crop_listdb WHERE cropname='{$crop}'"); $cropcheck=$db->fetch_row($arraypick); $crops=$db->query("SELECT * FROM farm_cropdb WHERE cropname='{$crop}' AND age='{$age}' AND owner=$userid"); if($db->num_rows($crops)==0){die("<font color='red'>You do not have that crop with that amount of days old</font>");} echo "<font color='green'>All [b]{$crop}s[/b] at [b]{$age}[/b] days old sold</font> "; echo "<u>Summary</u> "; while($display=$db->fetch_row($crops)) { $cropnum=$cropnum+1; if($cropcheck['ripeage']!=$display['age']) { $nonripe=$nonripe+1; $totalmade=abs($totalmade+($cropcheck['buyvalue']/2)); } else { $ripe=$ripe+1; $totalmade=$totalmade+$cropcheck['sellvalue']; } $rem=$db->query("DELETE FROM farm_cropdb WHERE id='{$display['id']}'"); } if(!$ripe){$ripe=0;} if(!$unripe){$unripe=0;} echo "[b]Total crops sold:[/b] {$cropnum} [b]Total ripe:[/b] {$ripe} [b]Total unripe:[/b] {$nonripe} [b]Total money for selling:[/b] {$totalmade}"; $db->query("UPDATE users SET money=money+$totalmade WHERE userid=$userid"); } //////SELL CROP////// function sellcrop() { global $ir,$db,$userid,$h; $id=$_GET['id']; $croppick=$db->query("SELECT * FROM farm_cropdb WHERE id='{$id}' AND owner='{$playerinfo['id']}'"); $cropget=$db->fetch_array($croppick); $arraypick=$db->query("SELECT * FROM farm_crop_listdb WHERE cropname='{$cropget['cropname']}'"); $cropcheck=$db->fetch_array($arraypick); if(!$cropget){die("<font color='red'>This crop does not exist</font>");} echo "<font color='green'>You have sold a [b]{$cropget['cropname']}[/b]</font>"; if($cropcheck['ripeage']!=$cropget['age']) { echo "This crop is not worth anything in that condition. I'm afraid all I can give you is half what you paid."; $db->query("DELETE FROM farm_cropdb WHERE id='{$id}'"); $newmoney=abs($ir['money']+($cropcheck['buyvalue']/2)); $db->query("UPDATE users SET money=$newmoney WHERE userid=$userid"); } else { echo "This crop is perfect!"; $db->query("DELETE FROM farm_cropdb WHERE id='{$id}'"); $newmonry=$ir['money']+$cropcheck['sellvalue']; $db->query("UPDATE users SET money=money+$newmoney WHERE userid=$userid"); } } //////LAND////// function land() { global $ir,$db,$userid,$h; $farm=$db->query("SELECT * FROM farmdb WHERE owner=$userid"); $farminfo=$db->fetch_row($farm); echo "Purchasing more land for your barn will allow you to use more plants at one time. 1 Acre can hold 10 plots. Each plant takes 1 plot. Land costs 5000 gold each. You may only have 5 land max per level of barn under current laws. <form action='farm.php?action=land' method='POST'> [b]Amount to purchase:[/b] <input type='text' name='amount' size='2'> <input type='submit' value='Purchase'> </form>"; if($_POST['amount']>0) { $amount=$_POST['amount']; $check=$amount+$farminfo['plots']; $cost=abs($amount*5000); $barn=abs($farminfo['barnlevel']*5); if($check>50 OR $check>$barn){die("<font color='red'>You cannot have that many plots</font>");} if($cost>$ir['money']){die("<font color='red'>You cannot afford the plots</font>");} echo "<font color='green'>[b]{$amount}[/b] Plot(s) Successfully bought</font>"; $db->query("UPDATE farmdb SET plots=plots+$amount WHERE owner=$userid"); $db->query("UPDATE users SET money=money-$cost WHERE userid=$userid"); } } ?>
  12. Re: A little snipet (Could be security could be more) what if you took the sessions out.. and had it like so $z
  13. Re: A little snipet (Could be security could be more) yeah but you guys are not loading it at the exact same time. your just loading two tabs at different times. try it if you have two computers.
  14. Re: A little snipet (Could be security could be more) if(!$_session['z']) {$_session['z']="";} $_session['z'].="a"; $num=strlen($_session['z']); if($num>1) {$session['z']=""; die("");} else{$session['z']="";} i think that might actually work.
  15. Re: A little snipet (Could be security could be more) you could also use that to stop duping and constant page refreshing..
×
×
  • Create New...