[Ajuda] Relogio Doido
#1

Galera o relogio do meu servidor ta bugado e nгo consigo resolver! Nгo sei porque ele estб assim, foi depois que eu mechi na Text embaixo do radar, ai eu tirei as variaveis, as textdraws, as funзхes que faz a Text sumir e aparecer tirei tudo, e testei assim, e o relogio fico normal '-'

Ai eu coloquei a text e comeзa dnv, nгo sei porque estб assim, sendo que a text embaixo do radar nгo tem nada a ver com o relogio:

o relogio fica bugado assim, a cada 1 segundo fica trocando

Alguйm sabe oque pode ser?

Код:
    // =======Relogio ========//
	SetTimer("settime",1000,true);
	Date = TextDrawCreate(547.000000,11.000000,"--");
	TextDrawFont(Date,3);
	TextDrawLetterSize(Date,0.399999,1.600000);
	TextDrawColor(Date,0xffffffff);
	Time = TextDrawCreate(547.000000,28.000000,"--");
	TextDrawFont(Time,3);
	TextDrawLetterSize(Time,0.399999,1.600000);
	TextDrawColor(Time,0xffffffff);
	// ====== Novo Barra ======//

    TextDraw0 = TextDrawCreate(645.500000, 432.699981, "usebox");
    TextDrawLetterSize(TextDraw0, 0.124500, 1.487780);
    TextDrawTextSize(TextDraw0, -2.000000, 0.000000);
    TextDrawAlignment(TextDraw0, 1);
    TextDrawColor(TextDraw0, 0);
    TextDrawUseBox(TextDraw0, true);
    TextDrawBoxColor(TextDraw0, 102);
    TextDrawSetShadow(TextDraw0, 0);
    TextDrawSetOutline(TextDraw0, 0);
    TextDrawFont(TextDraw0, 1);
Reply
#2

Mostra o que acontece no timer.
Reply
#3

PHP код:
public settime(playerid)
{
    new 
string[256],yearr,monthh,dayy,hourss,minutess,secondss;
    
getdate(yearrmonthhdayy), gettime(hourssminutesssecondss);
    
format(stringsizeof string"%d/%s%d/%s%d"dayy, ((monthh 10) ? ("0") : ("")), monthh, (yearr 10) ? ("0") : (""), yearr);
    
TextDrawSetString(Datestring);
    
format(stringsizeof string"%s%d:%s%d:%s%d", (hourss 10) ? ("0") : (""), hourss, (minutess 10) ? ("0") : (""), minutess, (secondss 10) ? ("0") : (""), secondss);
    
TextDrawSetString(Timestring);

Reply
#4

Quote:
Originally Posted by zCyan
Посмотреть сообщение
PHP код:
public settime(playerid)
{
    new 
string[256],yearr,monthh,dayy,hourss,minutess,secondss;
    
getdate(yearrmonthhdayy), gettime(hourssminutesssecondss);
    
format(stringsizeof string"%d/%s%d/%s%d"dayy, ((monthh 10) ? ("0") : ("")), monthh, (yearr 10) ? ("0") : (""), yearr);
    
TextDrawSetString(Datestring);
    
format(stringsizeof string"%s%d:%s%d:%s%d", (hourss 10) ? ("0") : (""), hourss, (minutess 10) ? ("0") : (""), minutess, (secondss 10) ? ("0") : (""), secondss);
    
TextDrawSetString(Timestring);

Sу pra frisar:
Para adicionar '0' (zero) automaticamente em funзхes de output nгo й necessбrio a utilizaзгo da operaзгo ternбria ou qualquer gambiarra para esta finalidade.
Otimize seu code desta forma:

Код:
public settime(playerid)
{
	new string[12], yearr, monthh, dayy, hourss, minutess, secondss;
	getdate(yearr, monthh, dayy);
	gettime(hourss, minutess, secondss);
	format(string, sizeof string, "%02d/%02d/%04d", dayy, monthh, yearr);
	TextDrawSetString(Date, string);
        TextDrawShowForPlayer(playerid, Date);
	format(string, sizeof string, "%02d:%02d:%02d", hourss, minutess, secondss);
	TextDrawSetString(Time, string);
        TextDrawShowForPlayer(playerid, Time);
}
Tenta desta forma...
Reply
#5

Nгo adianto, apenas como vocк disse, otimizo sу, mais o bug continua. O Engraзado й que eu coloquei outro relogio e deu a mesma coisa tambйm '-'. Sendo que a Text embaixo do radar nгo liga a nada no relogio:

Ela ta assim:

PHP код:
new Text:TextDraw0;
//OnGameModeInit
A Text
//OnPlayerSpawn
Funзгo que faz ela aparecer '-' 
Sу isso, ai nгo sei porque o relogio fica assim, quando tira a text ele fica normal '-', muito estranho
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)