Pos In Water - 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: Pos In Water (
/showthread.php?tid=668353)
Pos In Water -
xRadical3 - 31.07.2019
How to check if X, Y, Z in water?
Re: Pos In Water -
NoteND - 31.07.2019
PHP Code:
if(Z < 0.0) return SendClientMessage(playerid, -1, "You are in water.");
Anything under 0 is in water
Re: Pos In Water -
Lokii - 31.07.2019
Quote:
Originally Posted by NoteND
PHP Code:
if(Z < 0.0) return SendClientMessage(playerid, -1, "You are in water.");
Anything under 0 is in water 
|
Wrong!
OT: you can check for swimming animation or use colandreas.
Re: Pos In Water -
OKStyle - 31.07.2019
pawn Code:
stock IsPlayerInWater(playerid)
{
if(IsPlayerInAnyVehicle(playerid)) return 0;
new animlib[32], animname[32];
GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, sizeof(animlib), animname, sizeof(animname));
return (strfind(animname, "swim", true) != -1 || strfind(animname, "water", true) != -1) ? 1 : 0;
}
Re: Pos In Water -
xRadical3 - 31.07.2019
I JUST Want Check x, y pos in water not player in water.
example:
pawn Code:
new Float:x, Float:y, Float:z;
RandomPosInArea(Float: minx, Float: miny, Float: maxx, Float: maxy, x, y);
MapAndreas_FindZ_For2DCoord(x, y, z);
MakeArmourPickup(x, y, z);
If pickup make in water players can't take it.
Re: Pos In Water -
Mugala - 01.08.2019
what OKStyle wrote is a correct for a player, but if you want to detect the water without player, than you have to use less than 0 Z coord, except some places, where less than 0 is nothing (clear place, under buildings etc..)
you have to find that places manually.