SA-MP Forums Archive
Not in range of point when I am - 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: Not in range of point when I am (/showthread.php?tid=540651)



Not in range of point when I am - Josh_Main - 06.10.2014

I'm creating a drug system and when I type /growweed in-game, it returns "You can only plant weed seeds in the bush across from All Saints General Hospital and the inner skirts of Flint Country by the Flint gas station!", even when I am at these points (standing exactly on the point as well) it still sends me this message.


pawn Код:
CMD:growweed(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 30, 1232.2, -1344.3, 14.13) && IsPlayerInRangeOfPoint(playerid, 400, -395, -1338.3, 25.3))
    {
        if(PlayerStat[playerid][HasWeedSeeds] > 0)
        {
            new string[128], Float:x, Float:y, Float:z,Float:Angle;
            GetPlayerPos(playerid, x,y,z);
            GetPlayerFacingAngle(playerid, Angle);
            CreateObject(playerid, 823, x, y, z, Angle, Angle, Angle);
            format(string, sizeof(string), "%s kneels down and plants some weed seeds.", GetICName(playerid));
            SendNearByMessage(playerid, ACTION_COLOR, string, 6);
            SendClientMessage(playerid, GREEN, "You have planted marijuana bush, please come back later to harvest it!");
            SendClientMessage(playerid, GREEN, "Be careful other players do not take your weed, so keep a close eye on it!");
            PlayerStat[playerid][HasWeedSeeds] = 0;
        }
        else
        {
            SendClientMessage(playerid, GREY, "You don't have any weed seeds!");
        }
    }
    else
    {
         SendClientMessage(playerid, GREY, "You can only plant weed seeds in the bush across from All Saints General Hospital");
         SendClientMessage(playerid, GREY, "and the inner skirts of Flint Country by the Flint gas station!");
    }
    return 1;
}
Please help me, I'm not sure what I'm doing wrong. Thanks!


Re: Not in range of point when I am - highstreetsrp - 06.10.2014

new string[128], Float, Float:y, Float:z,Float:Angle;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, Angle);
CreateObject(playerid, 823, x, y, z, Angle, Angle, Angle);
u didn't add co-ordinates where to plant seed get co-ords add them and than try might fix this issue...


Re: Not in range of point when I am - Evocator - 06.10.2014

Thats wrong;
Код:
if(IsPlayerInRangeOfPoint(playerid, 30, 1232.2, -1344.3, 14.13) && IsPlayerInRangeOfPoint(playerid, 400, -395, -1338.3, 25.3))
You are actually telling "is the player in the first point AND in the second?" which is wrong.
Use the OR statement.

Код:
if(IsPlayerInRangeOfPoint(playerid, 30, 1232.2, -1344.3, 14.13) || IsPlayerInRangeOfPoint(playerid, 400, -395, -1338.3, 25.3))



Re: Not in range of point when I am - Josh_Main - 06.10.2014

Quote:
Originally Posted by highstreetsrp
Посмотреть сообщение
new string[128], Float, Float:y, Float:z,Float:Angle;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, Angle);
CreateObject(playerid, 823, x, y, z, Angle, Angle, Angle);
u didn't add co-ordinates where to plant seed get co-ords add them and than try might fix this issue...
pawn Код:
new string[128], Float:x, Float:y, Float:z,Float:Angle;
            GetPlayerPos(playerid, x,y,z);
            GetPlayerFacingAngle(playerid, Angle);
            CreateObject(playerid, 823, x, y, z, Angle, Angle, Angle);
This code here is getting my position, and creating the object in my position.


Re: Not in range of point when I am - Josh_Main - 06.10.2014

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Thats wrong;
Код:
if(IsPlayerInRangeOfPoint(playerid, 30, 1232.2, -1344.3, 14.13) && IsPlayerInRangeOfPoint(playerid, 400, -395, -1338.3, 25.3))
You are actually telling "is the player in the first point AND in the second?" which is wrong.
Use the OR statement.

Код:
if(IsPlayerInRangeOfPoint(playerid, 30, 1232.2, -1344.3, 14.13) || IsPlayerInRangeOfPoint(playerid, 400, -395, -1338.3, 25.3))
Thanks man! But now I'm it's saying "You don't have any weed seeds!" even after I use the admin command /agiveseeds. I posted it below.

pawn Код:
CMD:agiveseeds(playerid, params[])
{
    new targetid, string[128], amount;
    if(PlayerStat[playerid] [AdminLevel] < 2) return SendClientMessage(playerid, GREY, "You don't have access to this command!");
    if(sscanf(params, "ud", targetid, amount)) return SendClientMessage(playerid, GREY, "USAGE: /agiveseeds [playerid] [amount]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "That player is not connected!");
    else
    {
        PlayerStat[targetid][HasWeed] = amount;
        format(string, sizeof(string), "You have given %s %d weed seed(s)!", GetOOCName(targetid), amount);
        SendClientMessage(playerid, WHITE, string);
        format(string, sizeof(string), "Administrator %s has given you %d weed seeds(s)!", GetOOCName(playerid), amount);
        SendClientMessage(targetid, WHITE, string);
        AdminActionLog(string);
    }
    return 1;
}



Re: Not in range of point when I am - highstreetsrp - 06.10.2014

U didn't added when admin [/agiveweed] ammount of weed added to player's stats