Is object 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: Is object in water. (
/showthread.php?tid=459915)
Is object in water. -
audriuxxx - 25.08.2013
Hi,
It's possible to check is object in water?
Re: Is object in water. -
doreto - 25.08.2013
no you can't but you can create zones where is water and check if object is in that zone
Re: Is object in water. -
Dragonsaurus - 25.08.2013
Or just check if the Z coordinate is negative.
E.g:
pawn Код:
CMD:check(playerid, params[])
{
new Float:x, Float:y, Float:z, maxobjects, string[256], count = 0;
maxobjects = CreateObject(1234, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
DestroyObject(maxobjects);
for(new i = 0; i < maxobjects-1; i++)
{
GetObjectPos(i, x, y, z);
if(z < 0.0) count++;
}
format(string, sizeof(string), "Underwater Objects: %d.", count);
SendClientMessage(playerid, -1, string);
return 1;
}
Re: Is object in water. -
audriuxxx - 25.08.2013
Where i can find zones where is water? because i have that system player can throw object, and i want to do when object reach the point, then check is object in water, but not using Z, because Z coordinate will be always the same. I want to do, object can be very high don't care, but if water exist when you look down.
Re: Is object in water. -
Cypress - 25.08.2013
Quote:
Originally Posted by audriuxxx
Where i can find zones where is water? because i have that system player can throw object, and i want to do when object reach the point, then check is object in water, but not using Z, because Z coordinate will be always the same. I want to do, object can be very high don't care, but if water exist when you look down.
|
What? It makes no sense.
What people are saying above is you can make transparent zones wherever water is and then check if player is in that zone which means he is in water zone according to your wishes. Either way, use Z and it's not always the same.