[Include] od_progress_bar.inc
#1

PHP код:
#if defined _INC_od_progress_bar
    #endinput
#endif
#define _INC_od_progress_bar
#include <od_stdio>
static gProgressBar[101] = "####################################################################################################";
static 
gEmptyBar[101] = "                                                                                                    ";
#define OD_PROGRESS_Set ProgressBar_Set
#define OD_PROGRESS_Done ProgressBar_Done
#define OD_PROGRESS_Undone ProgressBar_Undone
#define OD_PROGRESS_Up ProgressBar_Up
#define OD_PROGRESS_Down ProgressBar_Down
#define OD_PROGRESS_OneMinuteUp ProgressBar_OneMinuteUp
#define OD_PROGRESS_OneSecondUp ProgressBar_OneSecondUp
#define OD_PROGRESS_OneMinuteDown ProgressBar_OneMinuteDown
#define OD_PROGRESS_OneSecondDown ProgressBar_OneSecondDown
stock ProgressBar_Set(n) {
    
IO_CarriageReturn();
    
IO_Write(gProgressBar[100 clamp(n0100)]);
    
IO_Write(gEmptyBar[clamp(n0100)]);
    
IO_Flush();
}
stock ProgressBar_Done() {
    
IO_Write(" - Done!");
    
IO_NewLine();
    
IO_Flush();
}
stock ProgressBar_Undone() {
    
IO_CarriageReturn();
    
IO_Write("- Undone!");
    
IO_NewLine();
    
IO_Flush();
}
stock ProgressBar_Up(time) {
    new 
end GetTickCount();
    
ProgressBar_Set(0);
    for (new 
1<= 100; ++i) {
        
end end time;
        while (
GetTickCount() < end) {
        }
        
ProgressBar_Set(i);
    }
}
stock ProgressBar_Down(time) {
    new 
end GetTickCount();
    
ProgressBar_Set(100);
    for (new 
99>= 0; --i) {
        
end end time;
        while (
GetTickCount() < end) {
        }
        
ProgressBar_Set(i);
    }
}
stock ProgressBar_OneMinuteUp() {
    
ProgressBar_Up(600);
    
ProgressBar_Done();
}
stock ProgressBar_OneSecondUp() {
    
ProgressBar_Up(10);
    
ProgressBar_Done();
}
stock ProgressBar_OneMinuteDown() {
    
ProgressBar_Down(600);
    
ProgressBar_Undone();
}
stock ProgressBar_OneSecondDown() {
    
ProgressBar_Down(10);
    
ProgressBar_Undone();

It can put a moving progress bar in the console. If you display other writing a triangle will appear instead.

Server loading example:

PHP код:
#include <a_samp>
#include <od_progress_bar>
main()
{
}
public 
OnGameModeInit() {
    
ProgressBar_OneMinuteUp();



Items loading example:

PHP код:
#include <a_samp>
#include <od_progress_bar>
#define SLOW_CODE for (new end = GetTickCount() + ((random(20) == 0) ? (random(10) * 100) : (random(50))); GetTickCount() < end; ) {}
MODE_LoadObjects() {
    
IO_Write("Loading objects...");
    
IO_NewLine();
    for (new 
0100; ++i) {
        
ProgressBar_Set(i);
        
SLOW_CODE
    
}
    
ProgressBar_Set(100);
    
IO_NewLine();
    
IO_NewLine();
}
MODE_LoadVehicles() {
    
IO_Write("Loading vehicles...");
    
IO_NewLine();
    for (new 
0100; ++i) {
        
ProgressBar_Set(i);
        
SLOW_CODE
    
}
    
ProgressBar_Set(100);
    
IO_NewLine();
    
IO_NewLine();
}
MODE_LoadAntiCheat() {
    
IO_Write("Loading anti cheat...");
    
IO_NewLine();
    for (new 
0100; ++i) {
        
ProgressBar_Set(i);
        
SLOW_CODE
    
}
    
ProgressBar_Set(100);
    
IO_NewLine();
    
IO_NewLine();
}
MODE_LoadZones() {
    
IO_Write("Loading zones...");
    
IO_NewLine();
    for (new 
0100; ++i) {
        
ProgressBar_Set(i);
        
SLOW_CODE
    
}
    
ProgressBar_Set(100);
    
IO_NewLine();
    
IO_NewLine();
}
main()
{
}
public 
OnGameModeInit()
{
    
MODE_LoadObjects();
    
MODE_LoadVehicles();
    
MODE_LoadAntiCheat();
    
MODE_LoadZones();
    
IO_Flush();
    return 
1;



To make work on Linux type:

PHP код:
ln -/dev/tty ./scriptfiles/CON 
Uses:

http://forum.sa-mp.com/showthread.ph...22#post3812622

Password for server example:

http://forum.sa-mp.com/showthread.ph...24#post3812624

If it makes the triangle:

Reply


Messages In This Thread
od_progress_bar.inc - Make animated bars in the console. - by OneDay - 13.12.2016, 00:27
Re: od_progress_bar.inc - by Eoussama - 21.12.2016, 16:40
Re: od_progress_bar.inc - by OneDay - 22.12.2016, 11:14
Re: od_progress_bar.inc - by OneDay - 04.04.2017, 13:13
Re: od_progress_bar.inc - by Pottus - 04.04.2017, 22:58
Re: od_progress_bar.inc - by Dignity - 05.04.2017, 00:01
Re: od_progress_bar.inc - by Pottus - 05.04.2017, 00:05
Respuesta: od_progress_bar.inc - by Goss - 05.04.2017, 01:19
Re: od_progress_bar.inc - by Kar - 05.04.2017, 01:38
Re: od_progress_bar.inc - by OneDay - 05.04.2017, 09:17

Forum Jump:


Users browsing this thread: 2 Guest(s)