SA-MP Forums Archive
Help TextDraw ,Possible ? - 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: Help TextDraw ,Possible ? (/showthread.php?tid=543627)



Help TextDraw ,Possible ? - StreetRP - 27.10.2014

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


Re: Help TextDraw ,Possible ? - DanishHaq - 28.10.2014

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


Re: Help TextDraw ,Possible ? - Threshold - 28.10.2014

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