Too slow...
#1

Well I've made textdraw that will say how much time server is running. Now the problem is that timer is going too much slow... Here's the code:

On top of my GM
PHP Code:
new gSeconds 0// counts how many seconds server is running
new TextgText//My Global text 
PHP Code:
public TimeServerRunning() {
    new 
string[16];
    
TextDrawDestroy(gText);
    
gSeconds++;
    
format(stringsizeof string"%s"TimeConvert(gSeconds));
    
gText TextDrawCreate(79323string);
    
TextDrawUseBox(gTexttrue);
    
TextDrawTextSize(gText50.020.0);
    
TextDrawShowForAll(gText);

bellow it:
PHP Code:
TimeConvert(time) {
    new 
minutes;
    new 
seconds;
    new 
string[128];
    if(
time 59){
        
minutes floatround(time/60);
        
seconds floatround(time minutes*60);
        if(
seconds>9)format(string,sizeof(string),"%d:%d",minutes,seconds);
        else 
format(string,sizeof(string),"%d:0%d",minutes,seconds);
    }
    else{
        
seconds floatround(time);
        if(
seconds>9)format(string,sizeof(string),"0:%d",seconds);
        else 
format(string,sizeof(string),"0:0%d",seconds);
    }
    return 
string;

OnPlayerConnect:

PHP Code:
new string[16];
    
TextDrawDestroy(gText);
    
gSeconds++;
    
format(stringsizeof string"%s"TimeConvert(gSeconds));
    
gText TextDrawCreate(79323string);
    
TextDrawUseBox(gTexttrue);
    
TextDrawTextSize(gText50.020.0);
    
TextDrawShowForAll(gText); 
On the end of my script
PHP Code:
forward TimeServerRunning(); 
The thing is that each minute converts over like 10 minutes. Every 10 minutes it converts like to 1 minute...


No Errors on compile btw
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)