detect if a player fall
#1

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

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

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)
Reply
#4

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.
Reply
#5

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


Forum Jump:


Users browsing this thread: 2 Guest(s)