07.01.2012, 03:48
First off, i'd like to say i'm sorry about the title, i couldn't think how to describe it.
Alright, so i made a timer, so when i type /plantseeds, each minute that goes by, the GramAmount increases by one. So lets say it passed 1 minute since i planted it, it will be 1, if its 2 minutes, the grams will be 2, and so forth.
Now, i need to figure out how to "Simplify" this because i don't want several lines of uselessness on my script.
The timer starts when i plant the seeds, and this is the public timer:
Now, instead of doing if(GramAmount == *something*) i want it to be shorter so that as it increases, after one minute, it will increase once again, and so forth, until it reaches 45 ((*define MAX_GRAMS 45)).
If this is possible, please show me how to do it. If generous enough, i'd love it if you fixed it.
((If you need anything else, such as the commands, /plantseeds, etcetra, please tell me))
Thanks in advance,
Beginning Scripter =>KurtBag<=
Alright, so i made a timer, so when i type /plantseeds, each minute that goes by, the GramAmount increases by one. So lets say it passed 1 minute since i planted it, it will be 1, if its 2 minutes, the grams will be 2, and so forth.
Now, i need to figure out how to "Simplify" this because i don't want several lines of uselessness on my script.
The timer starts when i plant the seeds, and this is the public timer:
pawn Код:
public GrowingPeriod(playerid)
{
if(GramAmount == 0)
{
GramAmount = 1;
SetTimerEx("GrowingPeriod", 60000, false, "i", playerid);
}
if(GramAmount == 1)
{
GramAmount = 2;
SetTimerEx("GrowingPeriod", 60000, false, "i", playerid);
}
if(GramAmount == 2)
{
GramAmount = 3;
SetTimerEx("GrowingPeriod", 60000, false, "i", playerid);
}
if(GramAmount == 3)
{
GramAmount = 4;
SetTimerEx("GrowingPeriod", 60000, false, "i", playerid);
}
if(GramAmount == 4)
{
GramAmount = 5;
SetTimerEx("GrowingPeriod", 60000, false, "i", playerid);
}
if(GramAmount == 5)
{
GramAmount = 6;
SetTimerEx("GrowingPeriod", 60000, false, "i", playerid);
}
return 1;
}
If this is possible, please show me how to do it. If generous enough, i'd love it if you fixed it.
((If you need anything else, such as the commands, /plantseeds, etcetra, please tell me))
Thanks in advance,
Beginning Scripter =>KurtBag<=