03.02.2012, 14:33
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
bellow it:
OnPlayerConnect:
On the end of my script
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
On top of my GM
PHP Code:
new gSeconds = 0; // counts how many seconds server is running
new Text: gText; //My Global text
PHP Code:
public TimeServerRunning() {
new string[16];
TextDrawDestroy(gText);
gSeconds++;
format(string, sizeof string, "%s", TimeConvert(gSeconds));
gText = TextDrawCreate(79, 323, string);
TextDrawUseBox(gText, true);
TextDrawTextSize(gText, 50.0, 20.0);
TextDrawShowForAll(gText);
}
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;
}
PHP Code:
new string[16];
TextDrawDestroy(gText);
gSeconds++;
format(string, sizeof string, "%s", TimeConvert(gSeconds));
gText = TextDrawCreate(79, 323, string);
TextDrawUseBox(gText, true);
TextDrawTextSize(gText, 50.0, 20.0);
TextDrawShowForAll(gText);
PHP Code:
forward TimeServerRunning();
No Errors on compile btw