How to Tell if textdraw is showing
#1

Hi everyone i need some help on TextDraws how do you tell if a textdraw is showing?

this is what i have so fair..
Код:
		if(TextDrawShowForPlayer(playerid, Textdraw0) == true)
		{
		  	SendPlayerMessageToAll(playerid,"Textdraw 0 is showing");
		}
		else if(TextDrawShowForPlayer(playerid, Textdraw1) == true)
		{
			SendPlayerMessageToAll(playerid,"Textdraw 1 is showing");
		}
Thanks so much for your help
Reply
#2

Use an enumeration and some stock (I.E: TextDrawShowForPlayerEx which sets the variable in the enumeration to 1 automatically)
Reply
#3

i'll try it out thx
Reply
#4

can type an example?
Reply
#5

Sure, wait a second

Just notices it's better to do with a multi-dimensional array. I will make an example for that instead of enum

Add to top of script, to the other "new"
pawn Код:
new TextDrawShowed[MAX_TEXT_DRAWS][MAX_PLAYERS]; // 0 = hided ... 1 = showed
And here are your stocks
pawn Код:
stock TextDrawShowForPlayerEx(playerid,drawid) // Playerid it has to show for and draw it has to show (returned value on TextDrawCreate)
{
    TextDrawShowForPlayer(playerid,text); // Showing textdraw
    TextDrawShowed[drawid][playerid] = 1; // Since '1' means showed, we got to set it to 1
    return 1; // The return doesn't matter as it doesn't return any value
}

stock TextDrawHideForPlayerEx(playerid,drawid) // Playerid it has to hide for and draw it should hide (returned value on TextDrawCreate)
{
    TextDrawHideForPlayer(playerid,text); // Hiding textdraw
    TextDrawShowed[drawid][playerid] = 0; // 0 means hided, so we set it back to 0
    return 1; // The return doesn't matter as it doesn't return any value
}

stock IsTextDrawShowed(playerid,drawid)
{
    return TextDrawShowed[drawid][playerid]; // Returns 0 if it's hided, or returns 1 if it's showed (but only if you have used the above stocks)
}
Maybe this is not the best way, but you will get an idea of what to do though?

Jochem
Reply
#6

Thanks so much!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)