Showing multiple textdraws in one command
#1

So I have 50 textdraws which I plan to be shown to the player with one command. Thing is that

PHP код:
CMD:show(playeridparams[])
{
    
PlayerTextDrawShow(playeridTextdraw0);
    
PlayerTextDrawShow(playeridTextdraw1);
    
PlayerTextDrawShow(playeridTextdraw2);
    
PlayerTextDrawShow(playeridTextdraw3);
    
PlayerTextDrawShow(playeridTextdraw4);
    
PlayerTextDrawShow(playeridTextdraw5);
    
PlayerTextDrawShow(playeridTextdraw6);
    
//and so on and so forth
    
return 1;

would be a tiring and long thing to do. i had this stupid idea where i

PHP код:
format(td,sizeof(td),"Textdraw%i",i); 
and i is a loop between 0 to 50. doesn't work (obv)

Is there a shorter way to show 50 textdraws instead of using 50 lines for PlayerTextDrawShow on each?
Reply
#2

okay, so my deepest apologies. decided not to be lazy and place all of those in an array. donesies

sorry
Reply
#3

Maybe create something like this
Код:
  new PlayerText:SHOWINFO[MAX_PLAYERS][MAX_TEXTDRAWS];
Then just generate a Stock for it I guess
Код:
stock CreatePlayerTextdraws(playerid)
{
    for(new i=0; i<MAX_TEXTDRAWS; i++)
    {
        SHOWINFO[playerid][i] = create your textdraws here if you want
    }
}
stock DestroyPlayerTextdraws(playerid)
{
    for(new i=0; i<MAX_TEXTDRAWS; i++)
    {
        DestroyPlayerTextdraw(playerid, SHOWINFO[playerid][i]);
    }
}
Reply
#4

Quote:
Originally Posted by Ciandlah
Посмотреть сообщение
Maybe create something like this
Код:
  new PlayerText:SHOWINFO[MAX_PLAYERS][MAX_TEXTDRAWS];
Then just generate a Stock for it I guess
Код:
stock CreatePlayerTextdraws(playerid)
{
    for(new i=0; i<MAX_TEXTDRAWS; i++)
    {
        SHOWINFO[playerid][i] = create your textdraws here if you want
    }
}
stock DestroyPlayerTextdraws(playerid)
{
    for(new i=0; i<MAX_TEXTDRAWS; i++)
    {
        DestroyPlayerTextdraw(playerid, SHOWINFO[playerid][i]);
    }
}
oh, i was trying to say that i already fixed the problem. but thanks anyway =D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)