textdraw hide show command - 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: textdraw hide show command (
/showthread.php?tid=572765)
textdraw hide show command -
SalmaN97 - 01.05.2015
hello i am trying to do a command which will hide and show the textdraw whenever the player wants
PHP код:
CMD:tdoption(playerid, params[])
{
if(textdraw[playerid] >= 0)
{
TextDrawHideForPlayer(playerid, Main);
TextDrawHideForPlayer(playerid, Website);
textdraw[playerid] = 1;
}
else if(textdraw[playerid] >= 1)
{
TextDrawShowForPlayer(playerid, Main);
TextDrawShowForPlayer(playerid, Website);
textdraw[playerid] = 0;
}
return 1;
}
when i enter it first time it hide it but when i enter it second time it will not show the textdraws
thanks in advance
Re: textdraw hide show command -
Alpay0098 - 01.05.2015
You can use a variable like
new IsWatchingTD[MAX_PLAYERS] = 0; in your OnPlayerConnect section or stuff ... .
And you can use like below :
PHP код:
CMD:tdoption(playerid, params[])
{
if(IsWatchingTD[playerid] == 1)
{
TextDrawHideForPlayer(playerid, Main);
TextDrawHideForPlayer(playerid, Website);
IsWatchingTD[playerid] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Textdraws got hidden!");
}
else if(IsWatchingTD[playerid] == 0)
{
TextDrawShowForPlayer(playerid, Main);
TextDrawShowForPlayer(playerid, Website);
IsWatchingTD[playerid] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Textdraws got shown!");
}
return 1;
}
* It's just an example!