How to make a textdraw bar? -
0ne - 26.10.2010
Hey everyone,
I was wondering how could i make a simple experience bar, which is filling up as the player gains exp, i tried looking at all-bar FS but i didn't come up with a way to use the script on my experience bar, so can anyone tell me how to do it? ex drawing:
EXPERIENCE
[ 50/100 ]
Re: How to make a textdraw bar? -
iJumbo - 26.10.2010
just make a textdraw and make some .......... in string like ....... is 50% of bar and like if bla bla bla textdrawsetstiring .... and go 20%
Re: How to make a textdraw bar? -
Slice - 26.10.2010
Kitten just made something like it, check it out:
https://sampforum.blast.hk/showthread.php?tid=185774
Re: How to make a textdraw bar? -
0ne - 26.10.2010
Quote:
Originally Posted by g_aSlice
|
I saw that, but he made the bar go with case's, and it only has 20experience, but mine script has over 2million, you expect me to write 1,999,999 million cases just to update the bar and i shall add more levels so that wouldn't be so clever hehe
edit: gigi, an example please?
Re: How to make a textdraw bar? -
Slice - 26.10.2010
Quote:
Originally Posted by 0ne
I saw that, but he made the bar go with case's, and it only has 20experience, but mine script has over 2million, you expect me to write 1,999,999 million cases just to update the bar and i shall add more levels so that wouldn't be so clever hehe
edit: gigi, an example please?
|
pawn Код:
switch(GetPlayerScore(killerid)/1000000)
Re: How to make a textdraw bar? -
0ne - 26.10.2010
Thats not what i had in mind,
the levels are defined like this:
pawn Код:
new LevelExp[40] = {5000, 18975, 30871, 41238, 52567, 63809, 75961, ......};
and the exp goes like: Current Exp/Next Level Exp
so if i have first level and 5678 exp it would look like:
5678 / 18975 and the bar should be filling as he gains exp, the method u gave , well i dont' know how to use it.
Re: How to make a textdraw bar? -
iJumbo - 26.10.2010
if(LevelExp >= 5000...
{
TextDrawSetString(yourtextdraw[playerid],".............");
Re: How to make a textdraw bar? -
0ne - 26.10.2010
I don't think thats the way of using it, if it is then how to fully write the line:
if(LevelExp[40]...
p.s, im using dudb for experience, i don't write like playerinfo[playerid][experience]+=amount;, i instantly save it to a file.
Re: How to make a textdraw bar? -
0ne - 26.10.2010
I thinked of a way but i don't know if its going to work, i'm not sure how to properly update the bar too,
the exp i would write like:
pawn Код:
playerDB[playerid][ExperienceLeft] = LevelExp[dUserINT(pName(playerid)).("Level")];
new str[128];
format(str,sizeof(str),"%d / %d",dUserINT(pName(playerid)).("Experience"),playerDB[playerid][ExperienceLeft]);
But how shall i update the bar for it to be exact as the exp, example: 2500/5000 , that should be 50% filled.
Re: How to make a textdraw bar? -
0ne - 27.10.2010
Anyone? I've tried using the progress bar creator, but the problem is that the bar stays full doesn't show correct progress and doesn't update when i gain exp
code:
pawn Код:
public ProgressBar()
{
ForEach(x,MAX_PLAYERS)
{
if(ExpBar[x] != INVALID_BAR_ID)
{
SetProgressBarValue(ExpBar[x], LevelExp[dUserINT(pName(x)).("Level")]);
UpdateProgressBar(ExpBar[x], x);
}
}
}
I tried posting in that thread, but noone seems to reply me in whole day
Re: How to make a textdraw bar? -
MadeMan - 27.10.2010
If max value is 100, then
pawn Код:
SetProgressBarValue(ExpBar[x], (dUserINT(pName(x)).("Experience") / LevelExp[dUserINT(pName(x)).("Level")]) * 100);
Re: How to make a textdraw bar? -
0ne - 28.10.2010
Now it stays at 0,i mean the bar is all empty
Re: How to make a textdraw bar? -
0ne - 29.10.2010
Bumpty bump. Anyone?
Re: How to make a textdraw bar? -
0ne - 31.10.2010
Help please.
AW: How to make a textdraw bar? -
Arrows73 - 31.10.2010
I dont know that function that you use but you just have to use your brain.
-> Amount of Pixels that the bar has
-> Maximum amount of what you want to display
Then you can 'calculate' the pixels that the bar has to be enlarged for each exp
e.g. The bar has 300 pixels and the maximum amount of Exp is 100
Then you have to enlarge the bar by 3 pixels for each exp
Re: How to make a textdraw bar? -
0ne - 31.10.2010
Uhh.. I'm using an include atm : Progress bar 1.3.1, the bar looks like that:
/imageshack/img339/7272/samp148j.png
except its at 0, i don't want to enlarge any bars, it should be filling up and after i reach the level it goes to 0, i don't understand how else i can do it. But the code mademan gave me above:
SetProgressBarValue(ExpBar[x], (dUserINT(pName(x)).("Experience") / LevelExp[dUserINT(pName(x)).("Level")]) * 100);
First level exP: 5000 , second - 18975
so if i have 7538 exp that would be : 7538/18975x100=39.7% but it would be written like 39%. So the code is right but what else is wrong?
Re: How to make a textdraw bar? -
0ne - 07.11.2010
Still not solved, help please..
Re: How to make a textdraw bar? -
rbN. - 07.11.2010
You do know that one is really really messed up? SetProgressBarMaxValue sets a max value of a progressbar, but it's on every progress bar (So if you got Bar:EXPBar[MAX_PLAYERS], and on OnPlayerConnect you do SetProgressBarMaxValue, that it changes EVERY EXPBar there is, so for every player?)..
atleast, it does kinda for me ;s