Loops + Textdraws
#5

Quote:
Originally Posted by Basicz
Посмотреть сообщение
I don't think so at TheKiller and John Cooper's post, because
pawn Код:
if(PVar[i][InRound] && PVar[i][Team] != T_BUM && PVar[i][Team] != T_AWAY && PVar[i][Team] != SUB_ATT && PVar[i][Team] != SUB_DEF)

if(PVar[i][Team] == T_ATT)

else if(PVar[i][Team] == T_DEF)
What about showing it's textdraw first before setting the string?
That would make no difference. The reason why it is only showing the player the textdraw is how the loop is structured. You either need a loop inside a loop or use TextDrawShowForAll. This is why below:

pawn Код:
foreach(Player, i) //This loops through all players
    {
        if(PVar[i][InRound] && PVar[i][Team] != T_BUM && PVar[i][Team] != T_AWAY && PVar[i][Team] != SUB_ATT && PVar[i][Team] != SUB_DEF) //This part doesn't really matter, just checks if the player is in teams
        {
            if(PVar[i][Team] == T_ATT)
            {
                Line[i] = TextDrawCreate(566.00, AttStartY, "_"); //This creates the players textdraw
                Name[i] = TextDrawCreate(561.00, AttNameStartY, "_"); //This creates the players second td

                format(AttNameStr, sizeof(AttNameStr), "~r~%s", pName(i));
                TextDrawSetString(Name[i], AttNameStr);

                AttStartY += 6.40;
                AttNameStartY += 6.40;

                //TextDrawShowForPlayer(i, Name[i]);
            }
            else if(PVar[i][Team] == T_DEF)
            {
                Line[i] = TextDrawCreate(5.00, DefStartY, "_");
                Name[i] = TextDrawCreate(74.00, DefNameStartY, "_");

                format(DefNameStr, sizeof(DefNameStr), "~r~%s", pName(i));
                TextDrawSetString(Name[i], DefNameStr);

                DefStartY += 6.40;
                DefNameStartY += 6.40;

                //TextDrawShowForPlayer(i, Name[i]);
            }
            TextDrawShowForPlayer(i, Name[i]); //Here it only shows the textdraw for the player that we are currently on.
        }
    }
See, you need to have a loop after you created the textdraw or just use TextDrawShowForAll.
Reply


Messages In This Thread
Loops + Textdraws - by [L3th4l] - 04.10.2011, 01:19
Re: Loops + Textdraws - by [HiC]TheKiller - 04.10.2011, 05:48
Re: Loops + Textdraws - by John_Cooper - 04.10.2011, 05:59
Re: Loops + Textdraws - by Basicz - 04.10.2011, 09:23
Re: Loops + Textdraws - by [HiC]TheKiller - 04.10.2011, 09:54
Re: Loops + Textdraws - by [L3th4l] - 04.10.2011, 15:40

Forum Jump:


Users browsing this thread: 2 Guest(s)