TextDrawShowForPlayer loop
#1

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?
Reply
#2

Why wouldn't you be able to?

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

Reply
#3

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)