Pos In Water
#1

How to check if X, Y, Z in water?
Reply
#2

PHP Code:
if(0.0) return SendClientMessage(playerid, -1"You are in water."); 
Anything under 0 is in water
Reply
#3

Quote:
Originally Posted by NoteND
View Post
PHP Code:
if(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.
Reply
#4

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;
}
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)