TextDraw will not be hided
#1

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

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;
}
Reply
#3

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

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)