SA-MP Forums Archive
Weed system problem - 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: Weed system problem (/showthread.php?tid=409520)



Weed system problem - Noles2197 - 21.01.2013

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;




Re: Weed system problem - azzerking - 21.01.2013

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))



Re: Weed system problem - Noles2197 - 21.01.2013

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?


Re: Weed system problem - arakuta - 21.01.2013

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.


Re: Weed system problem - Noles2197 - 21.01.2013

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