• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] [SOLVED] How users can fishing anywhere as long as there is water everywhere.
#1
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]
  Reply
#2
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.");
    }
  Reply
#3
(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!
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply
#4
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
  Reply
#5
(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?
  Reply
#6
(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??
  Reply
#7
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(playeridxyz);

? ? 
// Will not work near the dam
? ? if(0.0 && FISH_THRESHOLD)
? ? {
? ? ? ? for(new 
04i)
? ? ? ? {
? ? ? ? ? ? 
cx x  (WATER_CHECK_RADIUS floatsin(-angledegrees));
? ? ? ? ? ? 
cy y  (WATER_CHECK_RADIUS floatcos(-angledegrees));
? ? ? ? ? ? 
angle 90.0;

? ? ? ? ? ? 
MapAndreas_FindZ_For2DCoord(cxcycz);

? ? ? ? ? ? 
// 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.");
    } 
  Reply
#8
(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(playeridxyz);



? ? 
// Will not work near the dam

? ? if(0.0 && FISH_THRESHOLD)

? ? {

? ? ? ? for(new 
04i)

? ? ? ? {

? ? ? ? ? ? 
cx x  (WATER_CHECK_RADIUS floatsin(-angledegrees));

? ? ? ? ? ? 
cy y  (WATER_CHECK_RADIUS floatcos(-angledegrees));

? ? ? ? ? ? 
angle 90.0;



? ? ? ? ? ? 
MapAndreas_FindZ_For2DCoord(cxcycz);



? ? ? ? ? ? 
// 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/blo...ndreas.inc
  Reply
#9
(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 :)
  Reply
#10
Thanks sir.

SOLVED
  Reply
#11
(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/blo...ndreas.inc



mapAndreas and colandreas are 2 different plugins
  Reply
#12
sorry sir it looks like you should add a #define <mapAndreas> tag at the beginning of the discussion.
  Reply


Forum Jump: