Help TextDraw ,Possible ?
#1

Hello ! I have a question ,

Is it possible to do :
Код:
stock TDarmeCacher ( playerid )
{
	TextDrawHideForPlayer(playerid,TDEditor_TD[5]);
}
Instad of :
Код:
stock TDarmeCacher ( playerid )
{
	TextDrawHideForPlayer(playerid,TDEditor_TD[0]);
	TextDrawHideForPlayer(playerid,TDEditor_TD[1]);
	TextDrawHideForPlayer(playerid,TDEditor_TD[2]);
	TextDrawHideForPlayer(playerid,TDEditor_TD[3]);
	TextDrawHideForPlayer(playerid,TDEditor_TD[4]);
}
Thks for help
Reply
#2

pawn Код:
stock TDarmeCacher(playerid)
{
    for(new i = 0; i < 5; i ++)
    {
       TextDrawHideForPlayer(playerid, TDEditor_TD[i]);
    }
}
You'd need to loop the array.
Reply
#3

I'd use:
pawn Код:
stock TDarmeCacher(playerid)
{
    for(new i = 0; i < sizeof(TDEditor_TD); i ++) TextDrawHideForPlayer(playerid, TDEditor_TD[i]);
}
In fact, I wouldn't even use a function for a single line of code.
pawn Код:
#define HideTextDraws(%0) \
    for(new i = 0; i < sizeof(TDEditor_TD); i++) TextDrawHideForPlayer((%0), TDEditor_TD[i])
Example:
pawn Код:
public OnPlayerConnect(playerid)
{
    HideTextDraws(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)