Jump to content
MakeWebGames

NEED 50% health for attack... Help?


KDawg08

Recommended Posts

else if ($youdata['hp'] >= $youdata['maxhp']/2)
{
$youdata['hp']-= $youdata['maxhp']/2;
$me=$youdata['maxhp']/2;
$_SESSION['attacklog']="";
}
else
{
print "<font color='red'>[b]You need 50% health or more.</font>[/b]";
$h->endpage();
exit;
}

 

I'm trying to force it to NOT let a user attack if they don't have 50% or more health...

The codes already have an IF USER BEING ATTACKED HAS 50% or less u can't attack but not the other way around.

Any suggestions or see where i went wrong?

Link to comment
Share on other sites

Re: NEED 50% health for attack... Help?

NEVERMIND EVERYONE...

I found my mistakes...

This worked instead.

 

else if ($ir['hp'] >= $ir['maxhp']/2)
{
$ir['hp']-= $ir['maxhp']/2;
$me=$ir['maxhp']/2;
$_SESSION['attacklog']="";
}
else
{
print "<font color='red'>[b]You need atleast 50% health to attack.</font>[/b]";
$h->endpage();
$_SESSION['attacking']=0;
exit;
}
Link to comment
Share on other sites

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