SA-MP Forums Archive
XP system - 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: XP system (/showthread.php?tid=655388)



XP system - div - 20.06.2018

Hello, im making a XP Textdraw and a wanted textdraw.. i've made the textdraw.. can someone guide me how to implement the code and where to?

also made the enums {pXP and pWanted}


Re: XP system - Miguelch1312 - 20.06.2018

Use PlayerTextDrawSetString If the string is numeric or something, if its a bar you've to play with the size.
https://sampwiki.blast.hk/wiki/PlayerTextDrawSetString

If the wanted its with stars, can make some textdraws corresponding with the number of your wanted, Ex if its 6 make 6 texdraws, 1 with 1 star, another with 2, next with 3, and everything, then you use PlayerTextdrawShow according the wanted level, but if its numeric or a bar, do the same as the xp system
https://sampwiki.blast.hk/wiki/PlayerTextDrawShow


Re: XP system - div - 20.06.2018

Код:
TDEditor_PTD[playerid][1] = CreatePlayerTextDraw(playerid, 581.999938, 427.440002, "CURRENT_XP");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][1], 0.190799, 0.878222);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][1], -117.000000, 0.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][1], -1378294017);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][1], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][1], 3);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][1], 1);
It's compiling fine, but i got no idea why it isn't working.

Any help would be greatly appreciated.


Re: XP system - div - 20.06.2018

Quote:
Originally Posted by Miguelch1312
Посмотреть сообщение
Use PlayerTextDrawSetString If the string is numeric or something, if its a bar you've to play with the size.
https://sampwiki.blast.hk/wiki/PlayerTextDrawSetString

If the wanted its with stars, can make some textdraws corresponding with the number of your wanted, Ex if its 6 make 6 texdraws, 1 with 1 star, another with 2, next with 3, and everything, then you use PlayerTextdrawShow according the wanted level, but if its numeric or a bar, do the same as the xp system
https://sampwiki.blast.hk/wiki/PlayerTextDrawShow
I've made it as a TEXTDRAW, i'm using format for XP

like


Код:
format(xpbar, sizeof(xpbar), "0000%d", pInfo[playerid][pXP]
CreatePlayerTextDraw(playerid, 582.399719, 433.413482, xpbar);



Re: XP system - NaS - 20.06.2018

Quote:
Originally Posted by div
Посмотреть сообщение
I've made it as a TEXTDRAW, i'm using format for XP

like


Код:
format(xpbar, sizeof(xpbar), "0000%d", pInfo[playerid][pXP]
CreatePlayerTextDraw(playerid, 582.399719, 433.413482, xpbar);
You already created the textdraw. Using CreatePlayerTextDraw here will create another one.
You should use PlayerTextDrawSetString:

Код:
PlayerTextDrawSetString(playerid, TDEditor_PTD[playerid][1], xpbar);



Re: XP system - div - 20.06.2018

But it's not showing any textdraw.. not even a single, even if the textdraw contains a text "CURRENT XP"


Re: XP system - NaS - 20.06.2018

Quote:
Originally Posted by div
Посмотреть сообщение
But it's not showing any textdraw.. not even a single, even if the textdraw contains a text "CURRENT XP"
Did you use PlayerTextDrawShow? For example in OnPlayerConnect or OnPlayerSpawn?


Re: XP system - div - 20.06.2018

OnPlayerSpawn


Re: XP system - NaS - 20.06.2018

Quote:
Originally Posted by div
Посмотреть сообщение
OnPlayerSpawn
Can you show us the code? All of the related code would be nice to see if there are any mistakes.

The TextDraw looks alright (position is on screen and it is not fully transparent). Did you make it in an editor or per hand?


Re: XP system - div - 20.06.2018

Код:
new PlayerText:TDEditor_PTD[MAX_PLAYERS][5];
is at the top,


then





Код:
	new xpbar[14];
	format(xpbar, sizeof(xpbar), "0000%d~n~", pInfo[playerid][pXP]);
	
	
	
	
	
	TDEditor_PTD[playerid][0] = CreatePlayerTextDraw(playerid, 582.399719, 433.413482, xpbar);
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][0], 0.217200, 1.343066);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][0], 295.000000, 0.250000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][0], -1378294017);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][0], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][0], 3);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][0], 0);

	TDEditor_PTD[playerid][1] = CreatePlayerTextDraw(playerid, 581.999938, 427.440002, "CURRENT_XP");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][1], 0.190799, 0.878222);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][1], -117.000000, 0.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][1], -1378294017);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][1], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][1], 3);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][1], 1);
	
	
//	PlayerTextDrawSetString(playerid, TDEDITOR_PTD[playerid][0], xpbar)
    PlayerTextDrawSetString(playerid, TDEditor_PTD[playerid][0], xpbar);




	TDEditor_PTD[playerid][2] = CreatePlayerTextDraw(playerid, 578.401123, 123.297912, "[]    []");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][2], 0.355600, 2.048001);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][2], -225.000000, 0.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][2], 3);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][2], -5963521);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][2], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][2], 1);

	TDEditor_PTD[playerid][3] = CreatePlayerTextDraw(playerid, 492.801116, 99.302291, "[][][][][][]");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][3], 0.309600, 2.192178);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][3], -111.000000, 0.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][3], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][3], -5963521);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][3], 1);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][3], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][3], 1);


	new wlvl[24];
	format(wlvl, 24, "%s", pInfo[playerid][pWanted]);
	TDEditor_PTD[playerid][4] = CreatePlayerTextDraw(playerid, 548.800109, 123.297790, wlvl); //for wanted level displaying
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][4], 0.396799, 1.838933);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][4], -7.000000, 0.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][4], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][4], -5963521);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][4], -1);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][4], 2);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][4], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][4], 2);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][4], 1);