[Ajuda] Relogio
#1

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 .
Reply
#2

https://sampwiki.blast.hk/wiki/TogglePlayerClock
Reply
#3

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

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);
}
Reply
#5

Isso nгo vai funcionar nгo fera ...
Reply
#6

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
Reply
#7

Mas no meu funciona !
Reply
#8

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);
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)