TextDraw
#1

Is it possible to create TextDraws using for loop?

I have tried that, but it didn't worked.

Код HTML:
new Text:TD[5];

OnGameModeInit()
{
new Float: x, Float: y;

x = 146.0;
y = 156.0;

   for(new i = 0; i < 5; i++)
   {
   TD[i] = TextDrawCreate(x+=10.0, y+=10.0, "Text");  
   }

}
Can anyone give me an example how to do it?
Reply
#2

You don't need to create extra variable for the cords.

pawn Код:
new Text:TD[5];

public OnGameModeInit()
{
    new Float: x, Float: y;

    for(new i = 0; i < sizeof(TD); i++)
    {
       TD[i] = TextDrawCreate(156.0, 166.0, "Text");
    }
    return 1;
}
Reply
#3

Thanks, but what I have to do to print out TextDraws in for loop like this:

Text
Text
Text

Is it even possible?
Reply
#4

Yes it's possible, try this:
pawn Код:
new Text:TD[5];

OnGameModeInit()
{
    new Float: x = 146.0, Float: y = 156.0;

    for(new i = 0; i < sizeof(TD); i++)
    {
        TD[i] = TextDrawCreate(x, y, "Text");

        x += 10, y += 10;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)