SA-MP Forums Archive
More Textdraws (shorter way) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: More Textdraws (shorter way) (/showthread.php?tid=264960)



More Textdraws (shorter way) - Jimbo01 - 28.06.2011

Hey all.. I made a "textdraw" wich is using 14 different textdraws. My question is if i can put this shorter or must i do it like this ?

Код:
public OnPlayerSpawn(playerid)
{
	GangZoneShowForPlayer(playerid, lsmwzone, 0xD900D3C8);
	TextDrawShowForPlayer(playerid, Textdraw0);
	TextDrawShowForPlayer(playerid, Textdraw1);
	TextDrawShowForPlayer(playerid, Textdraw2);
	TextDrawShowForPlayer(playerid, Textdraw3);
	TextDrawShowForPlayer(playerid, Textdraw4);
	TextDrawShowForPlayer(playerid, Textdraw5);
	TextDrawShowForPlayer(playerid, Textdraw6);
	TextDrawShowForPlayer(playerid, Textdraw7);
	TextDrawShowForPlayer(playerid, Textdraw8);
	TextDrawShowForPlayer(playerid, Textdraw9);
	TextDrawShowForPlayer(playerid, Textdraw10);
	TextDrawShowForPlayer(playerid, Textdraw11);
	TextDrawShowForPlayer(playerid, Textdraw12);
	TextDrawShowForPlayer(playerid, Textdraw13);
	TextDrawShowForPlayer(playerid, Textdraw14);



Re: More Textdraws (shorter way) - Virtual1ty - 28.06.2011

I suggest you leave it as it is, unless you plan to put more than 30 textdraws, it's all about how you want to
identify your textdraws, if you believe having a group of textdraws showing something representing a whole, identify it with only one variable -> an array, like so:
pawn Код:
new Text:Textdraw[15];
Then you can loop through all of these textdraws and show them to a player, or to all players by doing
pawn Код:
for (new x = 0; x < 16; x++)
    TextDrawShowForPlayer(playerid, Textdraw[x]);
It's all up to you. The way I'm doing it is, if I use 2 textdraws to represent something, I normally just take plain variables, but if I use more textdraws showing something, representing a whole, then I use an array.


AW: More Textdraws (shorter way) - Jimbo01 - 28.06.2011

ok. Thank you


Re: More Textdraws (shorter way) - Virtual1ty - 28.06.2011

No problem, always glad to help !
Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 44 seconds.




Re: More Textdraws (shorter way) - CrazyBlob - 28.06.2011

you could hide it from the main script like this


Under OnPlayerSpawn
Код:
ShowTextdraw(playerid);
And At The Bottom Off Your Gamemode

Код:
stock ShowTextdraw(playerid)
{
             TextDrawShowForPlayer(playerid, Textdraw0);
	TextDrawShowForPlayer(playerid, Textdraw1);
	TextDrawShowForPlayer(playerid, Textdraw2);
	TextDrawShowForPlayer(playerid, Textdraw3);
	TextDrawShowForPlayer(playerid, Textdraw4);
	TextDrawShowForPlayer(playerid, Textdraw5);
	TextDrawShowForPlayer(playerid, Textdraw6);
	TextDrawShowForPlayer(playerid, Textdraw7);
	TextDrawShowForPlayer(playerid, Textdraw8);
	TextDrawShowForPlayer(playerid, Textdraw9);
	TextDrawShowForPlayer(playerid, Textdraw10);
	TextDrawShowForPlayer(playerid, Textdraw11);
	TextDrawShowForPlayer(playerid, Textdraw12);
	TextDrawShowForPlayer(playerid, Textdraw13);
	TextDrawShowForPlayer(playerid, Textdraw14);
}