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=426864)
OnPlayerTakeDamage -
iHaze. - 30.03.2013
Hello, I've recently checked the wiki for a damage callback, I've found the OnPlayerTakeDamage, I wanted to make a function in it When the player jumps a little bit high than the normal, He gets more HP low, Is it possible?
Re: OnPlayerTakeDamage -
rhds - 30.03.2013
What do you mean by jumping more than normal?
Anyways, you can use these
pawn Код:
new Float:x, Float:y, Float:z;
// Use GetPlayerPos, passing the 3 float variables we just created
GetPlayerPos(playerid, x, y, z);
and
https://sampwiki.blast.hk/wiki/GetPlayerKeys (KEY_JUMP)
Re: OnPlayerTakeDamage -
RajatPawar - 30.03.2013
Isn't it kind of incoded into GTA:SA? The higher you fall from, more is the health you lose? Isn't that what you mean?
Re: OnPlayerTakeDamage -
iHaze. - 30.03.2013
Nope, I mean i wanna make a more custom function like the GTA:SA.
Re: OnPlayerTakeDamage -
rhds - 30.03.2013
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_JUMP)
{
new Float:x, Float:y, Float:z;
GetPlayerVelocity(playerid, x, y, z);
if(y > changethistoheightvalue)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health-80);
}
}
return 1;
}
I tried something, not sure if in right direction, something is wrong, probably someone else can continue or fix.