Here are the basics

  • $_SESSION[regen]=5 - this is the code of the number of installations xn. (Healer restores 5xp.)
  • $udata[hp] is a code that displays how much hp I have. (Let it be for example 10xp.)
  • $udata[hpall] is a display of the maximum amount of hp.

That is, you need to make the link "Heal", when you click on it, 5xp is added to my hp. But if my lives are full, I just knock out the inscription "You are healthy."

    4 answers 4

     if($udata[hp] < $udata[hpall]){ $udata[hp] = $udata[hp]+$_SESSION[regen]; if($udata[hp] > $udata[hpall]){ $udata[hp] = $udata[hpall]; } echo "Игрок исцелен!"; }else{ echo "Игрока исцелять не нужно, у него полно здоровья!"; } 

    My bike %)

      Something like this:

       $fullHpMsg = 'Вы полностью исцелены'; if($udata[hp] < $udata[hpall]) { $udata[hp] = $udata[hp]+$_SESSION[regen] < $udata[hpall] ? $udata[hp]+$_SESSION[regen] : $udata[hp] = $udata[hpall]; $message = 'Целитель вылечил ' . $_SESSION[regen] . ' hp'; $message .= "\n" . 'Теперь у вас ' . $udata[hp] . ' hp'; if($udata[hp] == $udata[hpall]) { $message .= "\n" . $fullHpMsg; } echo $message; } else { echo $fullHpMsg; } 

        At all:

         if $udata[hp] = $udata[hpall] then echo Жизни полны else Прибавление 

        Sorry for not writing all the code, I don't know php

           if ($udata[hp] == $udata[hpall]) echo "Вы здоровы"; else { $udata[hp] = $_SESSION[regen]; echo "Лечение завершено"; } ?> 
          • And if he has 9/10 hp, will he increase 5 hp and he will have 14/10 hp? in my version this is taken into account - Elime
          • Again, not true) If a player has 9/10 hp, then after your treatment he will have 5/10 hp. That is, on the contrary, hp will decrease) - Elime
          • Ahah ... I play Karoche, I have 50hp, I always have 100 ... I decided to go to a healer, the healer merges me hp to 5 and still gloats - the treatment is completed: DDD - Zowie
          • 3
            @AlexWindHope what I said about: D - Elime