SA-MP Forums Archive
[AJUDA] Fazendo um timer com TextDraw - 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] Fazendo um timer com TextDraw (/showthread.php?tid=271057)



[AJUDA] Fazendo um timer com TextDraw - pi - 22.07.2011

Alguem pode me dizer quais sгo as funзхes para fazer um timer em textdraw?

Tipo, um timer de 00:10 dai comeзa a contar

00:10
00:09

etc...


Re: [AJUDA] Fazendo um timer com TextDraw - RockFire - 22.07.2011

PHP код:
public OnGameModeInit()
{
    
// Cуdigos do textdraw
    
SetTimer("Timer",1000,true);
    return 
true;
}
forward Timer();
public 
Timer()
{
    new 
sStr[10],h[3];
    
gettime(h[0],h[1],h[2]);
    
format(sStr,sizeof(sStr),"%d:%d:%d",h[0],h[1],h[2]);
    
TextDrawSetString(textdrawid,sStr);
    return 
true;




Re: [AJUDA] Fazendo um timer com TextDraw - pi - 22.07.2011

Valeu Felipe


Re: [AJUDA] Fazendo um timer com TextDraw - Shadoww5 - 22.07.2011

Lembre-se de criar a textdraw no OnGameModeInit e de mostrar/ocultar quando a contagem comeзar/terminar.


Re: [AJUDA] Fazendo um timer com TextDraw - s4kuL - 13.10.2016

Nгo testei.

pawn Код:
new Text:Contagem;
new TimerContagem;
new TempoDaContagem = 10;

public OnGameModeInit()
{
    Contagem = TextDrawCreate(300, 300, "_");
    TextDrawFont(Contagem , 1);
    TextDrawLetterSize(Contagem , 2, 14);
    TextDrawColor(Contagem , -1);
    TextDrawSetOutline(Contagem , 0);
    TextDrawSetProportional(Contagem , 1);
    TextDrawSetShadow(Contagem , 0);

    return true;
}

CMD:iniciarcontagem(playerid)
{
    SendClientMessage(playerid, -1, "Contagem de 10 segundos inciada!");
   
    TextDrawShowForAll(Contagem);
    TimerContagem = SetTimer("Timer", 1000, true);
    return 1;
}

forward Timer();
public Timer()
{
    TempoDaContagem --;
   
    new String[2];
    format(String,sizeof(String),"%d",TempoDaContagem);
    TextDrawSetString(Contagem, String);
   
    if(TempoDaContagem == 0)
    {
        TempoDaContagem = 10;
        KillTimer(TimerContagem);
        TextDrawHideForAll(Contagem);
    }
    return 1;
}
Mas й mais ou menos assim..


Re: [AJUDA] Fazendo um timer com TextDraw - FalcaoNC - 13.10.2016

Quote:
Originally Posted by s4kuL
Посмотреть сообщение
Nгo testei.

pawn Код:
new Text:Contagem;
new TimerContagem;
new TempoDaContagem = 10;

public OnGameModeInit()
{
    Contagem = TextDrawCreate(300, 300, "_");
    TextDrawFont(Contagem , 1);
    TextDrawLetterSize(Contagem , 2, 14);
    TextDrawColor(Contagem , -1);
    TextDrawSetOutline(Contagem , 0);
    TextDrawSetProportional(Contagem , 1);
    TextDrawSetShadow(Contagem , 0);

    return true;
}

CMD:iniciarcontagem(playerid)
{
    SendClientMessage(playerid, -1, "Contagem de 10 segundos inciada!");
   
    TextDrawShowForAll(Contagem);
    TimerContagem = SetTimer("Timer", 1000, true);
    return 1;
}

forward Timer();
public Timer()
{
    TempoDaContagem --;
   
    new String[2];
    format(String,sizeof(string),"%d",TempoDaContagem);
    TextDrawSetString(Contagem, String);
   
    if(TempoDaContagem == 0)
    {
        TempoDaContagem = 10;
        KillTimer(TimerContagem);
        TextDrawShowForAll(Contagem);
    }
    return 1;
}
Mas й mais ou menos assim..
й de 2011 '-' kkk..


Re: [AJUDA] Fazendo um timer com TextDraw - s4kuL - 13.10.2016

Quote:
Originally Posted by FalcaoNC
Посмотреть сообщение
й de 2011 '-' kkk..
Acabei de fazer o cуdigo aqui, como й de 2011?


Re: [AJUDA] Fazendo um timer com TextDraw - FalcaoNC - 13.10.2016

Quote:
Originally Posted by s4kuL
Посмотреть сообщение
Acabei de fazer o cуdigo aqui, como й de 2011?
Estou falando que quando o cara criou esse tуpico "22/07/2011, 04:15 PM"


Re: [AJUDA] Fazendo um timer com TextDraw - CrowleyNWD - 14.10.2016

Quote:
Originally Posted by s4kuL
Посмотреть сообщение
Nгo testei.

pawn Код:
new Text:Contagem;
new TimerContagem;
new TempoDaContagem = 10;

public OnGameModeInit()
{
    Contagem = TextDrawCreate(300, 300, "_");
    TextDrawFont(Contagem , 1);
    TextDrawLetterSize(Contagem , 2, 14);
    TextDrawColor(Contagem , -1);
    TextDrawSetOutline(Contagem , 0);
    TextDrawSetProportional(Contagem , 1);
    TextDrawSetShadow(Contagem , 0);

    return true;
}

CMD:iniciarcontagem(playerid)
{
    SendClientMessage(playerid, -1, "Contagem de 10 segundos inciada!");
   
    TextDrawShowForAll(Contagem);
    TimerContagem = SetTimer("Timer", 1000, true);
    return 1;
}

forward Timer();
public Timer()
{
    TempoDaContagem --;
   
    new String[2];
    format(String,sizeof(string),"%d",TempoDaContagem);
    TextDrawSetString(Contagem, String);
   
    if(TempoDaContagem == 0)
    {
        TempoDaContagem = 10;
        KillTimer(TimerContagem);
        TextDrawHideForAll(Contagem);
    }
    return 1;
}
Mas й mais ou menos assim..
Tem um erro no seu forward.. na linha do format, colocou o string com letra minъscula..

PHP код:
    format(String,sizeof(String),"%d",TempoDaContagem); 



Re: [AJUDA] Fazendo um timer com TextDraw - RedMF - 14.10.2016

Quote:
Originally Posted by CrowleyNWD
Посмотреть сообщение
Tem um erro no seu forward.. na linha do format, colocou o string com letra minъscula..

PHP код:
    format(String,sizeof(String),"%d",TempoDaContagem); 
vdd como descobriu?
ja sei vocк testou ele ne