SA-MP Forums Archive
[Ajuda] Relogio - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Relogio (/showthread.php?tid=486863)



Relogio - SkullFire - 10.01.2014

Nгo encontrei nenhum tipo de tutorial que ensine a criar um relуgio parecido com o do gta off.Alguem sabe onde tem um, ou me possa dar o exemplo de um ? rs, obrigado .


Re: Relogio - Gii - 10.01.2014

https://sampwiki.blast.hk/wiki/TogglePlayerClock


Re: Relogio - SkullFire - 10.01.2014

Na verdade, eu queria tentar criar o meu prуprio. Quero basear ele no do Brazucas RPG....


Re: Relogio - ZaturN - 10.01.2014

pawn Код:
new Text:gText2[MAX_PLAYERS];
new horas = 0;
new minu = 0;
pawn Код:
gText2[i] = TextDrawCreate(550.00, 20.00, " ");
TextDrawFont(gText2[i],3);
TextDrawBackgroundColor(gText2[i], 255);
TextDrawSetOutline(gText2[i], 2);
TextDrawColor(gText2[i], -1);
TextDrawLetterSize(gText2[i],0.5,2.0);
pawn Код:
new stringr[256];
if (minu <= 9){format(stringr,25,"~w~%02d:%02d",horas,minu);}
else {format(stringr,25,"~w~%02d:%02d",horas,minu);}
TextDrawSetString(gText2[i], stringr);
}



Re: Relogio - SkullFire - 10.01.2014

Isso nгo vai funcionar nгo fera ...


Re: Relogio - Gii - 10.01.2014

pawn Код:
#include a_samp
#include timerfix

new hora = 0, minuto = 0;
forward updateClock();

public OnGameModeInit() {

    SetTimer("updateClock", 1000, true);
    return 1;
}

public updateClock() {

    minuto++;

    if ( hora == 23 && minuto > 59 )
        hora = 0, minuto = 0, printf("%02d:%02d", hora, minuto);
    else if ( minuto > 59 )
        minuto = 0, hora++, printf("%02d:%02d", hora, minuto);
    else
        printf("%02d:%02d", hora, minuto);

    return 1;
}
Crie a textdraw, e no lugar de printar no console formate a textdraw, recomendo o uso da include timerfix!

https://sampforum.blast.hk/showthread.php?tid=289675


Re: Relogio - ZaturN - 10.01.2014

Mas no meu funciona !


Re: Relogio - SkullFire - 10.01.2014

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
pawn Код:
#include a_samp
#include timerfix

new hora = 0, minuto = 0;
forward updateClock();

public OnGameModeInit() {

    SetTimer("updateClock", 1000, true);
    return 1;
}

public updateClock() {

    minuto++;

    if ( hora == 23 && minuto > 59 )
        hora = 0, minuto = 0, printf("%02d:%02d", hora, minuto);
    else if ( minuto > 59 )
        minuto = 0, hora++, printf("%02d:%02d", hora, minuto);
    else
        printf("%02d:%02d", hora, minuto);

    return 1;
}
Crie a textdraw, e no lugar de printar no console formate a textdraw, recomendo o uso da include timerfix!

https://sampforum.blast.hk/showthread.php?tid=289675
Valeu, vou dar uma olhada aqui..


@EDIT

Quando eu formato o textdraw, tenho que formatar a string dele correto?
TextDrawSetString(Relogio, string);


Re: Relogio - Gii - 10.01.2014

pawn Код:
new str[5];
format (str, 5, "%02d:%02d", hora, minuto);
TextDrawSetString(..., str);



Re: Relogio - SkullFire - 10.01.2014

Dei uma editada bбsica aqui, vocк esqueceu de um Hrs++;
PHP код:
public RELOGIM()
{
    new 
string[128];
    
Min++;
    if ( 
Hrs == 23 && Min 59 )
    {
        
        
Hrs 0Min 0format(stringsizeof string,"~g~%02d:%02d",Hrs,Min);
        
TextDrawSetString(Relogiostring);
        return 
1;
    }
    else if ( 
Min 59 )
    {
        
        
Min 0format(stringsizeof string,"~g~%02d:%02d",Hrs,Min);
        
TextDrawSetString(Relogiostring);
        
Hrs++;
    }
    else
    {
        
        
format(stringsizeof string,"~g~%02d:%02d"HrsMin);
        
TextDrawSetString(Relogiostring);
        return 
1;
    } 
Na verdade eu mesmo que tinha apagado e nem vi, acabei de ver no seu cуdigo de novo , rsrs