Checking if player is near in the 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: Checking if player is near in the water (
/showthread.php?tid=396527)
Checking if player is near in the water -
JaKe Elite - 01.12.2012
I'm creating a fishing system for my upcoming Roleplaying server.
And i need to check if player is near in any water area.
Not only in Fishing places..
I searched and check the [FS] Fishing System but they are only work when the player is in fishing places.
Re: Checking if player is near in the water -
dr.lozer - 01.12.2012
hmmm then you must get all x y z pos near water then use
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0,x,y,z)) SendClientMessage(playerid, -1,"In 1 hour the shark will eat you");
Re: Checking if player is near in the water -
JaKe Elite - 01.12.2012
Is there any way?? Saving all water positions will take like 1 month..
Re: Checking if player is near in the water -
Face9000 - 01.12.2012
Hey pig try this:
pawn Код:
stock IsPlayerInWater(playerid)
{
new lib[16],anim[32];
GetAnimationName(GetPlayerAnimationIndex(playerid), lib, sizeof(lib), anim, sizeof(anim));
if(!strcmp(lib, "SWIM", true) && !isnull(lib)) return 1;
return 0;
}
You don't have to get all water coordinates, just use the swimming animation.
Re: Checking if player is near in the water -
JaKe Elite - 01.12.2012
This will work when player touches the water?
Or only works when player is using the swim animation?
Re: Checking if player is near in the water -
Face9000 - 01.12.2012
It will work when the player starts swimming (using the SWIM animation), so yes, when a player touches the water.
You can use
pawn Код:
if(IsPlayerInRangeOfPoint
by lowering by 10 degrees combined with the script i provided you.