How to make infinity health ?
#1

Hey all,

I don't need /god
I need only, like this :

pawn Код:
new Float:health;
        GetPlayerHealth(playerid,health);
        if (health < 1000)
        {
            SetPlayerHealth(playerid, 100);
        }
    }
   
    return 1;
}
It work but if i have jumped in a loong construction (ex: Tower in LS) player will die !!
+ I need a fix health streak & sorry for my bad English
Plz ! help
Reply
#2

I'm pretty sure the max health is something close to 65535, if you set a players health to this value they should be immune from collision death ( untested )
Reply
#3

Yes, but it make the health bar sign i don't need that, only i need if his health < 100 SetPlayerHealth 100 without any probs, Thx !
Reply
#4

Maybe try a timer.

pawn Код:
new
Float: Health;
GetPlayerHealth ( playerid, Health );
if ( Health < 100 )
{
SetTimer ( "RefillHealth", 1000, 0 );
return 1;
}

// Add it in a blank line ( Not in callbacks I mean ).
forward RefillHealth ( );
public RefillHealth ( )
{
SetPlayerHealth ( playerid, 100.0 );
return 1;
}
Sorry if it will not work, because I didn't test it.
Reply
#5

You could run it in OnPlayerUpdate() tho it will be ran very often.

Edit: This will fuck up your script..
Код:
new Float:health;
        GetPlayerHealth(playerid,health);
        if (health < 1000)
        {
            SetPlayerHealth(playerid, 100);
        }
    }
   
    return 1;
}
Remember health is a Float. Also this will set your health to 100 like all the time, should probably add a zero(0) at the SetPlayerHealth().
Reply
#6

Or get a gamemode and type /sethp <user> 999999.
Reply
#7

Why not simply use OnPlayerUpdate for things like this?

pawn Код:
public OnPlayerUpdate(playerid)
{
  new Float:HP; GetPlayerHealth(playerid, HP);
  if(HP < 1000) SetPlayerHealth(playerid, 1000);
  return 1;
}
Reply
#8

Quote:
Originally Posted by Basicz
Посмотреть сообщение
Maybe try a timer.

pawn Код:
new
Float: Health;
GetPlayerHealth ( playerid, Health );
if ( Health < 100 )
{
SetTimer ( "RefillHealth", 1000, 0 );
return 1;
}

// Add it in a blank line ( Not in callbacks I mean ).
forward RefillHealth ( );
public RefillHealth ( )
{
SetPlayerHealth ( playerid, 100.0 );
return 1;
}
Sorry if it will not work, because I didn't test it.
That would work, but you need to use
SetTimerEx("RefillHealth", 1000, 1, "i", playerid);
you mistaked 2 things here, repeating, and you should use SetTimerEx
Reply
#9

Quote:
Originally Posted by Basicz
Посмотреть сообщение
pawn Код:
new
Float: Health;
GetPlayerHealth ( playerid, Health );
if ( Health < 100 )
{
SetTimer ( "RefillHealth", 1000, 0 );
return 1;
}
Where can I put this, OnPlayerUpdate ?!
Reply
#10

Quote:
Originally Posted by Yaszine
Посмотреть сообщение
Where can I put this, OnPlayerUpdate ?!
Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Why not simply use OnPlayerUpdate for things like this?

pawn Код:
public OnPlayerUpdate(playerid)
{
  new Float:HP; GetPlayerHealth(playerid, HP);
  if(HP < 1000) SetPlayerHealth(playerid, 1000);
  return 1;
}
Use Hiddy's.

Also, if you were using Basicz, by the time the timer kicks in, if you were getting shot at by a minigun, you would already be dead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)