SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/07/2019, 04:33 PM   #1
xRadical3
Gangsta
 
xRadical3's Avatar
 
Join Date: May 2017
Location: Iran
Posts: 546
Reputation: 20
Default Pos In Water

How to check if X, Y, Z in water?
xRadical3 is offline   Reply With Quote
Old 31/07/2019, 04:43 PM   #2
NoteND
Huge Clucker
 
Join Date: May 2016
Posts: 252
Reputation: 5
Default Re: Pos In Water

PHP Code:
if(0.0) return SendClientMessage(playerid, -1"You are in water."); 
Anything under 0 is in water
NoteND is offline   Reply With Quote
Old 31/07/2019, 04:54 PM   #3
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 92
Default Re: Pos In Water

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.
__________________
Lokii is offline   Reply With Quote
Old 31/07/2019, 05:29 PM   #4
OKStyle
High-roller
 
OKStyle's Avatar
 
Join Date: May 2008
Location: Russia, Orenburg Money: GTA$ 999,999,999
Posts: 3,125
Reputation: 142
Default Re: Pos In Water

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;
}
__________________
O.K.Style™ Laboratory
Kalcor: "... it's makes the game look like it's not GTA. This mod is called San Andreas Multiplayer. It's not a custom game engine which you can script..."
OKStyle is offline   Reply With Quote
Old 31/07/2019, 05:47 PM   #5
xRadical3
Gangsta
 
xRadical3's Avatar
 
Join Date: May 2017
Location: Iran
Posts: 546
Reputation: 20
Default Re: Pos In Water

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.
xRadical3 is offline   Reply With Quote
Old 01/08/2019, 06:54 AM   #6
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,177
Reputation: 73
Default Re: Pos In Water

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.
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] cp in water Luca12 Scripting Help 3 24/05/2014 07:42 AM
Is here above water. audriuxxx Scripting Help 2 03/05/2014 08:43 PM
Water IDs KaliKs Everything and Nothing 2 17/04/2014 07:25 PM
Die when you in the water KickInTheMick Scripting Help 6 11/06/2013 11:52 AM
Water help megamind2067 Scripting Help 1 27/01/2013 08:35 PM


All times are GMT. The time now is 03:22 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.