Jump to content
MakeWebGames

MagicZ94

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by MagicZ94

  1. Can you use all crons? because some hosters won't let you use 1 minutes 5 minutes or the hour one together.
  2. Thank-you HospitalName Level Time Reason MagicZ [1] 5 20 minutes Lost to Chrono Thank-you so much ;D
  3. Done:)
  4. <?php $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['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; if($ir['equip_armor'] > 0) { $yourarmorstuff = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_armor'].")"); $dat = $db->fetch_row($yourarmorstuff); $defense = $dat['armor']; } else { $defense = 0; } $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_armor`,`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); $primarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$attack_person['equip_primary'].""); $ouch = $db->fetch_row($primarydamage); $prim = ($attack_person['strength']+$ouch['weapon'])-($ir['guard']+$defense); // PRIMARY "weapon" Damage. $secondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$attack_person['equip_secondary'].""); $ouchy = $db->fetch_row($secondarydamage); $second = ($attack_person['strength']+$ouchy['weapon'])-($ir['guard']+$defense); // Secondary "weapon" Damage. if($attack_person['equip_primary'] > 0) { $killer = $prim; } elseif($attack_person['equip_primary'] = 0 && $attack_person['equip_secondary'] > 0) { $killer = $second; } else { $killer = $attack_person['strength'] - $ir['guard']; } if($attack_person['equip_armor'] > 0) { $ayourarmorstuff = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_armor'].")"); $adat = $db->fetch_row($ayourarmorstuff); $adefense = $dat['armor']; } else { $defense = 0; } $aprimarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_primary'].""); $winn = $db->fetch_row($aprimarydamage); $aprim = ($ir['strength']+$winn['weapon'])-($attack_person['guard']+$defense); // PRIMARY "weapon" Damage. $asecondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_secondary'].""); $win = $db->fetch_row($asecondary); $secondd = ($ir['strength']+$win['weapon'])-($attack_person['guard']+$defense); // Secondary "weapon" Damage. if($ir['equip_primary'] > 0) { $killers = $aprim; } elseif($ir['equip_primary'] = 0 && $ir['equip_secondary'] > 0) { $killers = $secondd; } else { $killers = $ir['strength'] - $ir['guard']; } 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 = ($ir['level'] > 5 && $attack_person['level'] < 6) ? "You can't attack someone that is level 5 or below because you are higher than level 5." : $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; $error = ($attack_person['user_level'] == 2) ? "Admins Cannot be attacked." : $error; if (isset($error)){ echo "".htmlentities(stripslashes($error)).""; $h->endpage(); exit; } $yourhp = $ir['hp']; $theirhp = $attack_person['hp']; echo "<center>Fight House</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 Fists. </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 Fists. </center> "; } if($theirhp <= 0){ // ATTACKER WINS AND UPDATES $winner = $ir['userid']; $theirhp = 0; $moneywon = floor($attack_person['money'] /10); $expwon = 150 - (25 * ($ir['level'] - $attack_person['level'])); $expwon = ($expwon < 0) ? 0 : $expwon; $newexp = $expwon + $ir['exp']; $newmoney = $ir['money'] + $moneywon; $result = mysql_query("UPDATE `users` SET `exp` = ".$newexp.", money = ".$newmoney." WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); $newmoney = $attack_person['money'] - $moneywon; $result = mysql_query("UPDATE `users` SET `money` = ".$newmoney.", `hospital` = 10 WHERE (`userid`=".$attack_person['userid'].")", $c) or die(mysql_error()); event_add($attack_person['userid'], "You were hospitalized by ".$ir['username']." for 10 minutes."); echo "<font color=white><center>You hospitalized " . $attack_person['username'] . ". You gain $expwon exp and stole $".$moneywon." from " . $attack_person['username'] . ".</center>"; } 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' WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); event_add($ir['userid'], "You were hospitalized by ".$attack_person['username']." for 20 minutes."); echo "<center><font color=white>".$attack_person['username']." Hospitalized you and stole $".$moneywon." from you.</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>"; ?>
  5. If anyone could add me on msn [email protected] and help me with the adding the bit into attack.php, i'd be really grateful, i don't want you to tell me what to do, just to help me, i need to learn:P
  6. Thank-You :)
  7. I just looked in all the attack files, seeing as i only use attack.php and none of the others now, so i thought they might have something in them, and since i changed to this attack that might be why. $db->query("UPDATE users SET hp=1,hospital=$hosptime,hospreason='Hospitalized by <a href=\'viewuser.php?u={$userid}\'>{$ir['username']}</a>' WHERE userid={$r['userid']}"); i found that in attackbeat.php, would this just fit in attack.php somewhere?
  8. The only thing i have that puts you in hospital at the moment, is attack, will it be an easy simple bit of coding? or will it be something, big? :P
  9. OH, Alright, which files will it be? hospital.php and attack.php?
  10. i added it exactly as you posted it, yeah.
  11. I created the table, then attacked someone, it's still doing th same thing HospitalName Level Time Reason Dave [8] 10 10 minutes :/
  12. I feel stupid now, it's not there, i must have deleted it or something. If i create it now, what will i have to do for it to work?
  13. Alright:) And thanks for trying mate:) I'm not a particularly good coder, and i spent ages tryign tof igure out what was wrong with it, but it all looks normal:P
  14. Yeah, sure:) <?php include "globals.php"; print "<h3>Hospital</h3> <table width='75%' class=\"table\" border=\"0\" cellspacing=\"1\"><tr bgcolor=gray><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th></tr>"; $q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN gangs c ON u.gang=c.gangID WHERE u.hospital > 0 ORDER BY u.hospital DESC",$c); while($r=$db->fetch_row($q)) { print "\n<tr><td>{$r['gangPREFIX']} {$r['username']} [{$r['userid']}]</td><td> {$r['level']}</td><td>{$r['hospital']} minutes</td><td>{$r['hospreason']}</td></tr>"; } print "</table>"; $h->endpage(); ?>
  15. The attack, and the Hospital both run perfectly, except it doesn't show the reason for the user to be in the hospital, has anybody ever experianced this before, and could they possibly tell emw hat they did? :) Thanks.
×
×
  • Create New...