SA-MP Forums Archive
detect if a player fall - 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: detect if a player fall (/showthread.php?tid=649095)



detect if a player fall - PundacheMakalae - 02.02.2018

is there any way to detect if a player fall into water?


Re: detect if a player fall - Mugala - 02.02.2018

you can detect a fall animation in OnPlayerUpdate with GetPlayerAnimationIndex and GetPlayerAnimationName.


Re: detect if a player fall - PepsiCola23 - 02.02.2018

http://forum.sa-mp.com/showthread.ph...PlayerSwimming

check that,you need to find him via the swimming animation
or if you want to find out if he`s swimming underwater check his coordinates and see if he`s under sea level (x,y,0.00)


Re: detect if a player fall - dani18 - 02.02.2018

A while ago i made a minigame with something similar, this i used:
PHP код:
public OnGameModeInit()
{
SetTimer("dm_activate"1000true);
return 
1;
}
forward dm_activate();
public 
dm_activate()
{
for (new 
0MAX_PLAYERSi++)
{
new 
Float:pPos[3];
GetPlayerPos(ipPos[0], pPos[1], pPos[2]);
if(
IsPlayerConnected(i))
{
if (
pPos[2] < 25.0)
{
if(
Player_minigame[i] == 1)//detects if the player is inside the minigame/place, if you want to remove it.
{
TogglePlayerSpectating(playerid1);
GameTextForPlayer(playerid"You lost"20005);
SetTimerEx("check_exit",1000,0,"d",playerid);
return 
1;
}
}
}
}
return 
1;
}
forward check_exit(playerid);
public 
check_exit(playerid)
{
TogglePlayerSpectating(playerid,0);
return 
1;

I do not know if it works for you.


Re: detect if a player fall - RogueDrifter - 02.02.2018

1195, 1197, 1133, 1130
^^ put those in a function with getplayeranimationindex to check for the player falling.