open.mp forum
[Pawn] [SOLVED] How users can fishing anywhere as long as there is water everywhere. - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] [SOLVED] How users can fishing anywhere as long as there is water everywhere. (/showthread.php?tid=1896)



[SOLVED] How users can fishing anywhere as long as there is water everywhere. - PutuSuhartawan - 2021-04-18

SOLUTION with?Radical?Pinch?AbyssMorgan?arber:

?
Code:
#include <progress2> [/font][/size][/color] #include <foreach>// color with string #include <3DTryg> #include <colandreas> // the variabel meaning of water object #define? ? ? ? FISH_THRESHOLD? ? ? ? ? ? 3.0 #define? ? ? ? WATER_CHECK_RADIUS? ? ? ? 15.0 IsPlayerNearWater(playerid) { ? ? new Float:x, Float:y, Float:z, Float:cx, Float:cy, Float:cz, Float:angle; ? ? GetPlayerPos(playerid, x, y, z); ? ? // Will not work near the dam ? ? if(z > 0.0 && z < FISH_THRESHOLD) ? ? { ? ? ? ? for(new i = 0; i < 4; i) ? ? ? ? { ? ? ? ? ? ? cx = x (WATER_CHECK_RADIUS * floatsin(-angle, degrees)); ? ? ? ? ? ? cy = y (WATER_CHECK_RADIUS * floatcos(-angle, degrees)); ? ? ? ? ? ? angle = 90.0; ? ? ? ? ? ? CA_FindZ_For2DCoord(cx, cy, cz); ? ? ? ? ? ? // Doesn't work under bridges ? ? ? ? ? ? if(cz == 0.0) return 1; ? ? ? ? } ? ? } ? ? return 0; } CMD:fish(playerid, params[]) { if (IsPlayerNearWater(playerid)) //if(IsPlayerInRangeOfPoint(playerid, 100.0, 1062.4270,-2567.9729,-0.5079)) // lokasi mancing { ? ? ? ? if(WormAttached[playerid] < 1) return SendClientMessage(playerid, COLOR_LIGHTRED, ""COL_LIGHTBLUE"FISH: "COL_WHITE"Sir sorry you need to have a bait worm attached to the fishing rod to fish with"COL_YELLOW"'/attachworm'"); ? ? ? ? if(FishingEquipped[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to have your fishing rod equipped."); ? ? ? ? if(Fishing[playerid] == true) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are already fishing."); ? ? ? ? if(pInfo[playerid][pFishes] > 5) ? ? { ? ? SendClientMessage(playerid, COLOR_LGREEN, ""COL_LIGHTBLUE"FISH: "COL_WHITE"Please the fish the on sale first with "COL_YELLOW"'/sellfish'"); ? ? cmd_fishingrod(playerid); ? ? ApplyAnimation(playerid, "PED", "idle_taxi", 4.0, 0, 1, 1, 1, -1, 1); ? ? return 1; ? ? } ? new string[140]; format(string, sizeof(string), "* %s begins to fish with his fishing rod.", GetRPName(playerid)); LocalMessage(ACTION_DISTANCE, playerid, ACTION_COLOR, string); ? fish[playerid] = 2; //change it with the timer time ? new Float:BBCoord[4]; ? ? GetPlayerPos(playerid, BBCoord[0], BBCoord[1], BBCoord[2]); ? ? GetPlayerFacingAngle(playerid, BBCoord[3]); EfekPancingan[playerid] = SpawnObject_InfrontOfPlayer(playerid, 18717); //CreateDynamicObject(18717, BBCoord[0], BBCoord[1], BBCoord[2]-2.4, 0.0, 0.0, 0.0, 0,? 0); ? ? TimerFish[playerid] = SetTimerEx("timerFish", 1000, 1, "i", playerid); ? ? TogglePlayerControllable(playerid, 0); ? ? WormAttached[playerid] = 0; ? ? ApplyAnimation(playerid, "ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1, 1); ? ? Fishing[playerid] = true; ? ? } else return SendClientMessage(playerid, COLOR_RED, "You can't sir fishing here with out river ."); ? return 1; }











THE PROBLEM:



Code:
i just know IsPlayerInRangeOfPoint, if (IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) ? ? { ? ? ? ? SendClientMessage(playerid,0xFFFFFFFF,"Need around water area to fishing"); ? ? } [color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif][color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]
[/font][/size][/color]


RE: Help! How The way users can fishing anywhere as long as there is water ? - Radical - 2021-04-18

Code:
IsPlayerInWater(playerid) { if(GetPlayerAnimationIndex(playerid) >= 1538 && GetPlayerAnimationIndex(playerid) <= 1543) return 1; return 0; }

Code:
if (IsPlayerInWater(playerid)) { SendClientMessage(playerid,-1,"You have to be in the water to fishing."); }



RE: Help! How The way users can fishing anywhere as long as there is water ? - Pinch - 2021-04-18

(2021-04-18, 07:42 AM)Radical Wrote:
Code:
IsPlayerInWater(playerid) { if(GetPlayerAnimationIndex(playerid) >= 1538 && GetPlayerAnimationIndex(playerid) <= 1543) return 1; return 0; }



Code:
if (IsPlayerInWater(playerid)) { SendClientMessage(playerid,-1,"You have to be in the water to fishing."); }

THIS DOESN'T MAKE ANY SENSE-

BRO-



Topic: Use ColAndreas!


RE: Help! How The way users can fishing anywhere as long as there is water ? - AbyssMorgan - 2021-04-18

If you use 3DTryg.inc ColAndreas plugin

Code:
if(Item::IsPointInWaterOrient(playerid,item_player,3.0,o_front)){ //water in 3 m of player front }

https://www.burgershot.gg/showthread.php?tid=1898


RE: Help! How The way users can fishing anywhere as long as there is water ? - PutuSuhartawan - 2021-04-18

(2021-04-18, 07:42 AM)Radical Wrote:
Code:
IsPlayerInWater(playerid) { if(GetPlayerAnimationIndex(playerid) >= 1538 && GetPlayerAnimationIndex(playerid) <= 1543) return 1; return 0; }



Code:
if (IsPlayerInWater(playerid)) ? ? { ? ? ? ? SendClientMessage(playerid,-1,"You have to be in the water to fishing."); ? ? }



Forgive me. Sir, where does this included come from? May I know the name of the include that provides the IsPlayerInWater function?


RE: Help! How The way users can fishing anywhere as long as there is water ? - PutuSuhartawan - 2021-04-18

(2021-04-18, 03:19 PM)AbyssMorgan Wrote: If you use 3DTryg.inc ColAndreas plugin

Code:
if(Item::IsPointInWaterOrient(playerid,item_player,3.0,o_front)){ //water in 3 m of player front }

https://www.burgershot.gg/showthread.php?tid=1898



i has?

#include <3DTryg>

#include <colandreas>

error 017: undefined symbol "IsPointInWaterFrontOfPlayer"

error 017: undefined symbol "Item_IsPointInWaterOrient"



Sir, sorry i dont know what was? include need too??


RE: Help! How The way users can fishing anywhere as long as there is water ? - arber - 2021-04-18

PHP Code:
#define? ? ? ? FISH_THRESHOLD? ? ? ? ? ? 3.0 #define? ? ? ? WATER_CHECK_RADIUS? ? ? ? 5.0 IsPlayerNearWater(playerid) { ? ? new Float:x, Float:y, Float:z, Float:cx, Float:cy, Float:cz, Float:angle; ? ? GetPlayerPos(playerid, x, y, z); ? ? // Will not work near the dam ? ? if(z > 0.0 && z < FISH_THRESHOLD) ? ? { ? ? ? ? for(new i = 0; i < 4; i) ? ? ? ? { ? ? ? ? ? ? cx = x (WATER_CHECK_RADIUS * floatsin(-angle, degrees)); ? ? ? ? ? ? cy = y (WATER_CHECK_RADIUS * floatcos(-angle, degrees)); ? ? ? ? ? ? angle = 90.0; ? ? ? ? ? ? MapAndreas_FindZ_For2DCoord(cx, cy, cz); ? ? ? ? ? ? // Doesn't work under bridges ? ? ? ? ? ? if(cz == 0.0) return 1; ? ? ? ? } ? ? } ? ? return 0; }

PHP Code:
if (IsPlayerNearWater(playerid)) { SendClientMessage(playerid,-1,"You have to near water to start fishing."); }



RE: Help! How The way users can fishing anywhere as long as there is water ? - PutuSuhartawan - 2021-04-19

(2021-04-18, 11:17 PM)arber Wrote:
PHP Code:
#define? ? ? ? FISH_THRESHOLD? ? ? ? ? ? 3.0 #define? ? ? ? WATER_CHECK_RADIUS? ? ? ? 5.0 IsPlayerNearWater(playerid) { ? ? new Float:x, Float:y, Float:z, Float:cx, Float:cy, Float:cz, Float:angle; ? ? GetPlayerPos(playerid, x, y, z); ? ? // Will not work near the dam ? ? if(z > 0.0 && z < FISH_THRESHOLD) ? ? { ? ? ? ? for(new i = 0; i < 4; i) ? ? ? ? { ? ? ? ? ? ? cx = x (WATER_CHECK_RADIUS * floatsin(-angle, degrees)); ? ? ? ? ? ? cy = y (WATER_CHECK_RADIUS * floatcos(-angle, degrees)); ? ? ? ? ? ? angle = 90.0; ? ? ? ? ? ? MapAndreas_FindZ_For2DCoord(cx, cy, cz); ? ? ? ? ? ? // Doesn't work under bridges ? ? ? ? ? ? if(cz == 0.0) return 1; ? ? ? ? } ? ? } ? ? return 0; }



PHP Code:
if (IsPlayerNearWater(playerid)) ? ? { ? ? ? ? SendClientMessage(playerid,-1,"You have to near water to start fishing."); ? ? }



Update your include sir, has changed new one to?CA_FindZ_For2DCoord

https://github.com/Pottus/ColAndreas/blob/master/Server/include/colandreas.inc


RE: Help! How The way users can fishing anywhere as long as there is water ? - AbyssMorgan - 2021-04-19

(2021-04-18, 10:58 PM)PutuSuhartawan Wrote:
(2021-04-18, 03:19 PM)AbyssMorgan Wrote: If you use 3DTryg.inc ColAndreas plugin

Code:
if(Item::IsPointInWaterOrient(playerid,item_player,3.0,o_front)){ //water in 3 m of player front }

https://www.burgershot.gg/showthread.php?tid=1898



i has?

#include <3DTryg>

#include <colandreas>

error 017: undefined symbol "IsPointInWaterFrontOfPlayer"

error 017: undefined symbol "Item_IsPointInWaterOrient"



Sir, sorry i dont know what was? include need too??



You need include colandreas before 3Dtryg :)


RE: Help! How The way users can fishing anywhere as long as there is water ? - PutuSuhartawan - 2021-04-19

Thanks sir.

SOLVED


RE: Help! How The way users can fishing anywhere as long as there is water ? - arber - 2021-04-19

(2021-04-19, 02:26 AM)PutuSuhartawan Wrote: Update your include sir, has changed new one to?CA_FindZ_For2DCoord

https://github.com/Pottus/ColAndreas/blob/master/Server/include/colandreas.inc



mapAndreas and colandreas are 2 different plugins


RE: [SOLVED] How users can fishing anywhere as long as there is water everywhere. - PutuSuhartawan - 2021-04-20

sorry sir it looks like you should add a #define <mapAndreas> tag at the beginning of the discussion.