SA-MP Forums Archive
Showing multiple textdraws in one command - 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: Showing multiple textdraws in one command (/showthread.php?tid=658846)



Showing multiple textdraws in one command - NealPeteros - 14.09.2018

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?


Re: Showing multiple textdraws in one command - NealPeteros - 14.09.2018

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

sorry


Re: Showing multiple textdraws in one command - Ciandlah - 14.09.2018

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]);
    }
}



Re: Showing multiple textdraws in one command - NealPeteros - 14.09.2018

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