Is player 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is player in air. (
/showthread.php?tid=222585)
Is player in air. -
Stigg - 07.02.2011
Is it possible to detect if a player is in the air but not in a Aircraft ?
Eg: Using a parachute or sky diving. Thanks.
Peace...
Re: Is player in air. -
Mauzen - 07.02.2011
You could check for different animations with GetPlayerAnimationIndex.
Example:
pawn Код:
public IsPlayerSkydiving(playerid) //true if player is falling with a closed parachute
{
new index = GetPlayerAnimationIndex(playerid)
return (index >= 958 && index <= 962);
}
public IsPlayerUsingParachute(playerid) //true if player is falling with an opened parachute
{
new index = GetPlayerAnimationIndex(playerid)
return (index >= 963 && index <= 979);
}
A combination of all falling animations would tell you if a player is in the air. Another solution would be the MapAndreas include. You would check if the player's Z coordinate is above the ground then. More effective against airbreak, but you wont get information about how a player is falling.
The indexes are taken from Slices enum:
https://sampforum.blast.hk/showthread.php?tid=172649
Re: Is player in air. -
Stigg - 07.02.2011
Thanks, i'll give that ago.
Peace...
Re: Is player in air. -
Mean - 07.02.2011
Mauzen you rock!