Progress Bar help with timer -
Xenforox - 30.04.2014
So i know how to create a progress bar but i want to know how to make it load in like 30 seconds.
Re: Progress Bar help with timer -
rangerxxll - 30.04.2014
Specify an example please? You just want a timer and have it load in 30 seconds?
Re: Progress Bar help with timer -
Xenforox - 30.04.2014
No, i mean i want to make a /rob command so when you do /rob, you get a progress bar that load for 30sec.
Re: Progress Bar help with timer -
AphexCCFC - 30.04.2014
Top of game mode:
pawn Код:
new ShowProgressBar[MAX_PLAYERS];
new ProgressTime[MAX_PLAYERS];
Where rest of public callbacks are:
pawn Код:
forward ShowProgress(playerid);
pawn Код:
public ShowProgress(playerid)
{
// Display progress bar to show for player here
if(ProgressTime[playerid] > 0)
{
ProgressTime[playerid] --;
}
if(ProgressTime[playerid] < 1)
{
// Hide the progress bar text draw for player here
ProgressTime[playerid] = 0;
KillTimer(ShowProgressBar[playerid]);
}
return 1;
}
Put this in your /rob command:
pawn Код:
ProgressTime[playerid] = 30;
ShowProgressBar[playerid] = SetTimerEx("ShowProgress", 60000, true, "i", playerid);
Re: Progress Bar help with timer -
rangerxxll - 30.04.2014
Quote:
Originally Posted by Xenforox
No, i mean i want to make a /rob command so when you do /rob, you get a progress bar that load for 30sec.
|
To be completely honest with you, I've never attempted such a thing. But if I were to attempt it I'd start by creating a "Main timer". Once the main timer is called, it will create another timer that loops every second or so, updating the progress bar each loop.
So if I were you, I'd create the main timer of 31 second and the second timer inside the main timer that repeats every second, updating the progress bar. (If there's an easier way someone please correct me.)
Re: Progress Bar help with timer -
AphexCCFC - 30.04.2014
Quote:
Originally Posted by rangerxxll
To be completely honest with you, I've never attempted such a thing. But if I were to attempt it I'd start by creating a "Main timer". Once the main timer is called, it will create another timer that loops every second or so, updating the timer each loop.
So if I were you, I'd create the main timer of 31 second and the second timer inside the main timer that repeats every seconds, updating the progress bar. (If there's an easier way someone please correct me.)
|
That is a very bad idea, only need one timer and no loop as done above.
Re: Progress Bar help with timer -
rangerxxll - 30.04.2014
Quote:
Originally Posted by AphexCCFC
That is a very bad idea, only need one timer and no loop as done above.
|
I actually just thought it through and noticed that you can update it every time the timer is called. Thanks for the correction.
EDIT: After reading through your code, I don't see where the progress bar gradually updates.
Re: Progress Bar help with timer -
Xenforox - 30.04.2014
Quote:
Originally Posted by AphexCCFC
Top of game mode:
pawn Код:
new ShowProgressBar[MAX_PLAYERS];
Where rest of public callbacks are:
pawn Код:
forward ShowProgress(playerid);
pawn Код:
public ShowProgress(playerid) { // Display progress bar to show for player here return 1; }
Put this in your /rob command:
pawn Код:
ShowProgressBar[playerid] = SetTimerEx("ShowProgress", 30000, false, "i", playerid); // Sets timer for 30 seconds
|
I think you missunderstood me, I mean when i do /rob, the progress bar show up and start loading then after 30sec it dissappear.
Re: Progress Bar help with timer -
rangerxxll - 30.04.2014
Quote:
Originally Posted by Xenforox
I think you missunderstood me, I mean when i do /rob, the progress bar show up and start loading then after 30sec it dissappear.
|
Follow my advice. I'm not too sure if there's another way to do it.
Re: Progress Bar help with timer -
AphexCCFC - 30.04.2014
Edited my code above, misread first of all sorry