Weed system problem
#1

When I try to /harvest, it just keeps saying that I'm not in range of the point.

PHP код:
new Weed
new bool:canCropWeed[MAX_PLAYERS] = false
PHP код:
timer weed[30000](playerid)
{
   
canCropWeed[playerid] = true;
}
CMD:plant(playeridparams[])
{
    if(
PlayerInfo[playerid][pSeeds] > 2)
    {
        new 
Float:x,Float:y,Float:z;
        
GetPlayerPos(playerid,x,y,z);
        
SendClientMessage(playerid,GRAY,"Your plant will be ready in an hour.");
        
Weed CreateObject(19473,x,y,z-2,0,0,0);
        
PlayerInfo[playerid][pSeeds]-=3;
        
defer weed(playerid);
    }
    else
    
SendClientMessage(playerid,GRAY,"You don't have enough seeds!");
    return 
1;
}
CMD:harvest(playeridparams[])
{
    if(
canCropWeed[playerid])
    {
        new 
Float:x,Float:y,Float:z;
        
GetPlayerObjectPos(playerid,Weed,x,y,z);
        if(
IsPlayerInRangeOfPoint(playerid,1,x,y,z))
        {
               
SendClientMessage(playerid,GRAY,"You've harvested 9 grams of Marijuana.");
            
PlayerInfo[playerid][pMarijuana]+=9;
            
DestroyObject(Weed);
        }
        else
        
SendClientMessage(playerid,GRAY,"You're not in range of your plant!");
    }
    else
    
SendClientMessage(playerid,GRAY,"This isn't ready to harvest!");
    return 
1;

Reply
#2

Change This to 7 and try and see if you can harvest it, if not then the Weed object is wrong.
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,1,x,y,z))
Copy Code
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,7,x,y,z))
Reply
#3

If I take off the

pawn Код:
if(IsPlayerInRangeOfPoint(playerid,1,x,y,z))
It will destroy the weed object. Checking if the player is in range of the point is what's messing it up. Can someone tell me how to fix this issue?
Reply
#4

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Copy Code
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,7,x,y,z))
You did this? 1 is very close dude. Increase the range.
Reply
#5

Yes, I've done that, but I'm still out of range.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)