SA-MP Forums Archive
Textdraw problem [Small problem] [+rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Textdraw problem [Small problem] [+rep] (/showthread.php?tid=315380)



Textdraw problem [Small problem] [+rep] - Twinki1993 - 02.02.2012

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:
PHP код:
 error 017undefined symbol "text1" 
I tried doing new
PHP код:
Texttext1
But still it was saying sort of "Never used"...

Here's the code:

PHP код:
new gSeconds 0
new 
TextgText// global "Text"
forward TimeServerRunning(); 
PHP код:
SetTimer("TimeServerRunning"1000true); 
PHP код:
public TimeServerRunning() {
    new 
string[16];
    
TextDrawDestroy(gText);
    
gSeconds++;
    
format(stringsizeof string"%s"TimeConvert(gSeconds));
    
text1 TextDrawCreate(10.0100.0string);
    
TextDrawUseBox(gTexttrue);
    
TextDrawTextSize(gText50.020.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;




Re: Textdraw problem [Small problem] [+rep] - Jack_Leslie - 02.02.2012

Have you got
"new Text: text1;" at the very top of your script ?


Re: Textdraw problem [Small problem] [+rep] - Twinki1993 - 02.02.2012

Well no, since it's giving me
Quote:

warning 204: symbol is assigned a value that is never used: "text1"




Re: Textdraw problem [Small problem] [+rep] - IceCube! - 02.02.2012

pawn Код:
text1 = TextDrawCreate(10.0, 100.0, string);
This should be

pawn Код:
gText = TextDrawCreate(10.0, 100.0, string);
This also why run it EVERY second thats going to cause lag...


Re: Textdraw problem [Small problem] [+rep] - Twinki1993 - 02.02.2012

Doesnt work in game. Compiled it normally.


Re: Textdraw problem [Small problem] [+rep] - Twinki1993 - 03.02.2012

Well after playing some time, around 10-20 minutes, it said 0:03 .... It's chaning REALLY slowly


Re: Textdraw problem [Small problem] [+rep] - Twinki1993 - 03.02.2012

help?


Re: Textdraw problem [Small problem] [+rep] - iZN - 03.02.2012

Can you show me the line of this error:
Код:
 error 017: undefined symbol "text1"



Re: Textdraw problem [Small problem] [+rep] - Twinki1993 - 03.02.2012

I dont have the error anymore. I have only the problem of the timer... It's so slow...