02.02.2012, 22:12
Well I am trying to make draws to all players time how long you are running your server...
So if server is running 5 hours it should say so.
Errors:
I tried doing new
But still it was saying sort of "Never used"...
Here's the code:
So if server is running 5 hours it should say so.
Errors:
PHP код:
error 017: undefined symbol "text1"
PHP код:
Text: text1;
Here's the code:
PHP код:
new gSeconds = 0;
new Text: gText; // global "Text"
forward TimeServerRunning();
PHP код:
SetTimer("TimeServerRunning", 1000, true);
PHP код:
public TimeServerRunning() {
new string[16];
TextDrawDestroy(gText);
gSeconds++;
format(string, sizeof string, "%s", TimeConvert(gSeconds));
text1 = TextDrawCreate(10.0, 100.0, string);
TextDrawUseBox(gText, true);
TextDrawTextSize(gText, 50.0, 20.0);
TextDrawShowForAll(gText);
}
PHP код:
TimeConvert(time) {
new minutes;
new seconds;
new string[256];
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;
}