TextDraw
#1

Hello to all, sorry for my bad english, but i have big problem, yesterday i opened server, and on opening, there was 35 players, that, after some time, all text draws to player are mixed, or better to show you that like this:


http://tinypic.com/view.php?pic=51etrl&s=6
http://tinypic.com/view.php?pic=1581fk6&s=6
http://tinypic.com/view.php?pic=amei34&s=6
http://zaslike.com/files/wc1hqs191yifyclqspf5.png

And thet is happening constantly, i don't want to lose these players what i have, almsot all textdraws i create in onplayerconect, then i destory some td. With global TD, i don't have any problem, but with this player TD i have, can you please help me, i don't know what's the problem, and i realy don't want to loose players, i must fast fix this bugs :/
GM is from scratch, so it's not any edit
Reply
#2

#delete please
Reply
#3

Do you use the new per-player textdraw functions? How are your textdraws created? Can you show some of your OnPlayerConnect textdraw creation? Also show how and where you delete them.
Reply
#4

I don't use that new function, here is speed td

Код:
new Text:TextdrawBrzina[MAX_PLAYERS]; // brzinometar
then this under onplayerconect

Код:
TextdrawBrzina[playerid] = TextDrawCreate(507.000000, 395.000000, " "); // brzinometar
	TextDrawBackgroundColor(TextdrawBrzina[playerid], 255);
	TextDrawFont(TextdrawBrzina[playerid], 1);
	TextDrawLetterSize(TextdrawBrzina[playerid], 0.330000, 1.299999);
	TextDrawColor(TextdrawBrzina[playerid], -1);
	TextDrawSetOutline(TextdrawBrzina[playerid], 1);
	TextDrawSetProportional(TextdrawBrzina[playerid], 1);
And i have timer "razno" on 360 ms, and under it i put string on td

Код:
public Razno()
{
	foreach(Player, i)
	{
	new string[128];
	new string2[128];
	new string3[128];
	if(!IsPlayerInAnyVehicle(i))
	{
	    TextDrawHideForPlayer(i, TextdrawGorivo[i]);
		TextDrawHideForPlayer(i, TextdrawGorivo2[i]);
		TextDrawHideForPlayer(i, TextdrawBrzina[i]);
	}
	if(GetPlayerState(i) == 2 || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
 	{
        new Float:X, Float:Y, Float:Z, Float:km;
		GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
		km = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 138.0);
		new Brzina3 = floatround(floatdiv(km, 0.75), floatround_floor);
		format(string3,sizeof(string3),"~w~Brzina: %d~w~km/h",Brzina3);
		TextDrawSetString(TextdrawBrzina[i], string3);
		TextDrawShowForPlayer(i, TextdrawBrzina[i]);
That is only a part of that timer... i realy need to fix that bugs, or i will loose all players

I dellete them in onPlayerDisconect

Код:
TextDrawDestroy(TextdrawGorivo2[playerid]); TextDrawDestroy(TextdrawGorivo[playerid]); TextDrawDestroy(TextdrawBrzina[playerid]); TextDrawDestroy(TDPovez[playerid]);
    TextDrawDestroy(Textdraw0[playerid]); TextDrawDestroy(Textdraw1[playerid]); TextDrawDestroy(Textdraw2[playerid]); TextDrawDestroy(Textdraw3[playerid]);
    TextDrawDestroy(Textdraw7[playerid]); TextDrawDestroy(Textdraw6[playerid]); TextDrawDestroy(Textdraw5[playerid]); TextDrawDestroy(Textdraw4[playerid]);
    TextDrawDestroy(Textdraw8[playerid]); TextDrawDestroy(Textdraw9[playerid]); TextDrawDestroy(Textdraw10[playerid]); TextDrawDestroy(Textdraw11[playerid]);
    TextDrawDestroy(Textdraw15[playerid]); TextDrawDestroy(Textdraw14[playerid]); TextDrawDestroy(Textdraw13[playerid]); TextDrawDestroy(Textdraw12[playerid]);
    TextDrawDestroy(Textdraw16[playerid]); TextDrawDestroy(Textdraw17[playerid]); TextDrawDestroy(Textdraw18[playerid]); TextDrawDestroy(Textdraw19[playerid]);
    TextDrawDestroy(TDGlad[playerid]); TextDrawDestroy(Textdraw22[playerid]); TextDrawDestroy(Textdraw21[playerid]); TextDrawDestroy(Textdraw20[playerid]);
    TextDrawDestroy(TDWc[playerid]); TextDrawDestroy(TDTutBox3[playerid]); TextDrawDestroy(TDTutBox2[playerid]); TextDrawDestroy(TDTutBox[playerid]);
    TextDrawDestroy(TDTutBox4[playerid]); TextDrawDestroy(TDTutBox4[playerid]); TextDrawDestroy(TDTutBox5[playerid]); TextDrawDestroy(TDTutBox6[playerid]);
    TextDrawDestroy(TDTutBoxText3[playerid]); TextDrawDestroy(TDTutBoxText2[playerid]); TextDrawDestroy(TDTutBoxText1[playerid]); TextDrawDestroy(TDTutBox7[playerid]);
    TextDrawDestroy(TDTutBoxText4[playerid]); TextDrawDestroy(TDTutBoxText5[playerid]); TextDrawDestroy(TDTutBoxText6[playerid]); TextDrawDestroy(TDTutBoxText7[playerid]);
    TextDrawDestroy(TDTutBoxText11[playerid]); TextDrawDestroy(TDTutBoxText10[playerid]); TextDrawDestroy(TDTutBoxText9[playerid]); TextDrawDestroy(TDTutBoxText8[playerid]);
    TextDrawDestroy(TDTutBoxText12[playerid]); TextDrawDestroy(TDTutBoxText13[playerid]); TextDrawDestroy(TDTutBoxText14[playerid]); TextDrawDestroy(TDTutBoxText15[playerid]);
    TextDrawDestroy(TDTutBoxText19[playerid]); TextDrawDestroy(TDTutBoxText18[playerid]); TextDrawDestroy(TDTutBoxText17[playerid]); TextDrawDestroy(TDTutBoxText16[playerid]);
    TextDrawDestroy(TDTutBoxText20[playerid]); TextDrawDestroy(TDTutBoxText21[playerid]); TextDrawDestroy(TDTutBoxText22[playerid]); TextDrawDestroy(TDTutBoxText23[playerid]);
    TextDrawDestroy(TDTutBoxText27[playerid]); TextDrawDestroy(TDTutBoxText26[playerid]); TextDrawDestroy(TDTutBoxText25[playerid]); TextDrawDestroy(TDTutBoxText24[playerid]);
    TextDrawDestroy(TDTutBoxText28[playerid]); TextDrawDestroy(TDTutBoxText29[playerid]); TextDrawDestroy(TDTutBoxText30[playerid]); TextDrawDestroy(TDTutBoxText31[playerid]);
    TextDrawDestroy(TDTutBoxText32[playerid]); TextDrawDestroy(TDTutBoxText33[playerid]); TextDrawDestroy(TDTutBoxText34[playerid]); TextDrawDestroy(TDTutBoxText35[playerid]);
Reply
#5

Initialize all textdraws with Text:INVALID_TEXT_DRAW. Since textdraw ids start at 0, they tend to mix up if variables aren't properly initialized.

pawn Код:
new Text:TextdrawBrzina[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...}; // brzinometar
Also, I'd recommand to create all the textdraws at once under a loop in OnGameModeInit.
Reply
#6

i need to put in evry player TD this ??
Код:
= {Text:INVALID_TEXT_DRAW, ...}
i will try, and yes, if i create them under OnGaeModeInit, how then i can change td string for each player ?

thank you

EDIT: i made it before few days, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)