[Bug]onPlayerHealthChange is returning incorrect values

Started by MacTavish, Mar 08, 2015, 07:03 PM

Previous topic - Next topic

MacTavish

Last week i've done an trick to restore player oldhp when ever they try to get morethan 100

onPlayerHealthChange(player, oldhp, newhp)
{
if(newhp > 100)
{
player.Health = oldhp;
}
}

It works but it didnt return correct value if they try to get morethan 150 it return 44
I have 100hp now if hp try to set it to 300 then it will return my hp to 44

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Sk

u not try to set player's hp to 100 when it goes above 100
player.Health = 100;

MacTavish

Quote from: Sk on Mar 08, 2015, 08:40 PMu not try to set player's hp to 100 when it goes above 100
player.Health = 100;
Bro i know hacks are'nt possible in 0.4 but in the future there maybe many hacks. I dont want to set their hp to 100. I just want that if they try to get morethan 100 without heal cmd then i want this function to detect their old hp and set that again.

Example: if i use this cmd
if (cmd=="hack")
{
player.Health = 101;
}


Then the function detect that the player has tried to set hp morethan 100

onPlayerHealthChange(player, oldhp, newhp)
{
if(newhp > 100)
{
player.Health = oldhp;
MessagePlayer("You cant set your health morethan 100, Please use Heal cmd instead",player);
}
}

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P