21.01.2013, 20:01
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(playerid, params[])
{
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(playerid, params[])
{
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;
}