Progressbar - 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: Progressbar (
/showthread.php?tid=503711)
Progressbar -
iThePunisher - 30.03.2014
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.
Re: Progressbar -
iThePunisher - 31.03.2014
Anyone knows?
Re: Progressbar -
ZeroTheScyther - 31.03.2014
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.
}
}
Re: Progressbar -
Unte99 - 31.03.2014
Have you created the progressbar ?
Re: Progressbar -
ZeroTheScyther - 31.03.2014
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.
Re: Progressbar -
iThePunisher - 31.03.2014
yes i have the progres bar creator but i want to teach how can i make a progress bar when someone starts a robbery
Re: Progressbar -
ZeroTheScyther - 31.03.2014
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.
Re: Progressbar -
iThePunisher - 31.03.2014
Hmm ok gonna try it but now im going offline i will check it later.