Progressbar
#1

i've got the progressbar include but i dont know how can i make it if someone start capturing a zone, the progress bar will be show in the screen and when zone gets captured the progres bar will be removed.
or when a player starts robbing.
Please can anyone just help me out with this code i cannot understand this one.
Reply
#2

Anyone knows?
Reply
#3

This one might be the worst example you could get but I hope it helps you.

pawn Код:
new Bar:Pbar[MAX_PLAYERS]; //naming your bar
new BarProg;
new ProgFill[MAX_PLAYERS]; //We'll use this to update the progress bars

forward ProgFill(playerid);// I still don't know what's this doing xD
public OnPlayerConnect(playerid)
{
Pbar[playerid] = CreateProgressBar(548.00, 111.00, 56.50, 3.19, 0x0000FFFF, 100.0); // creating it
SetProgressBarValue(Pbar[playerid], 0); // here you set how "filled" it is
SetTimerEx("ProgFill", 1000, 1, "i", playerid); // creating the timer.
return 1;
}

public ProgFill(playerid)
{
    UpdateProgressBar(Pbar[playerid], playerid); // updating the bar, If you set a value but don't update, the bar won't change.
        if(IsPlayerInRangeOfPoint(playerid, 2.0, //your coords)
        {
        ShowProgressBarForPlayer(playerid, Pbar[playerid]);
        BarProg++;
        SetProgressBarValue(Pbar[playerid], BarProg); // here you set how "filled" it is
        }
        if(BarProg == 100)
        {
        GivePlayerMoney(playerid,GetPlayerMoney+15000);  //if the bar is filled giving the player some money.
        BarProg = 0; // then reseting it.
        }
}
Reply
#4

Have you created the progressbar ?
Reply
#5

Quote:
Originally Posted by ZeroTheScyther
Посмотреть сообщение
This one might be the worst example you could get but I hope it helps you.

pawn Код:
new Bar:Pbar[MAX_PLAYERS]; //naming your bar
new BarProg;
new ProgFill[MAX_PLAYERS]; //We'll use this to update the progress bars

forward ProgFill(playerid);// I still don't know what's this doing xD
public OnPlayerConnect(playerid)
{
Pbar[playerid] = CreateProgressBar(548.00, 111.00, 56.50, 3.19, 0x0000FFFF, 100.0); // creating it
SetProgressBarValue(Pbar[playerid], 0); // here you set how "filled" it is
SetTimerEx("ProgFill", 1000, 1, "i", playerid); // creating the timer.
return 1;
}

public ProgFill(playerid)
{
    UpdateProgressBar(Pbar[playerid], playerid); // updating the bar, If you set a value but don't update you won't the bar won't change.
        if(IsPlayerInRangeOfPoint(playerid, 2.0, //your coords)
        {
        ShowProgressBarForPlayer(playerid, Pbar[playerid]);
        BarProg++;
        SetProgressBarValue(Pbar[playerid], BarProg); // here you set how "filled" it is
        }
        if(BarProg == 100)
        {
        GivePlayerMoney(playerid,GetPlayerMoney+15000);  //if the bar is filled giving the player some money.
        BarProg = 0; // then reseting it.
        }
}
Check this one.
Reply
#6

yes i have the progres bar creator but i want to teach how can i make a progress bar when someone starts a robbery
Reply
#7

Just try the code I gave you ... at //your coords use the coords of the robbery place so when a player gets in the range of those coords the progress bar will start to raise. When it reachers 100 the player will get 15000 $ You should also add a TogglePlayerControllable around there.
Reply
#8

Hmm ok gonna try it but now im going offline i will check it later.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)