Detecting if boat is out of water ( on shore )
#1

I've created this topic to discuss the ways how to detect if the boat is out of the water.
Here are ways that did think of:

1. Checking health changes ( partly works ) but when it is out, it doesn't take damage anymore, even if it is moving.
2. Checking Z coordinate ( Doesn't work ( waves can create issues here ))
3. Map Andreas will FAIL on custom maps.

Any ideas are welcome.
Thanks for help in advance.
Reply
#2

Map Andreas can be used for this. It will return the z position when x an y are given. Basically it knows when you are on sea level or not.
It was created by Kalcor himself. Check it out at: https://sampforum.blast.hk/showthread.php?tid=120013
Reply
#3

Quote:
Originally Posted by HeLiOn_PrImE
Посмотреть сообщение
Map Andreas can be used for this. It will return the z position when x an y are given. Basically it knows when you are on sea level or not.
It was created by Kalcor himself. Check it out at: https://sampforum.blast.hk/showthread.php?tid=120013
I wanted to bring this on @ main post, that this will fail terribly on custom maps.
Reply
#4

PHP код:

    stock IsPlayerInWater
(playerid)
    {
    new 
Float:x,Float:y,Float:pz;
    
GetPlayerPos(playerid,x,y,pz);
    if ((
IsPlayerInArea(playerid2032.13711841.26561703.16531467.1099) && pz <= 9.0484)
    || (
IsPlayerInArea(playerid2109.07252065.82321962.535510.8547) && pz <= 10.0792)
    || (
IsPlayerInArea(playerid, -492.5810, -1424.71222836.82842001.8235) && pz <= 41.06)
    || (
IsPlayerInArea(playerid, -2675.1492, -2762.1792, -413.3973, -514.3894) && pz <= 4.24)
    || (
IsPlayerInArea(playerid, -453.9256, -825.7167, -1869.9600, -2072.8215) && pz <= 5.72)
    || (
IsPlayerInArea(playerid1281.02511202.2368, -2346.7451, -2414.4492) && pz <= 9.3145)
    || (
IsPlayerInArea(playerid2012.61541928.9028, -1178.6207, -1221.4043) && pz <= 18.45)
    || (
IsPlayerInArea(playerid2326.48582295.7471, -1400.2797, -1431.1266) && pz <= 22.615)
    || (
IsPlayerInArea(playerid2550.04542513.75881583.37511553.0753) && pz <= 9.4171)
    || (
IsPlayerInArea(playerid1102.36341087.3705, -663.1653, -682.5446) && pz <= 112.45)
    || (
IsPlayerInArea(playerid1287.79061270.4369, -801.3882, -810.0527) && pz <= 87.123)
    || (
pz 1.5)
    )
    {
    return 
1;
    }
    return 
0;
    } 
Reply
#5

Quote:
Originally Posted by angelxeneize
Посмотреть сообщение
PHP код:

    stock IsPlayerInWater
(playerid)
    {
    new 
Float:x,Float:y,Float:pz;
    
GetPlayerPos(playerid,x,y,pz);
    if ((
IsPlayerInArea(playerid2032.13711841.26561703.16531467.1099) && pz <= 9.0484)
    || (
IsPlayerInArea(playerid2109.07252065.82321962.535510.8547) && pz <= 10.0792)
    || (
IsPlayerInArea(playerid, -492.5810, -1424.71222836.82842001.8235) && pz <= 41.06)
    || (
IsPlayerInArea(playerid, -2675.1492, -2762.1792, -413.3973, -514.3894) && pz <= 4.24)
    || (
IsPlayerInArea(playerid, -453.9256, -825.7167, -1869.9600, -2072.8215) && pz <= 5.72)
    || (
IsPlayerInArea(playerid1281.02511202.2368, -2346.7451, -2414.4492) && pz <= 9.3145)
    || (
IsPlayerInArea(playerid2012.61541928.9028, -1178.6207, -1221.4043) && pz <= 18.45)
    || (
IsPlayerInArea(playerid2326.48582295.7471, -1400.2797, -1431.1266) && pz <= 22.615)
    || (
IsPlayerInArea(playerid2550.04542513.75881583.37511553.0753) && pz <= 9.4171)
    || (
IsPlayerInArea(playerid1102.36341087.3705, -663.1653, -682.5446) && pz <= 112.45)
    || (
IsPlayerInArea(playerid1287.79061270.4369, -801.3882, -810.0527) && pz <= 87.123)
    || (
pz 1.5)
    )
    {
    return 
1;
    }
    return 
0;
    } 
How is that supposed to work apox. 5000m in sea with mapped objects?
Reply
#6

you need this
Quote:

IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
new Float:X, Float:Y, Float:Z;

GetPlayerPos(playerid, X, Y, Z);
if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
return 1;
}
return 0;
}

Reply
#7

Quote:
Originally Posted by angelxeneize
Посмотреть сообщение
you need this
Do you even read what I write?
If yes, please explain how is that going to work out of San Andreas borders? In sea?


Off topic:
What is the limit of Incognito's streamer areas?
If I attached sphere area, using ******'s objects radius include, and detecting if boat has entered the area?
Oh well, but that would consume a lot of memory...
Reply
#8

if custom maps are a problem, you should constantly check if the boat is above 1 m altitude AND check if it receives damage. If the boat receives damage, but it's below 1 m, there's a high chance to be just a collision made with an object or vehicle. If the boat is above 1 m and is receiving damage, the boat might be on shore. You can add more rules on this regarding the area, because I know that there are places on the map below the sea level, and not flooded with water.
Reply
#9

Quote:
Originally Posted by HeLiOn_PrImE
Посмотреть сообщение
if custom maps are a problem, you should constantly check if the boat is above 1 m altitude AND check if it receives damage. If the boat receives damage, but it's below 1 m, there's a high chance to be just a collision made with an object or vehicle. If the boat is above 1 m and is receiving damage, the boat might be on shore. You can add more rules on this regarding the area, because I know that there are places on the map below the sea level, and not flooded with water.
As stated above, that can't be checked since of waves, especially because I intend to use SetWaveHeight from sa-mp+ plugin.
As well, land can be less than 1m in altitude.
Reply
#10

Quote:
Originally Posted by [WSF]ThA_Devil
Посмотреть сообщение
As stated above, that can't be checked since of waves, especially because I intend to use SetWaveHeight from sa-mp+ plugin.
As well, land can be less than 1m in altitude.
What plugin is that? As far as I knew, so far, such thing still is impossible in samp.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)