Making Adjustments to PHP code

Currently: Code reduces rest by -10/-5 if player has certain item
Goal: Reduce rest by -60/-50 if player has a certain item

[php]if (mysql_num_rows($result))
$rest = $REST_LOSS/2;
else
$rest = $REST_LOSS;
[/php]

What do I write in place of [php]$REST_LOSS/2[/php] to make it so that rest loss is -50 with a groom instead of half of what it normally is, as it is currently written?

couldn’t tell you, we don’t know where $REST_LOSS is coming from. but from what you have here, you’re not loosing 10 or 5, you’re loosing half of whatever $REST_LOSS is. Are you trying to reduce it by 60 or 50 or dividing 50 into 60?

Sorry, I tried to be as clear as possible but I’m basically trying to talk about something I know nothing about.
Thanks for your response.

As it stands, you are losing 10 rest normally. . .which is divided by 2 and therefore becomes 5 if you have a special item.

I want to change this so that you lose 60 rest normally. . .and 50 rest if you have this special item.

So if I left the formula as it is, you would lose 60 rest normally. . .and 30 rest if you have this special item.

But I want to change the 30 to a 50. How can I change the formula to make this true?

I think I get it. You’ll need to check to see if the person has the special weapon, if so, then change your number, basically, something like:[php] if(isset($spec_wpn)) {
$REST_LOSS = 50 / 2;
} else {
$REST_LOSS = 60 / 2;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service