OnPlayerTakeDamage. - 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: OnPlayerTakeDamage. (
/showthread.php?tid=388014)
OnPlayerTakeDamage. -
budelis - 27.10.2012
Hi,
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if( issuerid == playerid)
{
GetPlayerHealth( playerid, HealthSave[ playerid ] );
SetPlayerHealth( playerid, HealthSave[ playerid ]+amount );
}
return 1;
}
I want to do if player take damage from his self ex: fall down from house. Then player will get his lose hp. Is it work?
Sorry for my bad english.
Re: OnPlayerTakeDamage. -
mincer - 27.10.2012
try this
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if( issuerid == INVALID_PLAYER_ID)
{
GetPlayerHealth( playerid, HealthSave[ playerid ] );
SetPlayerHealth( playerid, HealthSave[ playerid ]+amount );
}
return 1;
}
Re: OnPlayerTakeDamage. -
budelis - 27.10.2012
Thanks i will try. Please test it if you can.
Re: OnPlayerTakeDamage. -
_Khaled_ - 27.10.2012
It's
PHP код:
if(issuerid != INVALID_PLAYER_ID)
Re: OnPlayerTakeDamage. - Jarnu - 27.10.2012
IS not possible. do what Khaled said.
Re: OnPlayerTakeDamage. -
JaKe Elite - 27.10.2012
Never mind.
Re: OnPlayerTakeDamage. -
budelis - 27.10.2012
Код:
if(issuerid != INVALID_PLAYER_ID)
if i use this, when i do damage to myself it will this callback will be called (OnPlayerTakeDamage) and this check will work?
Re: OnPlayerTakeDamage. -
_Khaled_ - 27.10.2012
How will you "damage" yourself?
you cannot shoot yourself, by falling and vehicle collision I think it's auto.
Re: OnPlayerTakeDamage. -
EV007 - 27.10.2012
if(issuerid == INVALID_PLAYER_ID)
use this .... if there is no valid issuerid it will read the code below this line.
Re: OnPlayerTakeDamage. -
_Khaled_ - 27.10.2012
EV007, IT IS !=
if you wantt it if NO VALID, then put the freakin !=