Help With /plant
#1

I have some problem, when I used /plant much, the last plant can pickup, but other can't, why ?

This is my script

CMD:plant(playerid, params[])
{
if(PlantInfo[playerid][Seeds] >= 1)
{
#pragma unused marijuana
new Float:x, Float:y, Float:z, Float:a, str[150], str2[120], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
plants[playerid] = CreateDynamicObject(3409, x, y, z-1.5, 0.0, 0.0, a + 90);
fresh = CreateDynamicCP(x, y, z, 1.0, -1, -1, -1, 1.5);
PlantInfo[playerid][Seeds] --;
Check[playerid] = 1;
matang[playerid] = 1;
format(str2, sizeof(str2), "Plant\nOwner Plant : %s\nPickup : No", name);
lol = Create3DTextLabel(str2, 0xFFFF00FF, x, y, z, 10, 0);
format(str, sizeof(str), "You've planted one seed! ( %i seeds left )", PlantInfo[playerid][Seeds]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
new INI:file = INI_Open(PlantPath(playerid));
INI_SetTag(file, "Player's Data");
INI_WriteInt(file, "Seeds", PlantInfo[playerid][Seeds]);
INI_WriteString(file, "Names", name);
INI_Close(file);
marijuana = SetTimer("GrowingTimer", 1000, 0);
}
else return SendClientMessage(playerid, -1, "You don't have any seed now, buy them ! ( /buyseed )");
return 1;
}

forward GrowingTime(playerid);
public GrowingTime(playerid)
{
for(new i = 0; i < 50; i++)
{
if(Check[i] == 1 && matang[i] < 100)
{
matang[i] ++;
if(Check[i] == 1 && matang[i] == 100)
{
new str[150], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "Plant\nOwner Plant : %s\nPickup : Yes", name);
Update3DTextLabelText(lol, 0xFFFF00FF, str);
Check[i] = 0;
}
}
}
return 1;
}

Sorry for my bad english..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)