Conflicting Textdraws
#1

Hey guys,

this is the first time I am asking for help here and I hope you guys are able to, because this bug is pretty annoying.

I have a few Textdraws in my gamemode and they're usually working well till I make a relog.

Here are a few Screenshots:

http://imgur.com/OlLKRdP

http://imgur.com/p5GqRR6

Also, here a video:

https://www.youtube.com/watch?v=TlH61vXuCzU

Let's talk about the Code:

95 % of my textdraws are located in an extra file called texts.pwn which is included into the main gamemode.
I am destroying all Textdraws on OnGameModeExit & OnPlayerDisconnect.

This is how my code looks like

Код HTML:
//Player ProgressBar

new PlayerBar:Bar0[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID};
new PlayerBar:Bar1[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID};
new PlayerBar:Bar2[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID};
new PlayerBar:Bar3[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID};
new PlayerBar:Bar4[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID};

new PlayerBar:PB[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID};



// Player Textdraws

new PlayerText:Arrow[MAX_PLAYERS][5] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:EXPSkillCount[MAX_PLAYERS][5] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:SkillTD[MAX_PLAYERS][6] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:RoundStatsString[MAX_PLAYERS][11] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:WeedTexts[MAX_PLAYERS][4] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:SpreeT[MAX_PLAYERS][2] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:PlayerKill[MAX_PLAYERS][2] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:MultiKill[MAX_PLAYERS][2] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:SpecText[MAX_PLAYERS][4] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:ExpTexts[MAX_PLAYERS][2] = {PlayerText:INVALID_TEXT_DRAW, ...}; 
new PlayerText:SBText[MAX_PLAYERS][4] = {PlayerText:INVALID_TEXT_DRAW, ...}; 

new PlayerText:PlayerMainText1[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
new PlayerText:PlayerMainText2[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
new PlayerText:PlayerMainText3[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
new PlayerText:PlayerMainText4[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
OnPlayerDisconnect

Код HTML:
    DestroyRegisterTextdraws(playerid);
    DestroyWeedTextDraws(playerid);
    DestroyRoundStatsTextDraws(playerid);
    DestroyPlayerKillTextDraws(playerid);
    DestroyMultiKillTextDraws(playerid);
    DestroySpreeTextDraws(playerid);
    DestroySkillTextDraw(playerid);
    DestroySkillBar(playerid);
    DestroyEXPSkillCount(playerid);
    DestroyArrows(playerid);
    Destroy******TextDraws(playerid);
	DestroyEXPBar(playerid);
	DestroyWatchTexts(playerid);
	DestroyMainText(playerid);
They're destroyed like this (not going to post all except if it's necessary):

(Don't know why I am hiding them before destroying, thought it might help)

Код HTML:
DestroyArrows(playerid)
{

    PlayerTextDrawHide(playerid,Arrow[playerid][0]);
    PlayerTextDrawHide(playerid,Arrow[playerid][1]);
    PlayerTextDrawHide(playerid,Arrow[playerid][2]);
    PlayerTextDrawHide(playerid,Arrow[playerid][3]);
    PlayerTextDrawHide(playerid,Arrow[playerid][4]);

    PlayerTextDrawDestroy(playerid,Arrow[playerid][0]);
    PlayerTextDrawDestroy(playerid,Arrow[playerid][1]);
    PlayerTextDrawDestroy(playerid,Arrow[playerid][2]);
    PlayerTextDrawDestroy(playerid,Arrow[playerid][3]);
    PlayerTextDrawDestroy(playerid,Arrow[playerid][4]);

    Arrow[5][playerid] = PlayerText:INVALID_TEXT_DRAW;

}
Код HTML:
DestroyMainText(playerid)
{
    PlayerTextDrawDestroy(playerid, PlayerMainText1[playerid]);
    PlayerTextDrawDestroy(playerid, PlayerMainText2[playerid]);
    PlayerTextDrawDestroy(playerid, PlayerMainText3[playerid]);
    PlayerTextDrawDestroy(playerid, PlayerMainText4[playerid]);

    PlayerMainText1[playerid] = PlayerText:INVALID_TEXT_DRAW;
    PlayerMainText2[playerid] = PlayerText:INVALID_TEXT_DRAW;
    PlayerMainText3[playerid] = PlayerText:INVALID_TEXT_DRAW;
    PlayerMainText4[playerid] = PlayerText:INVALID_TEXT_DRAW;
}
Код HTML:
DestroyRoundStatsTextDraws(playerid)
{

    PlayerTextDrawHide(playerid, RoundStatsString[playerid][0]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][1]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][2]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][3]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][4]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][5]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][6]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][7]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][8]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][9]);
    PlayerTextDrawHide(playerid, RoundStatsString[playerid][10]); 

    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][0]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][1]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][2]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][3]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][4]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][5]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][6]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][7]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][8]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][9]);
    PlayerTextDrawDestroy(playerid, RoundStatsString[playerid][10]); 

    RoundStatsString[11][playerid] = PlayerText:INVALID_TEXT_DRAW;
}
Hope you guys can help me..
Reply
#2

We can't help you unless you show us the right code, that includes where and what kind of stuff do you do in a textdraw (creating textdraws and other stuff) and where you modify and set the textdraw strings.
Reply
#3

Well, I don't like to post here 2000+ Lines of creating my Textdraw Codes (I doubt that I am making a mistake by creating textdraws) but I'll post the code where I am using TextDrawSetString.

OnPlayerConnect

Код HTML:
 /* Account Management */
    new Query[256];
    format(Query, sizeof(Query),"SELECT * FROM `players` WHERE Name = '%s'", GetName(playerid));
    mysql_query(MySQL, Query);
    mysql_store_result();

    if(mysql_num_rows() != 0) {
        PlayerTextDrawSetString(playerid, PlayerMainText1[playerid], "Your account is ~g~Registered~n~~w~~h~Click on 'Sign in' to sign in.");
        PlayerTextDrawSetString(playerid, PlayerMainText2[playerid], "~w~     LOG IN ACCOUNT");
        } else {
        PlayerTextDrawSetString(playerid, PlayerMainText1[playerid], "Your account is ~y~not registered~n~~w~~h~Click on 'Register' to register.");
        PlayerTextDrawSetString(playerid, PlayerMainText2[playerid], "~w~  REGISTER ACCOUNT");
    }
Own S.beit Public (just a part of it)

Код HTML:
SecurityStuff(playerid);
		******Reports = false;
		KickInfo(playerid);
		PlayerTextDrawSetString(playerid, SBText[playerid][1],"System kicked you for~n~~n~~n~~n~~n~      Please remove it");
		Kick(playerid);
Skill Command (I guess here's something wrong because this is the Textdraw which appear in the video)

Код HTML:
 CMD:skills(playerid,params[])
 {
 	if(SkillShowing[playerid] == 1)
 	{
 	    SkillShowing[playerid] = 0;
 	    HideSkillTextDraw(playerid);
 	    HideSkillBar(playerid);
 	    HideEXPSkillCount(playerid);
 	    HideArrows(playerid);
 	    CancelSelectTextDraw(playerid);
 	    return 1;
 	}

 	else
 	{
 	    SkillShowing[playerid] = 1;
 	    SendClientMessage(playerid, -1, "Use {FF0000}/skills{FFFFFF} again to hide the Textdraws or click on the {FF0000}red X.");
 	    SelectTextDraw(playerid, 0x00FF00FF); // Highlight green when hovering over
 	    ShowSkillBar(playerid);
 	    ShowSkillTextDraw(playerid);
 	    ShowArrows(playerid);
 	    SetPlayerProgressBarValue(playerid,Bar0[playerid],pData[playerid][P_DoubleEXP]*20);

		new string[5];
		format(string,sizeof(string),"%d%",20*pData[playerid][P_DoubleEXP]);
		PlayerTextDrawSetString(playerid, EXPSkillCount[playerid][0], string);

 		switch(pData[playerid][P_DoubleEXP])
 		{
 		    case 5:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0x008000FF);
 		    case 4:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0x80FF00FF);
 		    case 3:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xFFFF00FF);
 		    case 2:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xFF8000FF);
 		    case 1:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xFF0000FF);
 		    case 0:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xC0C0C0FF);
 		}

 		SetPlayerProgressBarValue(playerid,Bar1[playerid],pData[playerid][P_DoubleWeed]*20);

		format(string,sizeof(string),"%d%",20*pData[playerid][P_DoubleWeed]);
		PlayerTextDrawSetString(playerid, EXPSkillCount[playerid][1], string);
 		switch(pData[playerid][P_DoubleWeed])
 		{
 		    case 5:SetPlayerProgressBarColour(playerid, Bar1[playerid], 0x008000FF);
 		    case 4:SetPlayerProgressBarColour(playerid, Bar1[playerid], 0x80FF00FF);
 		    case 3:SetPlayerProgressBarColour(playerid, Bar1[playerid], 0xFFFF00FF);
 		    case 2:SetPlayerProgressBarColour(playerid, Bar1[playerid], 0xFF8000FF);
 		    case 1:SetPlayerProgressBarColour(playerid, Bar1[playerid], 0xFF0000FF);
 		    case 0:SetPlayerProgressBarColour(playerid, Bar1[playerid], 0xC0C0C0FF);
 		}

 		SetPlayerProgressBarValue(playerid,Bar2[playerid],pData[playerid][P_DeathExplosion]*20);
		format(string,sizeof(string),"%d%",20*pData[playerid][P_DeathExplosion]);
		PlayerTextDrawSetString(playerid, EXPSkillCount[playerid][2], string);
 		switch(pData[playerid][P_DeathExplosion])
 		{
 		    case 5:SetPlayerProgressBarColour(playerid, Bar2[playerid], 0x008000FF);
 		    case 4:SetPlayerProgressBarColour(playerid, Bar2[playerid], 0x80FF00FF);
 		    case 3:SetPlayerProgressBarColour(playerid, Bar2[playerid], 0xFFFF00FF);
 		    case 2:SetPlayerProgressBarColour(playerid, Bar2[playerid], 0xFF8000FF);
 		    case 1:SetPlayerProgressBarColour(playerid, Bar2[playerid], 0xFF0000FF);
 		    case 0:SetPlayerProgressBarColour(playerid, Bar2[playerid], 0xC0C0C0FF);
 		}

 		SetPlayerProgressBarValue(playerid,Bar3[playerid],pData[playerid][P_ArmourSpawn]*20);

		format(string,sizeof(string),"%d%",20*pData[playerid][P_ArmourSpawn]);
		PlayerTextDrawSetString(playerid, EXPSkillCount[playerid][3], string);
 		switch(pData[playerid][P_ArmourSpawn])
 		{
 		    case 5:SetPlayerProgressBarColour(playerid, Bar3[playerid], 0x008000FF);
 		    case 4:SetPlayerProgressBarColour(playerid, Bar3[playerid], 0x80FF00FF);
 		    case 3:SetPlayerProgressBarColour(playerid, Bar3[playerid], 0xFFFF00FF);
 		    case 2:SetPlayerProgressBarColour(playerid, Bar3[playerid], 0xFF8000FF);
 		    case 1:SetPlayerProgressBarColour(playerid, Bar3[playerid], 0xFF0000FF);
 		    case 0:SetPlayerProgressBarColour(playerid, Bar3[playerid], 0xC0C0C0FF);
 		}

 		SetPlayerProgressBarValue(playerid,Bar4[playerid],pData[playerid][P_DoublePickUpHealth]*20);

		format(string,sizeof(string),"%d%",20*pData[playerid][P_DoublePickUpHealth]);
		PlayerTextDrawSetString(playerid, EXPSkillCount[playerid][4], string);
 		switch(pData[playerid][P_DoublePickUpHealth])
 		{
 		    case 5:SetPlayerProgressBarColour(playerid, Bar4[playerid], 0x008000FF);
 		    case 4:SetPlayerProgressBarColour(playerid, Bar4[playerid], 0x80FF00FF);
 		    case 3:SetPlayerProgressBarColour(playerid, Bar4[playerid], 0xFFFF00FF);
 		    case 2:SetPlayerProgressBarColour(playerid, Bar4[playerid], 0xFF8000FF);
 		    case 1:SetPlayerProgressBarColour(playerid, Bar4[playerid], 0xFF0000FF);
 		    case 0:SetPlayerProgressBarColour(playerid, Bar4[playerid], 0xC0C0C0FF);
 		}




 		ShowSkillBar(playerid);
 		ShowEXPSkillCount(playerid);
 	}
 	return 1;
 }
A part of OnPlayerDeath

Код HTML:
if(pData[killerid][P_DoubleEXP] >= 1 && random(10) < pData[killerid][P_DoubleEXP])
	{
		//Player is Skill Level 1+ and double XP appeared
		PlayerTextDrawShow(killerid, PlayerKill[killerid][0]);
		PlayerTextDrawShow(killerid, PlayerKill[killerid][1]);
		PlayerTextDrawSetString(killerid, PlayerKill[killerid][0], "+50");
		PlayerTextDrawSetString(killerid, PlayerKill[killerid][1], "EXP(x2)");
		SetTimerEx("KillTextdrawPlayerKill", 3000, false, "ii", killerid, 0);
		GivePlayerExp(killerid, 50);
	}
		else
	{
		//Player is Skill Level 0 or the Double XP Chance didn't appear.
		PlayerTextDrawShow(killerid, PlayerKill[killerid][0]);
		PlayerTextDrawShow(killerid, PlayerKill[killerid][1]);
		PlayerTextDrawSetString(killerid, PlayerKill[killerid][0], "+25");
		PlayerTextDrawSetString(killerid, PlayerKill[killerid][1], "Killing");
		SetTimerEx("KillTextdrawPlayerKill", 3000, false, "ii", killerid, 0);
		GivePlayerExp(killerid, 25);
		}
	}
}
OnDialogResponse

Код HTML:
 if(dialogid == D_UpgradeEXP)
    {
        if(response) //Yes
        {
        	new string[5];
        	if(pData[playerid][P_DoubleEXP] >= 5)
        	{
        		SendClientMessage(playerid, COLOR_RED, "You've reached the maximum Skill already.");
        		SelectTextDraw(playerid, 0x00FF00FF);
        		return 1;
        	}

        	if(pData[playerid][P_SkillPoints] <1)
        	{
        		SelectTextDraw(playerid, 0x00FF00FF);
        		SendClientMessage(playerid, -1, "You need at least one {FF0000}Skill Point{FFFFFF} to be able to upgrade a Skill. {FF0000}Level up{FFFFFF} to gain Skill Points.");
        		return 1;
        	}


        	if(pData[playerid][P_Weed] < Upgrade_Price)
        	{
        		SelectTextDraw(playerid, 0x00FF00FF);
        		new missingweed[128];
        		format(missingweed, sizeof(missingweed),"You don't have {FF0000}enough{FFFFFF} weed, you need at least {FF0000}%dg weed.",Upgrade_Price);
        		SendClientMessage(playerid, -1, missingweed);

        		return 1;
        	}

	        SelectTextDraw(playerid, 0x00FF00FF);

	        HideSkillBar(playerid);

	        pData[playerid][P_DoubleEXP]++; //Updating Skill + 1 Level

	        format(string,sizeof(string),"%d%",20*pData[playerid][P_DoubleEXP]);
			PlayerTextDrawSetString(playerid, EXPSkillCount[playerid][0], string); //Upgrade Percent Textdraw
	        SetPlayerProgressBarValue(playerid,Bar0[playerid],pData[playerid][P_DoubleEXP]*20); //Upgrading Bar

	        switch(pData[playerid][P_DoubleEXP])
 		{
 		    case 5:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0x008000FF);
 		    case 4:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0x80FF00FF);
 		    case 3:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xFFFF00FF);
 		    case 2:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xFF8000FF);
 		    case 1:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xFF0000FF);
 		    case 0:SetPlayerProgressBarColour(playerid, Bar0[playerid], 0xC0C0C0FF);
 		}


	        ShowSkillBar(playerid);
	        SendClientMessage(playerid, -1, "You've {00FF00}upgraded{FFFFFF} your {00FF00}EXP Skill Level!");
	        PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
	        //Price
	        pData[playerid][P_Weed] -= Upgrade_Price; //Taking weed
	        pData[playerid][P_SkillPoints]--; //Taking one Skill Point away
            
        }

        else
        {
        	SelectTextDraw(playerid, 0x00FF00FF);
        }

        return 1;

    }
Own Public where I am starting a new round (Part of it)

Код HTML:
 if(!(Round[r_time][RTIME_MINUTES] <= 0 && Round[r_time][RTIME_SECONDS] <= 0))
	            {
	                new str[15];
			        format(str, sizeof(str), " ~w~%02d:%02d", Round[r_time][RTIME_MINUTES], Round[r_time][RTIME_SECONDS]);
			        TextDrawSetString(RoundTime, str);
	                return 1;
	            }
Roundtimer Public (Part of it)

Код HTML:
new str[15];
		        format(str, sizeof(str), " ~w~%02d:%02d", Round[r_time][RTIME_MINUTES], Round[r_time][RTIME_SECONDS]);
		        TextDrawSetString(RoundTime, str);
                format(str, sizeof(str), "ARENA:~b~ %02d", Round[r_areaid]);
        		TextDrawSetString(ArenaTextID, str);
Updating a progressbar

Код HTML:
UpdateProgessBar(playerid) {
    SetPlayerProgressBarValue(playerid, PB[playerid], pData[playerid][P_Exp] / (pData[playerid][P_MExp] / 1000));
    new string[24];
    format(string, sizeof string, "%d/%d", pData[playerid][P_Exp],pData[playerid][P_MExp]);
    PlayerTextDrawSetString(playerid, ExpTexts[playerid][1], string);
    PlayerTextDrawShow(playerid, ExpTexts[playerid][1]);
    format(string, sizeof string, "Level: %d", pData[playerid][P_Level]);
    PlayerTextDrawSetString(playerid, ExpTexts[playerid][0], string);
    PlayerTextDrawShow(playerid, ExpTexts[playerid][0]);
    return 1;
}
I think that were all, at least most of them. Need anything else?
Reply
#4

Push :/
Reply
#5

This problem has been fixed by Multi Kill, the topic can be locked or deleted already.
Reply
#6

Quote:
Originally Posted by s4kuL
Посмотреть сообщение
This problem has been fixed by Multi Kill, the topic can be locked or deleted already.
Why would you bump it?
Moderators don't care about locking topics, in fact, They don't care about anything.

You clearly see 99.9999% of all threads are unlocked by years ago.
That was just the worst bump I ever seen, or second worst.. A guy bumped 1min later..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)