Check if a player is on ground or in air. - 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: Check if a player is on ground or in air. (
/showthread.php?tid=432853)
Check if a player is on ground or in air. -
techg9 - 24.04.2013
Hey guys,
I am trying to detect if a player is in the air...
now I remember that there was some function for this, but I can't really remember what was the name of that function.
I want to check if a player is above ground (world ground, not an object).
thanks for the helpers =)
AW: Check if a player is on ground or in air. -
HurtLocker - 24.04.2013
Above ground, means falling. So create a timer which detects the z axis difference. But people moving on ground, also have z axis differences. It's up to you to define how big that difference will be per value of time so that people of ground won't count as flying ones.
Re: AW: Check if a player is on ground or in air. -
techg9 - 24.04.2013
Quote:
Originally Posted by HurtLocker
Above ground, means falling. So create a timer which detects the z axis difference. But people moving on ground, also have z axis differences. It's up to you to define how big that difference will be per value of time so that people of ground won't count as flying ones.
|
yha but theres not a function to check if he is in the air or not? like to get the z of the ground below him and compare it to his current z.
AW: Check if a player is on ground or in air. -
HurtLocker - 24.04.2013
No, there's not.
Re: AW: Check if a player is on ground or in air. -
DaRk_RaiN - 24.04.2013
Quote:
Originally Posted by techg9
yha but theres not a function to check if he is in the air or not? like to get the z of the ground below him and compare it to his current z.
|
Check for the "falling" animation.
Re: Check if a player is on ground or in air. -
Faisal_khan - 24.04.2013
You can also use
MapAndreas plugin by Kye or
the include. Check if the player is not on the lowest part of the map. Then you go!
P.S. I would prefer the include
Re: Check if a player is on ground or in air. -
Pottus - 24.04.2013
pawn Код:
stock IsPlayerFalling(playerid) //true if player is falling with a closed parachute
{
new index = GetPlayerAnimationIndex(playerid);
if(index >= 958 && index <= 979 || index == 1130 || index == 1195 || index == 1132) return 1;
return 0;
}
Re: Check if a player is on ground or in air. -
techg9 - 24.04.2013
Quote:
Originally Posted by [uL]Pottus
pawn Код:
stock IsPlayerFalling(playerid) //true if player is falling with a closed parachute { new index = GetPlayerAnimationIndex(playerid); if(index >= 958 && index <= 979 || index == 1130 || index == 1195 || index == 1132) return 1; return 0; }
|
yha, the problem is I need to check when he is in a car