More Textdraws (shorter way)
#1

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);
Reply
#2

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.
Reply
#3

ok. Thank you
Reply
#4

No problem, always glad to help !
Quote:

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

Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)