Preventing death
#1

Hi, so I'm researching and trying different things in order to make this work.

I am attempting to prevent characters from dying at all, in order to make my custom damage system work.

However, I have yet to find something that fully disables death.

Currently I have this in my script:
pawn Код:
public OnPlayerUpdate(playerid)
{
    new Float:pHealth;
    GetPlayerHealth(playerid, pHealth);
    if(pHealth < 10000.0)
        SetPlayerHealth(playerid, 10000.0);
   
    return 1;
}
That should stop the player from reaching a health below 10,000. It does indeed work with bullets, it works with fall damage, being ran over by cars etc etc etc. What it does not work with, however, is blowing up inside vehicles, as well as fall damage when wearing a parachute.

Does anyone here know any good way of preventing death in these cases?

EDIT: Oops, just realized I posted in Scripting Discussion, when I meant to post it in scripting help. You so stupid Ceathor
Reply
#2

SetPlayerTeam to everyone on the same team will prevent any damage (including explosions and all) from other players.

Then give the player a health of 9999999999 once at OnPlayerSpawn (no need for it to be at OnPlayerUpdate) and voilб, the player will no longer receive any damage whatsoever.

You can completely manage the damage by players/enviroment using OnPlayerTakeDamage. The only downside with this system is that other players will never see the HP bar going down for both themselves and other players, you can solve this by adding a custom HUD and name labels.

I believe you cannot avoid exploding inside of vehicles and parachute, the best you could do is to remove the player from the vehicle if it reaches certain HP, but it'll not work on instant explosions either, it's hardcoded.
Reply
#3

Hmm... There must be a way to prevent the death screen, right? One way or another..
Reply
#4

pawn Код:
#define FLOAT_INFINITY      (Float:0x7F800000)

SetPlayerHealth(playerid, FLOAT_INFINITY);
Reply
#5

Quote:
Originally Posted by doreto
Посмотреть сообщение
pawn Код:
#define FLOAT_INFINITY      (Float:0x7F800000)

SetPlayerHealth(playerid, FLOAT_INFINITY);
Infinity is not a number, that's just the highest integer (converted to float) possible on PAWN. Which wont also answer his question at all (and is something I've also suggested).

Quote:
Originally Posted by Ceathor
Посмотреть сообщение
Hmm... There must be a way to prevent the death screen, right? One way or another..
I am almost completely sure that the parachute and car explosions are hardcoded.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)