[Ajuda] Comando /contar
#1

Galera tava precisando de um comando de contagem
Exemplo : /contar 20
Ai dava na tela
20
dps 19
dps 18
dps 17
dps 16
dps 15
dps 14
Atй o 1 ai da GOGOGO ou algo assim

Alguem me ajuda?
De preferencia um comando que de atй /contar 120
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=281966
Reply
#3

Esse que vocк me passou da para fazer /contar [segundos] ?
Que й os segundos que eu quero que conte
Reply
#4

pawn Код:
#include a_samp

new segundos = 0;

// COMANDO
    if(!strcmp(cmdtext,"/contar", true, 6))
    {
        if(!strlen(cmdtext[8]))
            return SendClientMessage(playerid, -1, "/Contar <segundos>");

        segundos = strval(cmdtext[8]);
        IniciarContagem();
        return true;
    }
   
   
//final do gamemode
IniciarContagem(); public IniciarContagem()
{
    if(segundos == 0)
    {
        GameTextForAll("Go Go Go", 2500, 3);
        return false;
    }
    new str[5]; valstr(str, segundos);
    GameTextForAll(str, 2500, 3);
    SetTimer("IniciarContagem", 1000, false);
    return segundos --;
}
Reply
#5

Quote:
Originally Posted by Micael.Nees
Посмотреть сообщение
Esse que vocк me passou da para fazer /contar [segundos] ?
Que й os segundos que eu quero que conte
pawn Код:
// no topo do gm.
new contagem, timercont;

// nos comandos

if (strcmp(cmd, "/contagem",true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessageToAll(-1, "Informe um nє para iniciar a contagem");
        contagem = strval(tmp);
        timercont = SetTimer("contt",1000, true);
        SendClientMessageToAll(-1, "Alguem iniciou a Contagem");
        return 1;
    }
   
// no final do gm
forward contt()
public contt()
{
    new str[50];
    format(str,sizeof str, "%i",contagem);
    if( contagem < 0){ format(str,sizeof str, "GO GO GO GO!"); KillTimer(timercont);}
    GameTextForAll(str,1000,3);
    contagem--;
    return 1;
}
lembrando, contagem em segundos.

@edit, nгo vi seu post garfild..
@topic o do gato tbm ta certinho hehe
Reply
#6

Quote:
Originally Posted by steeldark
Посмотреть сообщение


jeito mais simples de se fazer й esse:

pawn Код:
// no topo do gm.
new contagem, timercont;

// nos comandos

if (strcmp(cmd, "/contagem",true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessageToAll(-1, "Informe um nє para iniciar a contagem");
        contagem = strval(tmp);
        timercont = SetTimer("contt",1000, true);
        SendClientMessageToAll(-1, "Alguem iniciou a Contagem");
        return 1;
    }
   
// no final do gm
forward contt()
public contt()
{
    new str[50];
    format(str,sizeof str, "%i",contagem);
    if( contagem < 0){ format(str,sizeof str, "GO GO GO GO!"); KillTimer(timercont);}
    GameTextForAll(str,1000,3);
    contagem--;
    return 1;
}
lembrando, contagem em segundos.
O jeito mais simples foi oque eu postei acima, nгo precisa de strtok.
Reply
#7

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
O jeito mais simples foi oque eu postei acima, nгo precisa de strtok.
hehe, eu vi, eґq tava testando. e deixei a pagina aberta.. quando postei vc ja tinha postado.. ateґeditei la.. hehe
Reply
#8

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
pawn Код:
#include a_samp

new segundos = 0;

// COMANDO
    if(!strcmp(cmdtext,"/contar", true, 6))
    {
        if(!strlen(cmdtext[8]))
            return SendClientMessage(playerid, -1, "/Contar <segundos>");

        segundos = strval(cmdtext[8]);
        IniciarContagem();
        return true;
    }
   
   
//final do gamemode
IniciarContagem(); public IniciarContagem()
{
    if(segundos == 0)
    {
        GameTextForAll("Go Go Go", 2500, 3);
        return false;
    }
    new str[5]; valstr(str, segundos);
    GameTextForAll(str, 2500, 3);
    SetTimer("IniciarContagem", 1000, false);
    return segundos --;
}
DUVIDA: Da para todos do sv verem a contagem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)