Jump to content

Recommended Posts

Hey, I need help with this error:

 

Error:

Parse error: syntax error, unexpected '}' in C:\Program Files\xampp\htdocs\wintersword\core\combat\combat.class.php on line 119

 

Code:

<?php

class class_combat {

function combat_getvars() {

}

function combat_statsbar() {

  $explode = explode(" ", $_SESSION['userinfo']);
  $username = $explode[0];

  $query_one = "SELECT hp_cur, hp_max, mp_cur, mp_max, exp_cur, exp_max, gold, level FROM user_currents WHERE username='$username'";
  
  $array_one = mysql_fetch_array(mysql_query($query_one));
  
  $query_two = "SELECT race, class, strength, dexerity, constitution, intelligence FROM user_charinfo WHERE username='$username'";
  
  $array_two = mysql_fetch_array(mysql_query($query_two));
  
  $query_three = "SELECT name, hp_cur, hp_max FROM user_battles WHERE username='$username'";
  
  $array_three = mysql_fetch_array(mysql_query($query_three));

  $query_four = "SELECT race, level, hp, mindamage, maxdamage, exp, gold FROM game_creatures WHERE name='$array_three[0]'";

  $array_four = mysql_fetch_array(mysql_query($query_four));

  echo "$username";
  echo "'s Stats: <br>";
  echo "RACE: $array_two[0] CLASS: $array_two[1] LEVEL: $array_one[7]  <br>";
  echo "HP: $array_one[0] / $array_one[1] MP: $array_one[2] / $array_one[3] <hr>";
  echo "$array_three[0]";
  echo "'s Stats: <br>";
  echo "RACE: $array_four[0] LEVEL: $array_four[1] <hr>";
  echo "HP: $array_three[1] / $array_three[2] <hr>";

}

function combat_fight() {

  $explode = explode(" ", $_SESSION['userinfo']);
  $username = $explode[0];

  $query_one = "SELECT hp_cur, hp_max, mp_cur, mp_max, exp_cur, exp_max, gold, level FROM user_currents WHERE username='$username'";
  
  $array_one = mysql_fetch_array(mysql_query($query_one));
  
  $query_two = "SELECT race, class, strength, dexerity, constitution, intelligence FROM user_charinfo WHERE username='$username'";
  
  $array_two = mysql_fetch_array(mysql_query($query_two));
  
  $query_three = "SELECT name, hp_cur, hp_max FROM user_battles WHERE username='$username'";
  
  $array_three = mysql_fetch_array(mysql_query($query_three));

  $query_four = "SELECT race, level, hp, mindamage, maxdamage, exp, gold FROM game_creatures WHERE name='$array_three[0]'";

  $array_four = mysql_fetch_array(mysql_query($query_four));
  
  if ($array_one[0] > 0 && $array_three[1] > 0) {

    $this->combat_statsbar();
  
    if (!isset($_POST['submit']) || $_POST['submit'] == '') {
  
     echo " <form action='' method='post'> 
          Type Of Attack:<select name='attack'>
	  <option value='normal'>Normal Attack</option>
	  </select> <hr>
	  <input type = 'submit' name = 'submit'>";
	  
    }
  
    if (isset($_POST['submit']) || $_POST['submit'] != '') {
  
     if ($_POST['attack'] == 'normal') {
   
      $min_damage = ($array_two[2] * 3) + ($array_two[5] * 2);
  $max_damage = (($array_two[2] * 3) + ($array_two[5] * 2)) + 5;
  
  $array_three[1] = $array_three[1] - $max_damage;
   
     }

   $query_one = "UPDATE user_currents SET hp_cur='$array_one[0]', hp_max='$array_one[1]', mp_cur='$array_one[2]', mp_max='$array_one[3]', exp_cur='$array_one[4]', exp_max='$array_one[5]', gold='$array_one[6]', level='$array_one[7]' WHERE username='$username'";
  
   $result = mysql_query($query_one);
  
   $query_two = "UPDATE user_charinfo SET strength='$array_two[2]', dexerity='$array_two[3]', constitution='$array_two[4]', intelligence='$array_two[5]' WHERE username='$username'";
  
   $result = mysql_query($query_two);
  
   $query_three = "UPDATE user_battles SET hp_cur='$array_three[1]', hp_max='$array_three[2]' WHERE username='$username'";
   
   $result = mysql_query($query_three);
   
   echo "<meta http-equiv='refresh' content=0;url='fight.php'>";
   
   }
  
  }
  
  if ($array_one[0] <= 0){
  
   echo "Your dead";
   
   $query = "DELETE FROM user_battles WHERE username='$username'";
  
  }
  
  if ($array_three[1] <= 0) {
  
   echo "You have won";
   
   $query = "DELETE FROM user_battles WHERE username='$username'"
   
   }
  
}

}

Link to comment
https://forums.phpfreaks.com/topic/44063-random-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.