Textdraw update help
#1

Trying do make textdraw update every second but won't do it.


Gamemodeint
Код:
SetTimer("UpdateMapTimer", 1000, 1);
PHP код:
public UpdateMapTimer()
{
    foreach (
Playeri)
    {
        
TextDrawShowForPlayer(iMapdraw0);
     }
     return 
1;

Reply
#2

Try:
PHP код:
public UpdateMapTimer() 

    foreach (
Playeri
    { 
        
TextDrawHideForPlayer(iMapdraw0); 
        
TextDrawShowForPlayer(iMapdraw0); 
     } 
     return 
1

Reply
#3

Why don't you make a global boolean variable and make function like this:

PHP код:
new bool:mapTextDrawShowing[MAX_PLAYERS]; // On top
public UpdateMapTimer()
{
    foreach (
Playeri)
    {
        if(
mapTextDrawShowing[i])
            
// Set Map Showing Variable to: FALSE
            
mapTextDrawShowing[i] = false;
            
            
// Return Hide Function
            
return TextDrawHideForPlayer(iMapdraw0);
        } else {
            
// Set Map Showing Variable to: TRUE
            
mapTextDrawShowing[i] = true;
        
            
// Return Show Function
            
return TextDrawShowForPlayer(iMapdraw0);
        }
     }
     return 
1;


Quote:
Originally Posted by Hellman92
Посмотреть сообщение
Trying do make textdraw update every second but won't do it.


Gamemodeint
Код:
SetTimer("UpdateMapTimer", 1000, 1);
PHP код:
public UpdateMapTimer()
{
    foreach (
Playeri)
    {
        
TextDrawShowForPlayer(iMapdraw0);
     }
     return 
1;

Reply
#4

Quote:
Originally Posted by Hellman92
Посмотреть сообщение
Trying do make textdraw update every second but won't do it.


PHP код:
public UpdateMapTimer()
{
    foreach (
Playeri)
    {
        
TextDrawShowForPlayer(iMapdraw0);
     }
     return 
1;

What do you want exactly?

Your first code will show only the textdraw in every second.

Do you want update the text of the textdraw?

Use this:

Код:
TextDrawSetString(Mapdraw0, string);
If you want just change the String, this is a better way, than hide and show the textdraw.
Reply
#5

Quote:
Originally Posted by Danx
Посмотреть сообщение
What do you want exactly?

Your first code will show only the textdraw in every second.

Do you want update the text of the textdraw?

Use this:

Код:
TextDrawSetString(Mapdraw0, string);
If you want just change the String, this is a better way, than hide and show the textdraw.
Can u give me an ect?
Reply
#6

Quote:
Originally Posted by Hellman92
Посмотреть сообщение
Can u give me an ect?
PHP код:
public OnGamemodeInit()
{
    
SetTimer("UpdateMapTimer"1000false);
    return 
1;
}
public 
UpdateMapTimer()
{
    foreach (
Playeri)
    {
        
TextDrawShowForPlayer(iMapdraw0);
        
SetTimer("UpdateMapTimer2",1000,false);
       }
    return 
1;
}
forward UpdateMapTimer2();
public 
UpdateMapTimer2()
{
    foreach(
player,i)
    {
        
TextDrawHideForPlayer(i,Mapdraw0);
        
TextDrawSetString(Mapdraw0,"New Map Name 2");
        
SetTimer("UpdateMapTimer3",1000,false);
    }
    return 
1;
}
forward UpdateMapTimer3();
public 
UpdateMapTimer3()
{
    foreach(
player,i)
    {
        
TextDrawHideForPlayer(i,Mapdraw0);
        
TextDrawSetString(Mapdraw0,"New Map Name 3");
        
SetTimer("UpdateMapTimer",1000,false);
    }
    return 
1;
}
//Back to Map 1 , Keep do It 
Replace That !

And dont Forget to Change String"" !
Reply
#7

Quote:
Originally Posted by Amunra
Посмотреть сообщение
PHP код:
public OnGamemodeInit()
{
    
SetTimer("UpdateMapTimer"1000false);
    return 
1;
}
public 
UpdateMapTimer()
{
    foreach (
Playeri)
    {
        
TextDrawShowForPlayer(iMapdraw0);
        
SetTimer("UpdateMapTimer2",1000,false);
       }
    return 
1;
}
forward UpdateMapTimer2();
public 
UpdateMapTimer2()
{
    foreach(
player,i)
    {
        
TextDrawHideForPlayer(i,Mapdraw0);
        
TextDrawSetString(Mapdraw0,"New Map Name 2");
        
SetTimer("UpdateMapTimer3",1000,false);
    }
    return 
1;
}
forward UpdateMapTimer3();
public 
UpdateMapTimer3()
{
    foreach(
player,i)
    {
        
TextDrawHideForPlayer(i,Mapdraw0);
        
TextDrawSetString(Mapdraw0,"New Map Name 3");
        
SetTimer("UpdateMapTimer",1000,false);
    }
    return 
1;
}
//Back to Map 1 , Keep do It 
Replace That !

And dont Forget to Change String"" !
is that necessary with so many timers?
Reply
#8

Quote:
Originally Posted by Hellman92
Посмотреть сообщение
is that necessary with so many timers?
1 Second / Every Second ..
Reply
#9

Quote:
Originally Posted by Hellman92
Посмотреть сообщение
Can u give me an ect?
Код:
public OnPlayerConnect(playerid)
{
        TextDrawShowForPlayer(playerid, Mapdraw0);
	return 1;
}
Код:
public UpdateMapTimer()
{
    foreach (Player, i)
    {
        new string[25];
        new hour,minute,second;
	gettime(hour,minute,second);

	format(string, sizeof(string), "Time: %d:%d:%d", hour,minute,second);
	TextDrawSetString(Mapdraw0, string);
     }
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)