Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: unexpected else Help  (Read 296 times)

kingdkknox

  • Basic Member
  • *
  • Reputation Power: 30
  • kingdkknox has no influence.
  • Offline Offline
  • Posts: 25
    • View Profile
    • WWW
unexpected else Help
« on: June 16, 2010, 12:50:56 PM »
Okay yall gonna laugh at me but Im trying... I try to add where my users have to have a certain amount of stats before they can get exp. points to prevent people from getting super high levels wit no stats.
I get an error that I have an unexpected else.
Any way this is what I did this what was there.

Code: [Select]
if($odata['hp'] <= 0)
{
$odata['hp']=0;
$_SESSION['attackwon']=$_GET['ID'];
$db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}");
print "<br />
<b>What do you want to do with {$odata['username']} now?</b><br /><br />
<form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' STYLE='color: white;  background-color: red;' value='Mug Them' />  </form>  <br /> 
<form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' STYLE='color: white;  background-color: green;' value='Hospitalize Them' />  </form>  <br />
<form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' STYLE='color: black;  background-color: white;' value='Leave Them' /> </form>  <br />

<br />


NB:If you not choose any of the option above you lose all your EXP point !  <br /> <br />   

If you and the enemy beaten are on the same battle ladder mug them to get points added to the ladder table ! 



";
right after that I added
Code: [Select]
}
else if ($odata['hp'] <= 0 and ($youdata['strength']+$youdata['guard']+$youdata['agility']) < ($youdata['level']*60000));
{
$odata['hp']=0;
$_SESSION['attackwon']=$_GET['ID'];
$db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}");
print "<br />
<b>What do you want to do with {$odata['username']} now?</b><br /><br />
<form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' STYLE='color: white;  background-color: red;' value='Mug Them' />  </form>  <br /> 
<form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' STYLE='color: white;  background-color: green;' value='Hospitalize Them' />  </form>  <br />

<br />
Before you can get anymore exp. you have to work on your stats.
NB:If you not choose any of the option above you lose all your EXP point !  <br /> <br />   

If you and the enemy beaten are on the same battle ladder mug them to get points added to the ladder table ! 



";
}
This is the line where the error is I just posted the whole thing. unexpected else
Code: [Select]
else {
//choose opp gun
$eq=$db->query("SELECT i.* FROM  items i  WHERE i.itmid IN({$odata['equip_primary']}, {$odata['equip_secondary']})");
if(mysql_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)

If anyone has better way to do this that would be great also....
Logged
If you are for hire or if you want to find some work it can be found here.
Freelance work at home jobs

ReignFire

  • Basic Member
  • *
  • Reputation Power: 36
  • ReignFire has no influence.
  • Offline Offline
  • Posts: 56
    • View Profile
Re: unexpected else Help
« Reply #1 on: June 24, 2010, 06:40:25 PM »
else if ($odata['hp'] <= 0 and ($youdata['strength']+$youdata['guard']+$youdata['agility']) < ($youdata['level']*60000));

is this supposed to be here???
« Last Edit: June 25, 2010, 07:07:11 AM by ReignFire »
Logged

ReignFire

  • Basic Member
  • *
  • Reputation Power: 36
  • ReignFire has no influence.
  • Offline Offline
  • Posts: 56
    • View Profile
Re: unexpected else Help
« Reply #2 on: June 24, 2010, 06:41:10 PM »
...thats all i see for simple stuff....did you just insert this into attack.php or what?
« Last Edit: June 25, 2010, 07:18:31 AM by ReignFire »
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.