Jump to content
MakeWebGames

Agon

Members
  • Posts

    120
  • Joined

  • Last visited

About Agon

  • Birthday 07/25/1977

Personal Information

  • Location
    Planet Earth
  • Occupation
    Adventurer
  • Website
    http://facebook.com/xagonfly

Agon's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Er nevermind. Got it figured out. LOL.
  2. Thanks for the tip Danny. Ok, I got a math question here. If were trying to get two random numbers between 1 and 99 to match, is that a 1 in 9801 chance?
  3. Here's my version. Thanks to Dominion and Equinox and Danny. [mysql]ALTER TABLE `users` ADD `dailyitem` tinyINT( 11 ) NOT NULL DEFAULT '0';[/mysql]   if($ir['dailyitem'] != 1 ) { $fia = (int) mt_rand(1,99); $fib = (int) mt_rand(1,99); if($fia == $fib) { $r = $db->fetch_row($db->query("SELECT `itmid`, `itmname` FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1")); $item = $r['itmid']; $db->query("INSERT INTO `inventory` VALUES ('', ".$item.", ".$_SESSION['userid'].", 1)"); $db->query("UPDATE `users` SET `dailyitem` = '1' WHERE (`userid` = ".$_SESSION['userid'].")"); event_add($_SESSION['userid'],"While Playing The Game You Found A ".mysql_real_escape_string($r['itmname'])." Congratulations.",$c); } }   Daily Cron $db->query("UPDATE `users` SET `dailyitem` = 0 WHERE (`dailyitem` > 0)");
  4. I know I'm noobish in asking this. Trying to figure out how to add a daily cron to this so you can only find one random item a day.
  5. Wanting to exclude IP's from displaying. For example, don't want ip addy 127.0.0.1 is displaying in the search results.
  6. I'm fed up with scammers lurking around our community and ripping folks off. I have seen an awful lot of shady business deals based around this website.
  7. I think you could just copy the ad system out of the free newspaper mod that is floating around.
  8. Not trying to flame, just wanting to point out something of common sense. Ok. Here's the scenario, someones trying to hack your game. Why put them in fed jail? Fed jail just gives the attacker opportunity to think up other ways to hack you. BAN THEM FROM YOUR SERVER.
  9. Kinda a challenge. Too much for me to handle. But I'd like to challenge those of you with advanced ability to get this mod working great. Things to consider: 1. Compatible with battle bots.(should be pretty easy, I'm working on this one)(Times owned not counting) 2. Compatible with the free ammunition mod. (this one is kinda difficult with a one click attack) 3. Attack outcomes (I think I got this one figured out) 4. An explanation of how to adjust or take into consideration all stats in a fight. I see strength, guard, and agility. But maybe also consider IQ, will, and brave. 5. Battle Stats I know this is all time consuming. Doing my best to pitch in and participate. This is already a great mod, but could become a very very great mod. And I am also happy it is available to the public and free. Also, I'd like to share my version with different attack outcomes. It's compatible with the free attack outcomes mod out there. attack.php   <?php /*Designed by Tyr*/ $menuhide=1; $atkpage=1; require_once("globals.php"); $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs((int) $_GET['ID']) : false; if(!$_GET['ID']){ echo "You did not select a valid ID"; $h->endpage(); exit; } $energy = $ir['maxenergy']/4; $error = ($ir['level'] < 2 ) ? "You can't attack someone untill you are at least level 2!" : $error; $error = ($ir['hp'] <= 0) ? "You can't attack someone when you have no health!" : $error; $error = ($ir['energy']<$energy) ? "You need to have at least 25% of your energy if you want to attack someone." : $error; $error = ($ir['jail'] > 0) ? "You can't attack someone if you are in jail." : $error; $error = ($ir['hospital'] > 0) ? "You can't attack someone if you are in the hospital." : $error; $error = ($_GET['ID'] == "") ? "You didn't choose someone to attack." : $error; $error = ($_GET['ID'] == $ir['userid']) ? "You can't attack yourself." : $error; $armor1 = $ir['equip_boots']; $armor2 = $ir['equip_helmet']; $armor3 = $ir['equip_breastplate']; $armor4 = $ir['equip_leggings']; $armor5 = $ir['equip_gloves']; if($armor1 > 0) { $yourarmorstuff = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_boots'].")"); $dat = $db->fetch_row($yourarmorstuff); $boots = ($dat['boots'] < 1) ? 1 : $dat['boots']; } if($armor2 > 0) { $armo2 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_helmet'].")"); $dt = $db->fetch_row($armo2); $helmet = ($dt['helmet'] < 1) ? 1 : $dt['helmet']; } if($armor3 > 0) { $armo3 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_breastplate'].")"); $dat3 = $db->fetch_row($armo3); $breastplate = ($dat3['breastplate'] < 1) ? 1 : $dat3['breastplate']; } if($armor4 > 0) { $armo4 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_leggings'].")"); $dat4 = $db->fetch_row($armo4); $leggings = ($dat4['leggings'] < 1) ? 1 : $dat4['leggings']; } if($armor5 > 0) { $armo5 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_gloves'].")"); $dat5 = $db->fetch_row($armo5); $gloves = ($dat5['gloves'] >= 1) ? $dat5['gloves'] : 0 ; } $defense = $boots+helmet+$breastplate+$leggings+$gloves+0; // $IR*users* Defense Statistics. $attacking_person = mysql_query("SELECT `u`.`userid`,`u`.`username`,`u`.`hp`,`u`.`maxhp`,`u`.`level`, " . "`u`.`money`,`u`.`location`,`u`.`hospital`,`u`.`jail`,`u`.`fedjail`,`u`.`gang`,`u`.`user_level`, " . "`u`.`equip_primary`,`u`.`equip_secondary`,`u`.`equip_boots`,`u`.`equip_helmet`,`u`.`equip_gloves`, " . "`u`.`equip_breastplate`,`u`.`equip_leggings`,`u`.`exp`,`us`.`strength`,`us`.`agility`,`us`.`guard` " . "FROM `users` `u` " . "LEFT JOIN `userstats` `us` " . "ON `u`.`userid`=`us`.`userid` " . "WHERE (`u`.`userid`=".$_GET['ID'].")", $c) OR die(mysql_error()); $attack_person = mysql_fetch_array($attacking_person); $armo1 = $attack_person['equip_boots']; $armo2 = $attack_person['equip_helmet']; $armo3 = $attack_person['equip_breastplate']; $armo4 = $attack_person['equip_leggings']; $armo5 = $attack_person['equip_gloves']; if($armo1 > 0) { $ayourarmorstuff = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_boots'].")"); $adat = $db->fetch_row($ayourarmorstuff); $aboots = ($adat['boots'] < 1) ? 1 : $adat['boots']; } if($armo2 > 0) { $armor2 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_helmet'].")"); $adt = $db->fetch_row($armor2); $ahelmet = ($adt['helmet'] < 1) ? 1 : $adt['helmet']; } if($armo3 > 0) { $armor3 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_breastplate'].")"); $adat3 = $db->fetch_row($armor3); $abreastplate = ($adat3['breastplate'] < 1) ? 1 : $adat3['breastplate']; } if($armo4 > 0) { $armor4 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_leggings'].")"); $adat4 = $db->fetch_row($armor4); $aleggings = ($adat4['leggings'] < 1) ? 1 : $adat4['leggings']; } if($armo5 > 0) { $armor5 = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_gloves'].")"); $adat5 = $db->fetch_row($armor5); $agloves = ($adat5['gloves'] >= 1) ? $adat5['gloves'] : 0 ; } $adefense = $boots+helmet+$breastplate+$leggings+$gloves+0; $primarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$attack_person['equip_primary'].""); $ouch = $db->fetch_row($primarydamage); $secondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$attack_person['equip_secondary'].""); $ouchy = $db->fetch_row($secondarydamage); if($attack_person['equip_primary'] > 0 && $attack_person['equip_secondary'] > 0) { $killer = ($ouch['weapon']+$ouchy['weapon']+$attack_person['strength'])-($ir['guard']+$defense); $wepname = "".$ouch['itmname']." and their ".$ouchy['itmname'].""; } elseif($attack_person['equip_primary'] > 0 && $attack_person['equip_secondary'] = 0) { $killer = ($ouch['weapon']+$attack_person['strength'])-($ir['guard']+$defense); $wepname = "".$ouch['itmname'].""; } elseif($attack_person['equip_primary'] = 0 && $attack_person['equip_secondary'] > 0) { $killer = ($ouchy['weapon']+$attack_person['strength']) - ($ir['guard']+$defense); $wepname = "".$ouch['itmname'].""; } else { $killer = $attack_person['strength']-($ir['guard']+$defense); $wepname = Fists; } $aprimarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_primary'].""); $winn = $db->fetch_row($aprimarydamage); $asecondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_secondary'].""); $win = $db->fetch_row($asecondary); if($ir['equip_primary'] > 0 AND $ir['equip_primary'] > 0) { $killers = ($winn['weapon']+$win['weapon']+$ir['strength'])-($attack_person['guard']+$adefense); $aweap = "".$winn['itmname']." and their ".$win['itmname'].""; } elseif($ir['equip_primary'] > 0 && $ir['equip_secondary'] == 0) { $killers = ($winn['weapon']+$ir['strength'])-($attack_person['guard']+$adefense); $aweap = "".$winn['itmname'].""; } elseif($ir['equip_primary'] == 0 && $ir['equip_secondary'] > 0) { $killers = ($win['weapon']+$ir['strength']) - ($attack_person['guard']+$adefense); $aweap = "".$win['itmname'].""; } else { $killers = $ir['strength'] - ($attack_person['guard']+$defense); $aweap = Fists; } if(!mysql_num_rows($attacking_person)) { echo "Invalid User Selected to attack."; $h->endpage(); exit; } $error = ($attack_person['location'] != $ir['location']) ? "You must be in the same city as the person you are attacking. Duh." : $error; $error = ($attack_person['username'] == "") ? "That person doesn't exist." : $error; $error = ($attack_person['hospital'] > 0) ? "You can't attack someone that is in the hospital." : $error; $error = ($attack_person['jail'] > 0) ? "You can't attack someone that is in jail." : $error; $error = ($attack_person['level'] < 2 ) ? "Sorry, I know it's fun, but you can't beat up the newbs." : $error; $error = ($ir['level'] > 10 && $attack_person['level'] < 4) ? "You can't attack someone that is level 3 or below because you are higher than level 10." : $error; $error = ($ir['gang'] == $attack_person['gang'] AND $ir['gang'] != 0) ? "You cant attack someone in the same clan as yourself!" : $error; $error = ($attack_person['hp'] <= 0) ? "This person has no health at the moment." : $error; $error = ($attack_person['fedjail'] > 1) ? "This person is in fed and cannot be attacked." : $error; if (isset($error)){ echo "".htmlentities(stripslashes($error)).""; $h->endpage(); exit; } $yourhp = $ir['hp']; // $IR Health $theirhp = $attack_person['hp']; // Defenders Health $attack_person echo "<center>Thunderdome</center> <center><font color=white>You are in a fight with ".$attack_person['username'].".</center> "; $wait = ($ir['agility'] > $attack_person['agility']) ? 1 : 0; while($yourhp > 0 && $theirhp > 0) { $damage = $killer; $damage = ($damage < 1) ? 1 : $damage; if($wait == 0) { $yourhp = $yourhp - $damage; echo "<font color=white><center> " . $attack_person['username'] . " hit you for " . $damage . " damage using their " . $wepname . ". </center>"; // WEAPON STUFF HERE LATER. } else { $wait = 0; } if($yourhp > 0) { $damage = $killers; $damage = ($damage < 1) ? 1 : $damage; $theirhp = $theirhp - $damage; echo "<font color=white><center> You hit " . $attack_person['username'] . " for " . $damage . " damage using your ". $aweap . ". </center> "; } if($theirhp <= 0){ // ATTACKER WINS AND UPDATES $winner = $ir['userid']; $theirhp = 0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); print " [b]What do you want to do with {$odata['username']} now?[/b] <form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' /></form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Torture Them' /></form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hurt Them' /></form> "; } if($yourhp <= 0) { // DEFENDER WINS AND UPDATES $winner = $attack_person['userid']; $yourhp = 0; $moneywon = floor($ir['money'] /10); $expwon = 100 - (25 * ($attack_person['level'] - $ir['level'])); $expwon = ($expwon < 0) ? 0 : $expwon; $newexp = $expwon + $attack_person['exp']; $newmoney = $attack_person['money'] + $moneywon; $result = mysql_query("UPDATE `users` SET `exp` = ".$newexp.", `money` = ".$newmoney." WHERE (`userid`=".$attack_person['userid'].")", $c) or die(mysql_error()); $newmoney = $ir['money'] - $moneywon; $result = mysql_query("UPDATE `users` SET `money` = '".$newmoney."',`hospital` = '20',`hospreason` = 'Lost to ".$attack_person['username']."' WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); event_add($ir['userid'], "You were hospitalized by ".$attack_person['username']." for 20 minutes.", $c); echo "<center><font color=white>".$attack_person['username']." Hospitalized you and stole $".$moneywon." from you. [url='/explore.php']Back[/url]</center>"; } } //UPDATE USERS $newenergy = $ir['energy'] - floor($ir['energy'] * .20); $result = mysql_query("UPDATE `users` SET `hp` = ".$theirhp." WHERE (`userid`=".$attack_person['userid'].")", $c) or die(mysql_error()); $result = mysql_query("UPDATE `users` SET `hp` = ".$yourhp.", `energy` = '".$newenergy."' WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); echo "</td></tr>"; ?>
  10. Ok. I found a small bug I'm trying to figure out how to fix. I'm getting a printed output like this when I win a fight: "You are in a fight with BuckShotBot. You hit BuckShotBot for 315 damage using your Axe Handle and their Shotgun." Actually, it's my shotgun. And I'd think even though I won, they should be doing some sort of damage to me. I'm pretty sure the error is in here, but not exactly sure how to fix this, as I am novice level, and this is beyond my grasp: Begins around line 190 for most folks.   <center><font color=white>You are in a fight with ".$attack_person['username'].".</center> "; $wait = ($ir['agility'] > $attack_person['agility']) ? 1 : 0; while($yourhp > 0 && $theirhp > 0) { $damage = $killer; $damage = ($damage < 1) ? 1 : $damage; if($wait == 0) { $yourhp = $yourhp - $damage; echo "<font color=white><center> " . $attack_person['username'] . " hit you for " . $damage . " damage using their " . $wepname . ". </center>"; // WEAPON STUFF HERE LATER. } else { $wait = 0; } if($yourhp > 0) { $damage = $killers; $damage = ($damage < 1) ? 1 : $damage; $theirhp = $theirhp - $damage; echo "<font color=white><center> You hit " . $attack_person['username'] . " for " . $damage . " damage using your ". $aweap . ". </center> "; } if($theirhp <= 0){ // ATTACKER WINS AND UPDATES $winner = $ir['userid']; $theirhp = 0; $_SESSION['attackwon']=$_GET['ID'];   Been trying to figure it out on my own for quite a while now. Time to ask for help over here. Thanks!
  11. Sweet. Works great on V2. Thanks to Faz and Dayo.
  12. testing on V2 monorail.php $selectTravelTime = "SELECT `traveltime` FROM `users` WHERE `userid` = $userid"; $do_selectTravelTime=$db->query($selectTravelTime); $traveltime=$db->fetch_row($do_selectTravelTime); if($ir['traveltime'] > 0) { echo 'Sorry, you have to wait $traveltime minutes before you can travel again!'; $h->endpage(); exit; }   $updateTravelTime = "UPDATE `users` SET `traveltime` = `traveltime`+ 10 WHERE `userid` = $userid"; $db->query($updateTravelTime);   cron_minute.php $db->query("UPDATE users SET traveltime=traveltime-1 WHERE traveltime>0");   Got it working on V2 with this, except one thing. It prints "Sorry, you have to wait $traveltime minutes before you can travel again!" instead of displaying the minutes. Not sure why.
  13. I'll try it out today.
  14. I got this idea from another old game I worked on. Users could travel, but they had to wait for the train, plane, bus to arrive. So the idea is. If you travel using the monorail.php, you have a travel timer that makes you wait X amount of minutes before you can travel again. For example, you travel to another city and it makes it so you have to wait ten minutes before you can travel again. Why? Here's the fun part... Two players have a rivalry and attack each other all the time. This encourages a game of cat and mouse, where the weaker player is hopping from city to city to avoid attack, and the attacking player has to try to time it just right to get into that location at the same time. The idea popped into my mind, so I figured I'd post it over here to keep reference on it. Thanks!
  15. I have another idea on this one. Maybe also set it up so a player can't be attacked more than X amount of times a day. I'm real busy with other mods right now, but if I can find the time, this would be a pretty easy adjustment.
×
×
  • Create New...