TextDraw is not getting equal to Variable
#1

I have this code, but it don't work so fine

moneybagTD need show value to moneybag[playerid]...
This TextDraw need to be equal to moneybag[playerid]

But

Код:
moneybag[playerid] = 8449
moneybagTD[playerid] = 8753
WHY!?

Код:
new PlayerText: MoneyBagTD[MAX_PLAYERS];
OnPlayerDisconnect
Код:
PlayerTextDrawDestroy(playerid, MoneyBagTD[playerid]);
DoisSegundos(playerid)
Код:
		// money bag TD
		new mbstring[128];
		format(mbstring, sizeof(mbstring), "BAG:$%08d", moneybag[i]);
		PlayerTextDrawSetString(playerid, MoneyBagTD[i], mbstring); 
		
		PlayerTextDrawSetProportional(i, MoneyBagTD[i], 1); 
		TextDrawHideForPlayer(i, MoneyBagTD[i]);
		PlayerTextDrawShow(i, MoneyBagTD[i]);
OnPlayerLogin
Код:
		MoneyBagTD[playerid] = CreatePlayerTextDraw(playerid, 440.000000, 422.000000, "88"); 
		PlayerTextDrawBackgroundColor(playerid, MoneyBagTD[playerid], 255); 
		PlayerTextDrawFont(playerid, MoneyBagTD[playerid], 3); 		
		PlayerTextDrawLetterSize(playerid, MoneyBagTD[playerid], 0.699998, 2.399998); 
		PlayerTextDrawColor(playerid, MoneyBagTD[playerid], -16776961); 
		PlayerTextDrawSetOutline(playerid, MoneyBagTD[playerid], 1);
		PlayerTextDrawSetProportional(playerid, MoneyBagTD[playerid], 1);
Reply
#2

Use %i not %d
Reply
#3

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Use %i not %d
Both of them are specifiers for integer number, so it's correct to use %i or %d.

On topic:

Firstly, you don't need to destroy a player textdraw since it's automatically destroyed when a player disconnects.

I think the error is on the function DoisSegundos(playerid) because I don't get why you used the variable "i" there.

Maybe it should look like this instead:

Код:
DoisSegundos(playerid)
{
new mbstring[128];
format(mbstring, sizeof(mbstring), "BAG:$%08d", moneybag[playerid]);
PlayerTextDrawSetString(playerid, MoneyBagTD[playerid], mbstring);
PlayerTextDrawSetProportional(playerid, MoneyBagTD[playerid], 1); 	                    
PlayerTextDrawShow(playerid, MoneyBagTD[playerid]);
}
Reply
#4

I preferred to destroy getting used to
---

Why i use i on doissegundos?

Код:
SetTimer("DoisSegundos", 2000,1);
Код:
	for(new i = 0; i < MAX_PLAYERS; i++) {
		// money bag TD
		new mbstring[128];
		format(mbstring, sizeof(mbstring), "BAG:$%08d", moneybag[i]);
		PlayerTextDrawSetString(playerid, MoneyBagTD[i], mbstring); 
		
		PlayerTextDrawSetProportional(i, MoneyBagTD[i], 1); 
		TextDrawHideForPlayer(i, MoneyBagTD[i]);
		PlayerTextDrawShow(i, MoneyBagTD[i]);
Reply
#5

Lol why compiler give me this warning:
Код:
		// money bag TD
		new mbstring[128];
		format(mbstring, sizeof(mbstring), "BAG:$%08d", moneybag[i]);
		PlayerTextDrawSetString(playerid, MoneyBagTD[i], mbstring); 
		
		PlayerTextDrawSetProportional(i, MoneyBagTD[i], 1); 
		TextDrawHideForPlayer(i, MoneyBagTD[i]);
		PlayerTextDrawShow(i, MoneyBagTD[i]);
In line :
Код:
TextDrawHideForPlayer(i, MoneyBagTD[i]);
Код:
warning 213: tag mismatch
Reply
#6

Quote:
Originally Posted by maikons
Посмотреть сообщение
Lol why compiler give me this warning:
Код:
		// money bag TD
		new mbstring[128];
		format(mbstring, sizeof(mbstring), "BAG:$%08d", moneybag[i]);
		PlayerTextDrawSetString(playerid, MoneyBagTD[i], mbstring); 
		
		PlayerTextDrawSetProportional(i, MoneyBagTD[i], 1); 
		TextDrawHideForPlayer(i, MoneyBagTD[i]);
		PlayerTextDrawShow(i, MoneyBagTD[i]);
In line :
Код:
TextDrawHideForPlayer(i, MoneyBagTD[i]);
Код:
warning 213: tag mismatch
Because it's PlayerTextDrawHide.
Reply
#7

Quote:
Originally Posted by Boot
Посмотреть сообщение
Because it's PlayerTextDrawHide.
Ty! +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)