SA-MP Forums Archive
Check is player loses health - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check is player loses health (/showthread.php?tid=113046)



Check is player loses health - Tyain - 12.12.2009

I need a function or something that check's if a certain player loses health.

So far I couldn't do that.

For example, if payer loses health ---- do something..

Thanks!


Re: Check is player loses health - Correlli - 12.12.2009

There are many filterscripts with useful callbacks and even a plugin if i'm correct. Search for "OnPlayerLoseHealth".


Re: Check is player loses health - LarzI - 12.12.2009

I believe the callback you are thinking of Don Correlli, is in YUP.
Anyways, if you don't want to use more callbacks, just use OnPlayerUpdate
pawn Код:
//global
new
  Float:g_fUpdateHealth;
//OnPlayerUpdate
public OnPlayerUpdate(playerid)
{
  new
    Float:fUpdateHealth;
  if( fUpdateHealth != g_fUpdateHealth );
  {
    //health has changed
  }
  return true;
}



Re: Check is player loses health - hipy - 12.12.2009

Quote:
Originally Posted by lrZ^ aka LarzI
I believe the callback you are thinking of Don Correlli, is in YUP.
Anyways, if you don't want to use more callbacks, just use OnPlayerUpdate
pawn Код:
//global
new
  Float:g_fUpdateHealth;
//OnPlayerUpdate
public OnPlayerUpdate(playerid)
{
  new
    Float:fUpdateHealth;
  if( fUpdateHealth != g_fUpdateHealth );
  {
    //health has changed
  }
  return true;
}
Do you have any idea how often onplayerupdate is called? yes A LOT per seconds.
Wouldn't recommend this.



Re: Check is player loses health - Tyain - 12.12.2009

But i want to detect if player loses health onder the OnPlayerKeyStateChange, and that is already a plublic function..


Re: Check is player loses health - RyDeR` - 12.12.2009

Quote:
Originally Posted by hipy
Quote:
Originally Posted by lrZ^ aka LarzI
I believe the callback you are thinking of Don Correlli, is in YUP.
Anyways, if you don't want to use more callbacks, just use OnPlayerUpdate
pawn Код:
//global
new
  Float:g_fUpdateHealth;
//OnPlayerUpdate
public OnPlayerUpdate(playerid)
{
  new
    Float:fUpdateHealth;
  if( fUpdateHealth != g_fUpdateHealth );
  {
    //health has changed
  }
  return true;
}
Do you have any idea how often onplayerupdate is called? yes A LOT per seconds.
Wouldn't recommend this.
20-30 times in one second.
You have to divide 1 with 25 so 40-50 ms.



Re: Check is player loses health - Tyain - 12.12.2009

And about my question? Anything?!


Re: Check is player loses health - Tyain - 14.12.2009

Anything?