SA-MP Forums Archive
Help Isplayerinwater - 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: Help Isplayerinwater (/showthread.php?tid=517505)



Help Isplayerinwater - KesaSport - 05.06.2014

Hello, im using thins fucn:
pawn Код:
stock IsPlayerInWater(playerid)
{  
    new index = GetPlayerAnimationIndex(playerid);  
    return ((index >=  1538 && index <= 1541) || index == 1544);
}
But ist not working when i just jump in water. After when I swim somether its working...
So, why is not working when i jump in water and not moving?

P.S. Sorry for bad english.


Re: Help Isplayerinwater - Matess - 05.06.2014

Try

pawn Код:
stock IsPlayerInWater(playerid)
{  
    new index = GetPlayerAnimationIndex(playerid);  
    return ((index >=  1538) && (index <= 1541)) || index == 1544);
//or return ((1538 <= index <= 1541)) || index == 1544);
}



Re: Help Isplayerinwater - Konstantinos - 05.06.2014

I guess it only checks if the animation the player applies is something related to swimming only.

The animation index 1250 is when a player just stay in water without moving (floating in water) so add it to the check as well.


Re: Help Isplayerinwater - iFiras - 05.06.2014

See this include, maybe will help you.
https://sampforum.blast.hk/showthread.php?tid=173944


Re: Help Isplayerinwater - KesaSport - 05.06.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I guess it only checks if the animation the player applies is something related to swimming only.

The animation index 1250 is when a player just stay in water without moving (floating in water) so add it to the check as well.
It's working, thanks.