SA-MP Forums Archive
TextDraws are getting mixed - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: TextDraws are getting mixed (/showthread.php?tid=243861)



TextDraws are getting mixed - mrcoolballs - 25.03.2011

All of my textdraws are getting mixed up with eachother, I have one textdraw that is on OnPlayerRequestClass that displays all of his weapons, and I have another one that says, all Help related questions, but where the second textdraw was, is were the weapons one should be.

I also have another textdraw along the bottom of the screen that shows my stats, But it wasn't even on the screen.

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            ClassMenu[i] = TextDrawCreate(250.0,170.0, "Grove\n Desert Eagle\n Shotgun\n MP5");
            TextDrawColor(ClassMenu[i],WHITE);
            TextDrawLetterSize(ClassMenu[i], 0.7, 1.50);
            TextDrawFont(ClassMenu[i],3);
            TextDrawSetShadow(ClassMenu[i],0);
            TextDrawSetOutline(ClassMenu[i],1);
            Help[i] = TextDrawCreate(20.0,240.0,"test");
            TextDrawColor(Help[i],BLACK);
            TextDrawLetterSize(Help[i], 0.4, 1.1);
            TextDrawFont(Help[i],2);
            TextDrawSetShadow(Help[i],0);
            TextDrawSetOutline(Help[i],1);
            TextDrawBackgroundColor(Help[i],WHITE);
        }
    }
// that was the first two text draws ^^
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
       
            TotalStats[i] = TextDrawCreate(10.000000,432.000000," ");
            TextDrawColor(TotalStats[i],0xFFFFFFFF);
            TextDrawUseBox(TotalStats[i],true);
            TextDrawBoxColor(TotalStats[i],0x000000AA);
            TextDrawFont(TotalStats[i],1);
            TextDrawSetOutline(TotalStats[i],true);
            TextDrawBackgroundColor(TotalStats[i],255);
            TextDrawTextSize(TotalStats[i],640.0,480.0);
            TextDrawLetterSize(TotalStats[i],0.4,1.2);
        }
    }//the stats at the bottom of my screen
That was under GameModeInIt

Under on player request class I showed them for the plaer:

pawn Код:
TextDrawShowForPlayer(playerid,ClassMenu[playerid]);
    TextDrawShowForPlayer(playerid,Help[playerid]);
I also went into TextDrawSetString for all the different teams.

and in my login command, i put the stats textdraw
pawn Код:
TextDrawShowForPlayer(playerid,TotalStats[playerid]);
can anyone tell me why there all getting mixed up with each other?


Re: TextDraws are getting mixed - iggy1 - 25.03.2011

Put this at the top of code underneath includes,
pawn Код:
#undef INVALID_TEXT_DRAW
#define INVALID_TEXT_DRAW       Text:0xFFFF
Before you use any variable to store the id of the textdraw, make it an invalid textdraw id.
Do something similar to this
pawn Код:
if(IsPlayerConnected(i))
{
    ClassMenu[i] = INVALID_TEXT_DRAW;// <<
    ClassMenu[i] = TextDrawCreate(250.0,170.0, "Grove\n Desert Eagle\n Shotgun\n MP5");
    TextDrawColor(ClassMenu[i],WHITE);
    TextDrawLetterSize(ClassMenu[i], 0.7, 1.50);
    TextDrawFont(ClassMenu[i],3);
    TextDrawSetShadow(ClassMenu[i],0);
    TextDrawSetOutline(ClassMenu[i],1);
    Help[i] = INVALID_TEXT_DRAW;// <<
    Help[i] = TextDrawCreate(20.0,240.0,"test");
    TextDrawColor(Help[i],BLACK);
    TextDrawLetterSize(Help[i], 0.4, 1.1);
    TextDrawFont(Help[i],2);
    TextDrawSetShadow(Help[i],0);
    TextDrawSetOutline(Help[i],1);
    TextDrawBackgroundColor(Help[i],WHITE);
}