Detecting if Player entered Water
#1

Hello there, i was thinking if there is any way to detect if the player is in Water, or if player entered water, or Exited from Water... I searched around for some Callbacks for it but i didn't find any, and i know it exists and there IS a way for it cuz i saw it in a few servers. Please if you know, let me know.
Thanks In Advance and +REP to whoever help me.
Reply
#2

You could check if he's under sea level or you could check if a player is swimming with this include: http://forum.sa-mp.com/showthread.ph...PlayerSwimming.
Reply
#3

The water high is always 0 on the z achse.
Means:

new Zpos[MAX_PLAYERS];

new Float:X,Y,Z;
GetPlayerPos(playerid,X,Y,Z);
Zpos[playerid] = Z;

If(Zpos[playerid] < 0)
{
He is in water
}
else
{
He is not in the water
}
Reply
#4

Checking whether the player is playing a swimming animation and the z coordinate being below 0.
Do the opposite of this to detect if he exits water.

Edit: Late, late, late, more late...
Reply
#5

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
You could check if he's under sea level or you could check if a player is swimming with this include: http://forum.sa-mp.com/showthread.ph...PlayerSwimming.
Thnx, really, +REP

Thnx to Dragonsaurus and redreaper666 too, really helpful thnx
Reply
#6

Not true. There are places where water is above the 0 coordinate. For example, pirate ship in Las Venturas or swimming pools in Vinewood.
Its best to check for animation rather than position.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)