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



TextDraws - spd_sahil - 15.09.2011

I made some textdraws for points system and when they are exectuted .. its seems to work.. on my screen.. and it overlaps on friends screen.. it workd at very random.. sometimes it overlaps for me too.. it doesnt overlap for 3rd person.. but sometimes it does..
pawn Код:
//==============================================================================
// SCORING
//==============================================================================
    if(WarStart==1)
    {
            if(team[killerid]==1 && team[playerid]!=1)
            {
                MaxScore1++;
                new out[128];
                TextDrawHideForAll(Textdraw6);
                format(out,128,"~r~%i",MaxScore1);
                Textdraw6 = TextDrawCreate(580.000000, 309.000000, out);
                TextDrawLetterSize(Textdraw6, 0.509998, 1.299999);
                TextDrawShowForAll(Textdraw6);
               
            }
            if(team[killerid]==1 && team[playerid]==1)
            {
                MaxScore1--;
                new out[128];
                TextDrawHideForAll(Textdraw6);
                format(out,128,"~r~%i",MaxScore1);
                Textdraw6 = TextDrawCreate(580.000000, 309.000000, out);
                TextDrawLetterSize(Textdraw6, 0.509998, 1.299999);
                TextDrawShowForAll(Textdraw6);
            }
            if(team[killerid]==2 && team[playerid]!=2)
            {
                MaxScore2++;
                new out[128];
                TextDrawHideForAll(Textdraw8);
                format(out,128,"~b~%i",MaxScore2);
                Textdraw8 = TextDrawCreate(607.000000, 310.000000, out);
                TextDrawLetterSize(Textdraw8, 0.509998, 1.299999);
                TextDrawShowForAll(Textdraw8);
               
            }
            if(team[killerid]==2 && team[playerid]==2)
            {
                MaxScore2--;
                new out[128];
                TextDrawHideForAll(Textdraw8);
                format(out,128,"~b~%i",MaxScore2);
                Textdraw8 = TextDrawCreate(607.000000, 310.000000, out);
                TextDrawLetterSize(Textdraw8, 0.509998, 1.299999);
                TextDrawShowForAll(Textdraw8);
            }
            if(MaxScore1 == 10)
            {
                MaxRound1++;
                new out[128];
                TextDrawHideForAll(Textdraw9);
                format(out,128,"~r~%i",MaxRound1);
                Textdraw9 = TextDrawCreate(580.000000, 297.000000, out);
                TextDrawLetterSize(Textdraw9, 0.509998, 1.299999);
                TextDrawShowForAll(Textdraw9);
                TextDrawHideForAll(Textdraw8);
                TextDrawHideForAll(Textdraw6);
                Textdraw6 = TextDrawCreate(580.000000, 309.000000, "~r~0");
                Textdraw8 = TextDrawCreate(607.000000, 310.000000, "~b~0");
                TextDrawShowForAll(Textdraw6);
                TextDrawShowForAll(Textdraw8);
                MaxScore1=0;
                MaxScore2=0;
            }
            if(MaxScore2 == 10)
            {
                MaxRound2++;
                new out[128];
                TextDrawHideForAll(Textdraw11);
                format(out,128,"~b~%i",MaxRound2);
                Textdraw11 = TextDrawCreate(607.000000, 297.000000, out);
                TextDrawShowForAll(Textdraw11);
                TextDrawLetterSize(Textdraw11, 0.509998, 1.299999);
                TextDrawHideForAll(Textdraw8);
                TextDrawHideForAll(Textdraw6);
                Textdraw6 = TextDrawCreate(580.000000, 309.000000, "~r~0");
                Textdraw8 = TextDrawCreate(607.000000, 310.000000, "~b~0");
                TextDrawShowForAll(Textdraw6);
                TextDrawShowForAll(Textdraw8);
                MaxScore1=0;
                MaxScore2=0;
            }
            if(MaxRound1 == 3 || MaxRound2 == 3)
            {
                Victor();
            }
        }
   
    }
//==============================================================================



Re: TextDraws - Kingunit - 15.09.2011

Start with clicking this!


Re: TextDraws - spd_sahil - 15.09.2011

how will it help ? its not a script request. i wanna know where im going wrong.. is it a famous issue ? or something ?


Re: TextDraws - spd_sahil - 15.09.2011

Bump** Please i really need help in this


Re: TextDraws - Vince - 15.09.2011

Use TextDrawSetString instead of hiding the current textdraw - which is not the same as destroying it, by the way - and then making a new one. You'll run out of textdraws eventually and the server will crash.


Re: TextDraws - spd_sahil - 15.09.2011

i used setstring its still overlapping..

Really need Help here people..


Re: TextDraws - spd_sahil - 16.09.2011

BUmp_-


Re: TextDraws - iPLEOMAX - 16.09.2011

Textdraws are overlapping because you never destroy them..

What I mean is that you should use TextDrawDestroy(); before you do TextDrawCreate(); again.

Example:

pawn Код:
if(team[killerid]==1 && team[playerid]!=1)
            {
                MaxScore1++;
                new out[128];
                TextDrawHideForAll(Textdraw6);
                format(out,128,"~r~%i",MaxScore1);
                TextDrawDestroy(Textdraw6); //<- this!
                Textdraw6 = TextDrawCreate(580.000000, 309.000000, out);
                TextDrawLetterSize(Textdraw6, 0.509998, 1.299999);
                TextDrawShowForAll(Textdraw6);
               
            }
OR:

Use TextDrawCreate in OnFilterScriptInit() or OnGameModeInit() then use TextDrawSetString();


Re: TextDraws - spd_sahil - 16.09.2011

ahhhh.. thanks