Experience bar textdraw - problem with respects
#1

Hello all, im trying to make experience progress bar, this bar is made like a textdraw and i want to put my respects for level in it.

I just need help with this experience showing, here is the code:

Код:
new Text:EXP[MAX_PLAYERS];

OnGameModeExit...
	for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) 
       {
		TextDrawHideForAll(EXP[playerid]);
		TextDrawDestroy(EXP[playerid]);
	}

OnPlayerConnect...

	new expamount = PlayerInfo[playerid][pScore]*levelexp;

    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) 
{

	EXP[playerid] = TextDrawCreate(250.000000, 420.000000, "EXP: %d/%d", PlayerInfo[playerid][pRespect], expamount);
	TextDrawBackgroundColor(EXP[playerid], 255);
	TextDrawFont(EXP[playerid], 2);
	TextDrawLetterSize(EXP[playerid], 0.250000, 0.900000);
	TextDrawColor(EXP[playerid], 0xFFFFFFFF);
	TextDrawSetOutline(EXP[playerid], 1);
	TextDrawSetProportional(EXP[playerid], 1);
	TextDrawSetShadow(EXP[playerid], 0);
}

So I want to display like: ActualRespectsOfPlayer / MaximumAmountOfPlayerActualLevel
System is like, you need certain amount of respects to gain new level.
Every next level is bigger amount of respects to fulfil..
Reply
#2

Whenever you increase/decrease experience of a player, set the string of the textdraw.

also a tip: use playertextdraws and not global textdraws, let's say player A got EXP textdraw viewed and B wants to view it too ---> player A will see player B's EXP once you set the string for B's EXP if A had textdraw viewed.

When the player spawn (after logging into the server) prepare the playertextdraw by setting its string then show it to the player.

Use the function if you are going to use my tip:
pawn Код:
PlayerTextDrawSetString(playerid, PlayerText:text, string[]);
to learn more about playertextdraws see this https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
check down for the related functions.

I hope I helped any feedback is appreciated!
Reply
#3

I dont have really so much skills to make it, it looks easy but there is also progressbar textdraw that is growing..
I change to playertextdraw instead of global textdraw, but i could really use some more tips. I will rep.

I want to make something like this : http://i48.tinypic.com/if1x4w.png
Reply
#4

Here you need Progress.inc and textdraws...

and you have wrong type on this code:

Quote:

OnPlayerConnect...

new expamount = PlayerInfo[playerid][pScore]*levelexp;

for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{

EXP[playerid] = TextDrawCreate(250.000000, 420.000000, "EXP: %d/%d", PlayerInfo[playerid][pRespect], expamount);
TextDrawBackgroundColor(EXP[playerid], 255);
TextDrawFont(EXP[playerid], 2);
TextDrawLetterSize(EXP[playerid], 0.250000, 0.900000);
TextDrawColor(EXP[playerid], 0xFFFFFFFF);
TextDrawSetOutline(EXP[playerid], 1);
TextDrawSetProportional(EXP[playerid], 1);
TextDrawSetShadow(EXP[playerid], 0);
}

dont make it playerid, because is already created by samp.. make ' i ' for(new i=0;....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)