Textdraw ID Mess up
#10

Quote:
Originally Posted by Unte99
Посмотреть сообщение
Don't create textdraws in functions. It is best to create them in OnGameModeInit. You should read the wiki more: https://sampwiki.blast.hk/wiki/TextDrawCreate

pawn Код:
new Text:pTextDraw1[MAX_PLAYERS],Text:pTextDraw2[MAX_PLAYERS],Text:pTextDraw3[MAX_PLAYERS],Text:pTextDraw4[MAX_PLAYERS],Text:pTextDraw5[MAX_PLAYERS];

OnGameModeInit()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
pTextDraw1[playerid] = TextDrawCreate(playerid, 320.000000, 391.000000, "_");
TextDrawAlignment(playerid, pTextDraw1[playerid], 2);

pTextDraw2[playerid] = TextDrawCreate(playerid, 223.0, 403.0, "Geschwindigkeit: 000 Km/h~n~~n~Tank: 000/000L");
TextDrawBackgroundColor(playerid, pTextDraw2[playerid], 255);
}
}
Now when you set the string:

pawn Код:
TextDrawSetString(playerid,pTextDraw1[playerid],hstr);
TextDrawSetString(playerid,pTextDraw2[playerid],tdstr);
To show the textdraw:

pawn Код:
TextDrawShowForPlayer(playerid,gTextDraw1[playerid]);
To hide the textdraw:

pawn Код:
TextDrawHideForPlayer(playerid,gTextDraw1[playerid]);
I know how to make Textdraws.

And why should i create player Textdraws in OnGameModeInit.
My global textdraws are created in OnGameModeInit and destroyed in OngameModeExit.

When a player need the Textdraw it will be shown for the player and hide if not.

But my Player textdraws will create when it it is needed. And when it isnt needed anymore it will destroy.

I could create all playertextdraws when they connect and destroy when they leave, but why should i have unnecessary Textdraw created? Why u use an Object Streamer? because you dont need Object in LV while you are in LS or SF its the same

______

I tried it, but there are stil errors:

Код:
stock p_PlayerTextDrawDestroy(playerid, &PlayerText:text)
{
	PlayerTextDrawDestroy(playerid, text);
	_:text = -1;
}
Reply


Messages In This Thread
Textdraw ID Mess up - by Psycho77 - 04.04.2012, 11:32
Re: Textdraw ID Mess up - by Unte99 - 04.04.2012, 11:53
Re: Textdraw ID Mess up - by Psycho77 - 04.04.2012, 11:59
Re: Textdraw ID Mess up - by SpiritEvil - 04.04.2012, 12:03
Re: Textdraw ID Mess up - by Psycho77 - 04.04.2012, 12:04
Re: Textdraw ID Mess up - by SpiritEvil - 04.04.2012, 12:12
Re: Textdraw ID Mess up - by Psycho77 - 04.04.2012, 12:14
Re: Textdraw ID Mess up - by Unte99 - 04.04.2012, 12:16
Re: Textdraw ID Mess up - by SpiritEvil - 04.04.2012, 12:17
Re: Textdraw ID Mess up - by Psycho77 - 04.04.2012, 12:23

Forum Jump:


Users browsing this thread: 1 Guest(s)