SA-MP Forums Archive
How to Tell if textdraw is showing - 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: How to Tell if textdraw is showing (/showthread.php?tid=226829)



How to Tell if textdraw is showing - Windows7 - 16.02.2011

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


Re: How to Tell if textdraw is showing - Jochemd - 16.02.2011

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


Re: How to Tell if textdraw is showing - Windows7 - 16.02.2011

i'll try it out thx


Re: How to Tell if textdraw is showing - Windows7 - 16.02.2011

can type an example?


Re: How to Tell if textdraw is showing - Jochemd - 16.02.2011

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


Re: How to Tell if textdraw is showing - Windows7 - 16.02.2011

Thanks so much!!