Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] [SOLVED] How users can fishing anywhere as long as there is water everywhere.

 
  • 0 Vote(s) - 0 Average
Pawn [SOLVED] How users can fishing anywhere as long as there is water everywhere.
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#1
2021-04-18, 04:43 AM (This post was last modified: 2021-04-19, 08:18 AM by PutuSuhartawan.)
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+2);



//CreateDynamicObject(18717+2, BBCoord[0]+3, 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]
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#2
2021-04-18, 07:42 AM (This post was last modified: 2021-04-18, 07:44 AM by Radical.)
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.");
    }
Pinch
Offline

Burgershot Member
Posts: 391
Threads: 19
Joined: Apr 2019
Reputation: 22
Location: Belgrade, Serbia
#3
2021-04-18, 02:57 PM
(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.
AbyssMorgan
Offline

Burgershot Member
Posts: 63
Threads: 25
Joined: Apr 2021
Reputation: 8
Location: Poland
#4
2021-04-18, 03:19 PM
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
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#5
2021-04-18, 10:34 PM
(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?
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#6
2021-04-18, 10:58 PM (This post was last modified: 2021-04-18, 10:59 PM by PutuSuhartawan.)
(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 ?
arber
Offline

Burgershot Member
Posts: 11
Threads: 0
Joined: Aug 2020
Reputation: 1
Location: Kosovo
#7
2021-04-18, 11:17 PM (This post was last modified: 2021-04-18, 11:21 PM by arber.)
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.");
    } 
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#8
2021-04-19, 02:26 AM (This post was last modified: 2021-04-19, 02:28 AM by PutuSuhartawan.)
(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
AbyssMorgan
Offline

Burgershot Member
Posts: 63
Threads: 25
Joined: Apr 2021
Reputation: 8
Location: Poland
#9
2021-04-19, 05:26 AM
(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 :)
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#10
2021-04-19, 08:10 AM
Thanks sir.
SOLVED
arber
Offline

Burgershot Member
Posts: 11
Threads: 0
Joined: Aug 2020
Reputation: 1
Location: Kosovo
#11
2021-04-19, 11:40 PM
(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
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#12
2021-04-20, 03:46 PM
sorry sir it looks like you should add a #define <mapAndreas> tag at the beginning of the discussion.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode