Jump to content
MakeWebGames

A critical error has occurred, and this page cannot be displayed. in attack.php


Recommended Posts

Posted

After choosing primary or secundary weapon following error message comes up.

A critical error has occurred, and this page cannot be displayed. Please try again later.

I havent done any modifications on the script.

Can someone please help?

 

<?php
/**
* MCCodes Version 2.5.6
* Copyright (C) 2011-2012 MCCodes
* All rights reserved.
*
* Redistribution of this code in any form is prohibited, except in
* the specific cases set out in the MCCodes Customer License.
*
* This code license may be used to run one (1) game.
* A game is defined as the set of users and other game database data,
* so you are permitted to create alternative clients for your game.
*
* If you did not obtain this code from MCCodes.com, you are in all likelihood
* using it illegally. Please contact MCCodes to discuss licensing options
* in this case.
*
* File: Mods/attack.php
* Signature: 7d45f8ab1a3153a5f5a5c0012d4b628d
* Date: Tue, 13 Mar 12 10:41:51 +0000
*/

if (!defined($_CONFIG['define_code']))
{
   echo 'This file cannot be accessed directly.';
   exit;
}

$_GET['ID'] =
       (isset($_GET['ID']) && is_numeric($_GET['ID']))
               ? abs(intval($_GET['ID'])) : '';
if (!$_GET['ID'])
{
   echo 'Invalid ID<br />> <a href="' . gen_url('index', true)
           . '">Go Home</a>';
   die($h->endpage());
}
else if ($_GET['ID'] == $userid)
{
   echo 'you can\'t attack yourself.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($ir['hp'] <= 1)
{
   echo 'You\'re unconcious therefore you can\'t attack.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if (isset($_SESSION['attacklost']) && $_SESSION['attacklost'] == 1)
{
   $_SESSION['attacklost'] = 0;
   echo 'Only the losers of all their EXP attack when they\'ve already lost.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
$youdata = $ir;
$q =
       $db->query(
               "SELECT u.`userid` AS `u_userid`,`hp`,`hospital`,`jail`,`equip_armor`,`username`,`equip_primary`,`equip_secondary`,`gang`,`location`,`maxhp`,us.`guard`,`agility`,`strength` FROM `users` u LEFT JOIN `userstats` us ON u.`userid` = us.`userid` WHERE u.`userid` = {$_GET['ID']}");
if ($db->num_rows($q) == 0)
{
   ErrorText(
           'User doesn\'t seem to exist.<br />> <a href="'
                   . gen_url('index', true) . '">Go Home</a>');
}
$odata = $db->fetch_row($q);
$myabbr = ($ir['gender'] == "Male") ? "his" : "her";
$oabbr = ($ir['gender'] == "Male") ? "his" : "her";
if ($ir['attacking'] && $ir['attacking'] != $_GET['ID'])
{
   $_SESSION['attacklost'] = 0;
   echo 'Something went wrong.<br />> <a href="' . gen_url('index', true)
           . '">Go Home</a>';
   die($h->endpage());
}
if ($odata['hp'] == 1)
{
   $_SESSION['attacking'] = 0;
   $ir['attacking'] = 0;
   $db->query("UPDATE `users` SET `attacking` = 0 WHERE `userid` = $userid");
   echo 'This player is unconscious.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($odata['hospital'])
{
   $_SESSION['attacking'] = 0;
   $ir['attacking'] = 0;
   $db->query("UPDATE `users` SET `attacking` = 0 WHERE `userid` = $userid");
   echo 'This player is in hospital.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($ir['hospital'])
{
   $_SESSION['attacking'] = 0;
   $ir['attacking'] = 0;
   $db->query("UPDATE `users` SET `attacking` = 0 WHERE `userid`  =$userid");
   echo 'While in hospital you can\'t attack.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($odata['jail'])
{
   $_SESSION['attacking'] = 0;
   $ir['attacking'] = 0;
   $db->query("UPDATE `users` SET `attacking` = 0 WHERE `userid` = $userid");
   echo 'This player is in jail.<br />> <a href="' . gen_url('index', true)
           . '">Go Home</a>';
   die($h->endpage());
}
else if ($ir['jail'])
{
   $_SESSION['attacking'] = 0;
   $ir['attacking'] = 0;
   $db->query("UPDATE `users` SET `attacking` = 0 WHERE `userid` = $userid");
   echo 'While in jail you can\'t attack.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
echo '
<table width="100%">
	<tr>
<td colspan="2" align="center">
  ';
$_GET['wepid'] =
       (isset($_GET['wepid']) && is_numeric($_GET['wepid']))
               ? abs(intval($_GET['wepid'])) : '';
if ($_GET['wepid'])
{
   if ($_SESSION['attacking'] == 0 && $ir['attacking'] == 0)
   {
       if ($youdata['energy'] >= $youdata['maxenergy'] / 2)
       {
           $youdata['energy'] -= floor($youdata['maxenergy'] / 2);
           $me = floor($youdata['maxenergy'] / 2);
           $db->query(
                   "UPDATE `users` SET `energy` = `energy` - {$me} WHERE `userid` = $userid");
           $_SESSION['attacklog'] = '';
           $_SESSION['attackdmg'] = 0;
       }
       else
       {
           echo 'You can only attack someone when you have 50% energy.<br />> <a href="'
                   . gen_url('index', true) . '">Go Home</a>';
           die($h->endpage());
       }
   }
   $_SESSION['attacking'] = 1;
   $ir['attacking'] = $odata['u_userid'];
   $db->query(
           "UPDATE `users` SET `attacking` = {$ir['attacking']} WHERE `userid` = $userid");
   $_GET['nextstep'] =
           (isset($_GET['nextstep']) && is_numeric($_GET['nextstep']))
                   ? abs(intval($_GET['nextstep'])) : '';
   if ($_GET['wepid'] != $ir['equip_primary']
           && $_GET['wepid'] != $ir['equip_secondary'])
   {
       $db->query("UPDATE `users` SET `exp` = 0 WHERE `userid` = $userid");
       echo 'Stop trying to abuse a game bug. You can lose all your EXP for that.<br />> <a href="'
               . gen_url('index', true) . '">Go Home</a>';
       die($h->endpage());
   }
   $qo =
           $db->query(
                   "SELECT `weapon`,`itmname` FROM `items` WHERE `itmid` = {$_GET['wepid']}");
   $r1 = $db->fetch_row($qo);
   $mydamage =
           (int) (($r1['weapon'] * $youdata['strength']
                   / ($odata['guard'] / 1.5)) * (rand(8000, 12000) / 10000));
   $hitratio = max(10, min(60 * $ir['agility'] / $odata['agility'], 95));
   if (rand(1, 100) <= $hitratio)
   {
       $q3 =
               $db->query(
                       "SELECT `armor` FROM `items` WHERE `itmid` = {$odata['equip_armor']} ORDER BY rand()");
       if ($db->num_rows($q3))
       {
           $mydamage -= $db->fetch_single($q3);
       }
       if ($mydamage < -100000)
       {
           $mydamage = abs($mydamage);
       }
       else if ($mydamage < 1)
       {
           $mydamage = 1;
       }
       $crit = rand(1, 40);
       if ($crit == 17)
       {
           $mydamage *= rand(20, 40) / 10;
       }
       else if ($crit == 25 OR $crit == 8)
       {
           $mydamage /= (rand(20, 40) / 10);
       }
       $mydamage = round($mydamage);
       $odata['hp'] -= $mydamage;
       if ($odata['hp'] == 1)
       {
           $odata['hp'] = 0;
           $mydamage += 1;
       }
       $db->query(
               "UPDATE `users` SET `hp` = `hp` - $mydamage WHERE `userid` = {$_GET['ID']}");
       echo "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n";
       $_SESSION['attackdmg'] += $mydamage;
       $_SESSION['attacklog'] .=
               "<font color=red>{$_GET['nextstep']}. Using {$myabbr} {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n";
   }
   else
   {
       echo "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n";
       $_SESSION['attacklog'] .=
               "<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n";
   }
   if ($odata['hp'] <= 0)
   {
       $odata['hp'] = 0;
       $_SESSION['attackwon'] = $_GET['ID'];
       $db->query(
               "UPDATE `users` SET `hp` = 0 WHERE `userid` = {$_GET['ID']}");
       $db->query(
               'UPDATE `users` SET `LWID` = ' . $_GET['ID']
                       . ' WHERE `userid` = ' . $userid);
       echo "
<br />
<b>What do you want to do with {$odata['username']} now?</b><br />
<form action='" . gen_url('attackwon', true)
               . "&ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' /></form>
<form action='" . gen_url('attackbeat', true)
               . "&ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' /></form>
<form action='" . gen_url('attacktake', true)
               . "&ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them' /></form>
  ";
   }
   else
   {

       $eq =
               $db->query(
                       "SELECT `itmname`,`weapon` FROM  `items` WHERE `itmid` IN({$odata['equip_primary']}, {$odata['equip_secondary']})");
       if ($db->num_rows($eq) == 0)
       {
           $wep = "Fists";
           $dam =
                   (int) ((((int) ($odata['strength'] / $ir['guard'] / 100))
                           + 1) * (rand(8000, 12000) / 10000));
       }
       else
       {
           $cnt = 0;
           while ($r = $db->fetch_row($eq))
           {
               $enweps[] = $r;
               $cnt++;
           }
           $weptouse = rand(0, $cnt - 1);
           $wep = $enweps[$weptouse]['itmname'];
           $dam =
                   (int) (($enweps[$weptouse]['weapon'] * $odata['strength']
                           / ($youdata['guard'] / 1.5))
                           * (rand(8000, 12000) / 10000));
       }
       $hitratio = max(10, min(60 * $odata['agility'] / $ir['agility'], 95));
       if (rand(1, 100) <= $hitratio)
       {
           $q3 =
                   $db->query(
                           "SELECT `armor` FROM `items` WHERE `itmid` = {$ir['equip_armor']} ORDER BY rand()");
           if ($db->num_rows($q3))
           {
               $dam -= $db->fetch_single($q3);
           }
           if ($dam < -100000)
           {
               $dam = abs($dam);
           }
           else if ($dam < 1)
           {
               $dam = 1;
           }
           $crit = rand(1, 40);
           if ($crit == 17)
           {
               $dam *= rand(20, 40) / 10;
           }
           else if ($crit == 25 OR $crit == 8)
           {
               $dam /= (rand(20, 40) / 10);
           }
           $dam = round($dam);
           $youdata['hp'] -= $dam;
           if ($youdata['hp'] == 1)
           {
               $dam += 1;
               $youdata['hp'] = 0;
           }
           $db->query(
                   "UPDATE `users` SET `hp` = `hp` - $dam WHERE `userid` = $userid");
           $ns = $_GET['nextstep'] + 1;
           echo "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n";
           $_SESSION['attacklog'] .=
                   "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n";
       }
       else
       {
           $ns = $_GET['nextstep'] + 1;
           echo "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font><br />\n";
           $_SESSION['attacklog'] .=
                   "<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font><br />\n";
       }
       if ($youdata['hp'] <= 0)
       {
           $youdata['hp'] = 0;
           $_SESSION['attacklost'] = 1;
           $db->query("UPDATE `users` SET `hp` = 0 WHERE `userid` = $userid");
           echo "<form action='" . gen_url('attacklost', true)
                   . "&ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />";
       }
   }
}
else if ($odata['hp'] < 5)
{
   echo 'You can only attack those who have health.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0)
{
   echo 'You are in the same gang as ' . $odata['username']
           . '! What are you smoking today dude!<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($youdata['energy'] < $youdata['maxenergy'] / 2)
{
   echo 'You can only attack someone when you have 50% energy.<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
else if ($youdata['location'] != $odata['location'])
{
   echo 'You can only attack someone in the same location!<br />> <a href="'
           . gen_url('index', true) . '">Go Home</a>';
   die($h->endpage());
}
echo '
</td>
	</tr>
  ';
if ($youdata['hp'] <= 0 OR $odata['hp'] <= 0)
{
   echo '</table>';
}
else
{
   $vars['hpperc'] = round($youdata['hp'] / $youdata['maxhp'] * 100);
   $vars['hpopp'] = 100 - $vars['hpperc'];
   $vars2['hpperc'] = round($odata['hp'] / $odata['maxhp'] * 100);
   $vars2['hpopp'] = 100 - $vars2['hpperc'];
   $mw =
           $db->query(
                   "SELECT `itmid`,`itmname` FROM  `items`  WHERE `itmid` IN({$ir['equip_primary']}, {$ir['equip_secondary']})");
   echo '
	<tr>
<td colspan="2" align="center">Attack with:<br />
  ';
   if ($db->num_rows($mw) > 0)
   {
       while ($r = $db->fetch_row($mw))
       {
           if (!$_GET['nextstep'])
           {
               $ns = 1;
           }
           else
           {
               $ns = $_GET['nextstep'] + 2;
           }
           if ($r['itmid'] == $ir['equip_primary'])
           {
               echo '<b>Primary Weapon:</b> ';
           }
           if ($r['itmid'] == $ir['equip_secondary'])
           {
               echo '<b>Secondary Weapon:</b> ';
           }
           echo "<a href='" . gen_url('attack', true)
                   . "&nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}'>{$r['itmname']}</a><br />";
       }
   }
   else
   {
       echo "You have nothing to fight with.";
   }
   echo "</table>";
   echo "<table width='50%' align='center'><tr><td align=right>Your Health: </td><td><img src=greenbar.png width={$vars['hpperc']} height=10><img src=redbar.png width={$vars['hpopp']} height=10></td><tr><td align=right>Opponents Health:  </td><td><img src=greenbar.png width={$vars2['hpperc']} height=10><img src=redbar.png width={$vars2['hpopp']} height=10></td></tr></table>";
}
$h->endpage();
Posted

I am pretty sure i do but it is the original script without any modification.

Is there anybody out here who has the original redux attack.php file (working version)?

Or another attack file i could try?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...