SA-MP Forums Archive
TextDrawShowForPlayer loop - 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: TextDrawShowForPlayer loop (/showthread.php?tid=645270)



TextDrawShowForPlayer loop - NealPeteros - 24.11.2017

Is there any way to make this a loop instead of a repetition of the same function?

Код:
stock ShowActionTD(playerid)
{
	TextDrawShowForPlayer(playerid, ActionChoice[0]);
	TextDrawShowForPlayer(playerid, ActionChoice[1]);
	TextDrawShowForPlayer(playerid, ActionChoice[2]);
	TextDrawShowForPlayer(playerid, ActionChoice[3]);
	TextDrawShowForPlayer(playerid, ActionChoice[4]);
	TextDrawShowForPlayer(playerid, ActionChoice[5]);
	TextDrawShowForPlayer(playerid, ActionChoice[6]);
	TextDrawShowForPlayer(playerid, ActionChoice[7]);
	TextDrawShowForPlayer(playerid, ActionChoice[8]);
	TextDrawShowForPlayer(playerid, ActionChoice[9]);
	TextDrawShowForPlayer(playerid, ActionChoice[10]);
	return 1;
}
There's more of the TextDrawShowForPlayer, around 20. Could I use a for loop for this?


Re: TextDrawShowForPlayer loop - Kane - 24.11.2017

Why wouldn't you be able to?

PHP код:
stock ShowActionTD(playerid)
{
    for(new 
isizeof ActionChoicei++)
    {
        
TextDrawShowForPlayer(playeridActionChoice[i]);
    }
    
    return 
1;




Re: TextDrawShowForPlayer loop - ToiletDuck - 24.11.2017

Код:
for( new x =0; x < sizeof(ActionChoice); x++) TextDrawShowForPlayer(playerid, ActionChoice[x]);
something like this


Re: TextDrawShowForPlayer loop - NealPeteros - 24.11.2017

Well, I tried that earlier, but it only showed one of the textdraws. The first one, specifically.

EDIT: I don't know why it didn't work out the first time, but it sure did now. Thanks