SA-MP Forums Archive
Progress Bar - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Progress Bar (/showthread.php?tid=350380)



Progress Bar - Sanady - 12.06.2012

Hello everybody.Can someone explain me better this progress bar?? please.Thanks


Re: Progress Bar - zombieking - 12.06.2012

What you didn't understand? Be more specific

pawn Код:
This forum requires that you wait 120 seconds between posts. Please try again in 66 seconds.
- This is killing me -.-


Re: Progress Bar - Sanady - 12.06.2012

Quote:
Originally Posted by zombieking
Посмотреть сообщение
What you didn't understand? Be more specific

pawn Код:
This forum requires that you wait 120 seconds between posts. Please try again in 66 seconds.
- This is killing me -.-
How to set up the timers and principle how is working.


Re: Progress Bar - zombieking - 12.06.2012

How to create a timer:

pawn Код:
forward Timer();
public OnGameModeInit()
{
SetTimer("Timer",interval,repeat?);
return 1;
}
public Timer()
{
 // Timer function code here...



Re: Progress Bar - Sanady - 14.06.2012

Quote:
Originally Posted by zombieking
Посмотреть сообщение
How to create a timer:

pawn Код:
forward Timer();
public OnGameModeInit()
{
SetTimer("Timer",interval,repeat?);
return 1;
}
public Timer()
{
 // Timer function code here...
I mean how to create that progress bar to work...better explains


Re: Progress Bar - ReneG - 14.06.2012

Read the damn thread. The author explains how to use it in code examples.


Re: Progress Bar - Sanady - 14.06.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Read the damn thread. The author explains how to use it in code examples.
Look.I read that topic 3 times.But I don`t understand that codes.


Re: Progress Bar - Jonny5 - 14.06.2012

well you have

SetProgressBarValue to set the value and
UpdateProgressBar to update the value.
so as the timer runs you can increase the progress each time,
use GetProgressBarValue to check for 100%




so heres the code example
pawn Код:
//to start the timer for a bar
    SetTimerEx("ProgressTimer",interval,false,"ii",barid,interval);

forward ProgressTimer(barid,interval);
public ProgressTimer(barid,interval)
{
    Float:lPBarVal = GetProgressBarValue(barid);
    if (lPBarVal < 100.0)
    {
        SetProgressBarValue(barid, lPBarVal+10.0)
        UpdateProgressBar(barid);
        SetTimerEx("ProgressTimer",interval,false,"i",barid);
    }
    return 1;
}
now i did not account for allot like INVALID_BAR_ID, for that you should read the progress bar topic,
also i never used that include so did not test this code, its only an example.
I gathered all the info from that topic and the wiki just now.


Re: Progress Bar - Sanady - 14.06.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
well you have

SetProgressBarValue to set the value and
UpdateProgressBar to update the value.
so as the timer runs you can increase the progress each time,
use GetProgressBarValue to check for 100%




so heres the code example
pawn Код:
//to start the timer for a bar
    SetTimerEx("ProgressTimer",interval,false,"ii",barid,interval);

forward ProgressTimer(barid,interval);
public ProgressTimer(barid,interval)
{
    Float:lPBarVal = GetProgressBarValue(barid);
    if (lPBarVal < 100.0)
    {
        SetProgressBarValue(barid, lPBarVal+10.0)
        UpdateProgressBar(barid);
        SetTimerEx("ProgressTimer",interval,false,"i",barid);
    }
    return 1;
}
now i did not account for allot like INVALID_BAR_ID, for that you should read the progress bar topic,
also i never used that include so did not test this code, its only an example.
I gathered all the info from that topic and the wiki just now.
Aha.Thanks for explains...