Experience bar -
jorambo - 01.07.2011
hmm can anyone help
I have tried for 2 hours to get this right but I don't get it.
I use the progress bar from the include from here.
https://sampforum.blast.hk/showthread.php?tid=113443
But I can not turn it into a experience system wich someone have at a screen.
How can I make that something like this doesn't work:
pawn Код:
new Bar:vhealth[MAX_PLAYERS];
forward ProgressBar();
public ProgressBar() //I prefer not to use OnPlayerUpdate with textdraws
{
for(new playerid; playerid < MAX_PLAYERS; playerid++) //I recommend foreach(Player, playerid)
{
SetProgressBarValue(vhealth[playerid], PlayerInfo[playerid][pExp]);
UpdateProgressBar(vhealth[playerid], playerid);
}
}
and @ my onplayerlogin I have:
pawn Код:
vhealth[playerid] = CreateProgressBar(548.5, 36.0, _, _, 0x00FF00FF, PlayerInfo[playerid][pAge]);
ShowProgressBarForPlayer(playerid, vhealth[playerid]);
After that I used only create and new:bar at onpalyerconnect with the same codes.
With that I putted in the command /setexp: updateprogressbar.
But also that doesn't work.
How to do this.
It would be great if someone could help me cause I realy want this to work
Re: Experience bar -
The Woody - 01.07.2011
PlayerInfo[playerid][pExp] needs to be a float point.
EDIT: Try this dunno if it would work
pawn Код:
new Bar:vhealth[MAX_PLAYERS];
new Float:ExpBar;
forward ProgressBar();
public ProgressBar() //I prefer not to use OnPlayerUpdate with textdraws
{
for(new playerid; playerid < MAX_PLAYERS; playerid++) //I recommend foreach(Player, playerid)
{
ExpBar = PlayerInfo[playerid][pExp];
SetProgressBarValue(vhealth[playerid], ExpBar);
UpdateProgressBar(vhealth[playerid], playerid);
}
}
Re: Experience bar -
jorambo - 01.07.2011
Oke it is a start now I have this:
pawn Код:
new Bar:vhealth[MAX_PLAYERS];
new Float:ExpBar;
new Float:AgeBar;
forward ProgressBar();
public ProgressBar() //I prefer not to use OnPlayerUpdate with textdraws
{
for(new playerid; playerid < MAX_PLAYERS; playerid++) //I recommend foreach(Player, playerid)
{
ExpBar = PlayerInfo[playerid][pExp];
AgeBar = PlayerInfo[playerid][pAge];
SetProgressBarValue(vhealth[playerid], ExpBar);
UpdateProgressBar(vhealth[playerid], playerid);
SetProgressBarMaxValue(vhealth[playerid],AgeBar);
}
}
And under ongamemodeinit:
pawn Код:
SetTimer("ProgressBar",500,true);//every 5 minutes
And under onplayerconnect:
pawn Код:
vhealth[playerid] = CreateProgressBar(548.5, 36.0, _, _, 0x00FF00FF, PlayerInfo[playerid][pAge]);
ShowProgressBarForPlayer(playerid, vhealth[playerid]);
The progress bar is being displayed.
But when I use /setstat and I set for example my age to 10 and exp to 2 it doesn't fill up.
What do I do wrong?
Re: Experience bar -
jorambo - 03.07.2011
It is now almost a day later and i realy need this shit it would be an awesome idea cause I have great plans with the experience bar.
Can someone please react or help me?
Re: Experience bar -
The Woody - 03.07.2011
Quote:
Originally Posted by jorambo
Oke it is a start now I have this:
pawn Код:
new Bar:vhealth[MAX_PLAYERS]; new Float:ExpBar; new Float:AgeBar; forward ProgressBar(); public ProgressBar() //I prefer not to use OnPlayerUpdate with textdraws { for(new playerid; playerid < MAX_PLAYERS; playerid++) //I recommend foreach(Player, playerid) { ExpBar = PlayerInfo[playerid][pExp]; AgeBar = PlayerInfo[playerid][pAge]; SetProgressBarValue(vhealth[playerid], ExpBar); UpdateProgressBar(vhealth[playerid], playerid); SetProgressBarMaxValue(vhealth[playerid],AgeBar); } }
And under ongamemodeinit:
pawn Код:
SetTimer("ProgressBar",500,true);//every 5 minutes
And under onplayerconnect:
pawn Код:
vhealth[playerid] = CreateProgressBar(548.5, 36.0, _, _, 0x00FF00FF, PlayerInfo[playerid][pAge]); ShowProgressBarForPlayer(playerid, vhealth[playerid]);
The progress bar is being displayed.
But when I use /setstat and I set for example my age to 10 and exp to 2 it doesn't fill up.
What do I do wrong?
|
Everytime you use SetProgressBarValue you have to update it before it works.
Re: Experience bar -
Unte99 - 17.07.2011
pawn Код:
SetTimer("ProgressBar",500,true);//every 5 minutes
You call that 5 minutes ? It's not in seconds, it's in miliseconds.
http://en.wikipedia.org/wiki/Millisecond And you should set the time equal to your exp function timer.