Help with timers..
#1

So guys, I'm making a script about weed, its marijuanas growth, seeds, plants and other, but there is one problem.When i plant seed, i get 1 timer for it, but when i plant again, that same timer that i had for 1 plant interrupts both plants(sry for bad eng)
so here is the script guys, hopu u understand me and help :/

Код:
public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Marijuana Test");
	
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}
CMD:plantweed(playerid, params[])
{
   if(WeedSeed1 >=1)
   {
	GetPlayerPos(playerid, x, y, z);
	WeedPlant1 = CreatePlayerObject(playerid, 19473, x, y, z-1.5, 0.0, 0.0, 0.0, 96.0);
	SendClientMessage(playerid, COLOR_GREEN, "Uspjesno si posadio marihuanu."); //Sucesfully Planted
	return 1;
   }
   else
   {
    SendClientMessage(playerid, COLOR_RED, "Nemas sjemenki."); //If seeds = 0
    return 1;
   }
	
}
CMD:waterweed(playerid, params[])
{
   GetObjectPos(WeedPlant1, x, y, z);
   SetTimer("WeedGrowth1", 10000, 0); //So here is the deal, I need new timer for every plant, but idk how to make it
   SendClientMessage(playerid, COLOR_GREEN, "Uspjesno si zalio marihuanu.");
   return 1;
}
CMD:harvestweed(playerid, params[])
{
   Weed = Urod1 + Weed;
   DestroyPlayerObject(playerid, WeedPlant1);
   format(string1, sizeof(string1), "Dobio si %d g marihuane.", Urod1);
   SendClientMessage(playerid, COLOR_GREEN, string1);
   return 1;
}

public WeedGrowth1(playerid)
{
   MovePlayerObject(playerid, WeedPlant1, x, y, z+1.0, 0.01, 0.0, 0.0, 0.0);//what timer does
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)