SA-MP Forums Archive
OnPlayerInteriorChange death - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerInteriorChange death (/showthread.php?tid=604873)



OnPlayerInteriorChange death - Godey - 11.04.2016

The heading describes most of it.
When I enter the interior it should block me from dying,
and when out, set to the same health I had before entering the interior
instead it just sets my health to 0, why?

What I have:
Код:
new Float:oldHealth;
    if(newinteriorid != 0)
    {
        GetPlayerHealth(playerid, oldHealth);
        SetPlayerHealth(playerid, 99999);
    }
    if(newinteriorid == 0)
    {
         SetPlayerHealth(playerid, Float:oldHealth);
    }
[Under OnPlayerInteriorChange]

If anyone can make me the script, I'll rep him/her.

Thanks!


Respuesta: OnPlayerInteriorChange death - Thewin - 11.04.2016

the definition need be global and for each player

Код:
new Float:oldHealth[MAX_PLAYERS];

if(newinteriorid != 0)
    {
        GetPlayerHealth(playerid, oldHealth[playerid]);
        SetPlayerHealth(playerid, 99999);
    }
    if(newinteriorid == 0)
    {
         SetPlayerHealth(playerid, oldHealth[playerid]);
    }



Re: OnPlayerInteriorChange death - Godey - 11.04.2016

Oh, it works!
Thanks for explaining and posting the command!
Rep'ed!