SA-MP Forums Archive
TextDraw will not be hided - 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: TextDraw will not be hided (/showthread.php?tid=76722)



TextDraw will not be hided - Bearfist - 05.05.2009

This is what i got...

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	//if(newstate == PLAYER_STATE_ONFOOT) IT's from my speedo 
	//{
    //TextDrawHideForPlayer(playerid, Speedo[playerid]);
	//}
	if(newstate == PLAYER_STATE_DRIVER)
	{
	TextDrawHideForPlayer(playerid, Servertime);
  }
	return 1;
}
Код:
public ServerTime()
{
	 for(new i= 0; i < MAX_PLAYERS; i++)
	 {
		 if(IsPlayerConnected(i) == 1)
		 {
		 TextDrawDestroy(Servertime);
		 }
	 }

	 for(new i = 0; i < MAX_PLAYERS; i++)
	 {
	  if(IsPlayerConnected(i) == 1)
	  {
	  new Hour, Minute, Second;
    gettime(Hour, Minute, Second);
    format(string,sizeof(string),"Clock:%d,%d,%d",Hour,Minute,Second);
    Servertime = TextDrawCreate(540.0,440.0,string);
    TextDrawColor(Servertime,COLOR_PURPLE);
    TextDrawFont(Servertime,3);
    TextDrawLetterSize(Servertime,0.5,1.0);
    TextDrawSetShadow(Servertime,0);
    TextDrawSetOutline(Servertime,1);

    TextDrawShowForAll(Servertime);
	  }
	 }

}
When i enter a vehicle the TextDraw "Servertime" wouldn't go away ^^

Help pLs


Re: TextDraw will not be hided - Divine - 05.05.2009

public OnPlayerStateChange(playerid, newstate, oldstate)

// ... you forgot the oldstate..
it should look like this now

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT) IT's from my speedo  // MUST BE OLDSTATE ????
    {
    TextDrawHideForPlayer(playerid, Speedo[playerid]);
    }
    if(newstate == PLAYER_STATE_DRIVER)  // then goes new state :P
    {
    TextDrawHideForPlayer(playerid, Servertime);
  }
    return 1;
}



Re: TextDraw will not be hided - Rks25 - 05.05.2009

that won;t help it, as it is created repeatedly through a timer, you will have to hide it and kill the timer...


Re: TextDraw will not be hided - Weirdosport - 05.05.2009

If you leave the ShowTextDrawForAll w/e outside the timer, and just use TextDrawSetString in the timer, you could easily hide it for the player without repercussions?