[Pedido] Sistema de Contagem
#1

Ola, eu queria um sistema de contagem Regressiva que fosse mais/menos assim.

O adm digita "/contar [tempo] [frase]" ai ele coloca lб: "/contar 5 Vai", e comeзa a contagem:
5-Isso Apareceria no meio da tela (GameTextForPlayer)
4-Isso Apareceria no meio da tela (GameTextForPlayer)
3-Isso Apareceria no meio da tela (GameTextForPlayer)
2-Isso Apareceria no meio da tela (GameTextForPlayer)
1-Isso Apareceria no meio da tela (GameTextForPlayer)
Vai- E quando aparece isso Toca uma Buzina.

Ja procurei e nгo achei nada nesse estilo

Alguem Poderia Me Ajudar

#EDIT
A contagem aparecia para todos os payers online
Reply
#2

Cara nгo vou dar codigo pronto mas vou falar oque vocк tem que fazer e vou dar um topico com uma lista de tutoriais, vejo que vocк й iniciante..

Vocк teria que usar alguma include de processador de comandos( ZCMD , YCMD e etc.. ) e sscanf..
Depois de criar os parametros teria que criar um timer (SetTimer) para fazer a contagem..

Simples assim!

Topico essencial para iniciantes: https://sampforum.blast.hk/showthread.php?tid=497801
Reply
#3

Cara Valeu, mas eu nгo sei fazer Mesmo assim obrigado...
o que vale й a Intenзгo...
Reply
#4

Quote:
Originally Posted by GHLEMES
Посмотреть сообщение
Cara Valeu, mas eu nгo sei fazer Mesmo assim obrigado...
o que vale й a Intenзгo...
Se nгo sabe fazer algo tгo simples, porque quer abrir um servidor?

Leia alguns dos tutoriais citados no topico que te passei e vai saber o basico sobre pawn.
Reply
#5

Quote:
Originally Posted by Input
Посмотреть сообщение
Se nгo sabe fazer algo tгo simples, porque quer abrir um servidor?

Leia alguns dos tutoriais citados no topico que te passei e vai saber o basico sobre pawn.
Eu NГO tenho um Servidor, sу estou fazendo um FS para um amigo e ele jб estб pronto sу falta esse Sistema de Contagem que ele me pediu.
Mas jб que eu nгo consigo nгo vou fazer vou entregar sem e ele pede para alguйm.
Muito Obrigado!!!
Reply
#6

Quote:
Originally Posted by GHLEMES
Посмотреть сообщение
Eu NГO tenho um Servidor, sу estou fazendo um FS para um amigo e ele jб estб pronto sу falta esse Sistema de Contagem que ele me pediu.
Mas jб que eu nгo consigo nгo vou fazer vou entregar sem e ele pede para alguйm.
Muito Obrigado!!!
Como se oferece para algo que nгo sabe fazer? Como fez o resto da FS? Ctrl C + Ctrl V?


@OFF: Comeзando a parar de frequentar o forum.. Muitos novatos preguiзosos que nгo vгo atras..
Reply
#7

pawn Код:
new
    timer_count,
    timer_text[32],
    timer_progress = - 1
;

pawn Код:
CMD:contagem(playerid, params[])
{
    new
        iTimer
    ;
    if(timer_progress >= 0) return SendClientMessage(playerid, -1, "Uma contagem jб estб me andamento, tente novamente mais tarde.");
    if(sscanf(params, "ds[32]", iTimer, timer_text))
        return SendClientMessage(playerid, -1, "Use: /contagem [1 ao 10] [mensagem]");
       
    if(iTimer > 10) return SendClientMessage(playerid, -1, "A contagem deve ser 1 ao 10.");
    if(iTimer < 1) return SendClientMessage(playerid, -1, "A contagem deve ser 1 ao 10.");
    timer_progress = iTimer;
    timer_count = SetTimerEx("Contagem", 1000, true, "i");
    return 1;
}
pawn Код:
/*
    Spray Tag System created by NurbWill;
*/



#include    <a_samp>
#include    <a_mysql>
#include    <zcmd>
#include    <sscanf2>
#include    <foreach>

new
    timer_count,
    timer_text[32],
    timer_progress = - 1
;

CMD:contagem(playerid, params[])
{
    new
        iTimer
    ;
    if(timer_progress >= 0) return SendClientMessage(playerid, -1, "Uma contagem jб estб me andamento, tente novamente mais tarde.");
    if(sscanf(params, "ds[32]", iTimer, timer_text))
        return SendClientMessage(playerid, -1, "Use: /contagem [1 ao 10] [mensagem]");
       
    if(iTimer > 10) return SendClientMessage(playerid, -1, "A contagem deve ser 1 ao 10.");
    if(iTimer < 1) return SendClientMessage(playerid, -1, "A contagem deve ser 1 ao 10.");
    timer_progress = iTimer;
    timer_count = SetTimerEx("Contagem", 1000, true, "i");
    return 1;
}

forward Contagem();
public Contagem()
{
    switch(timer_progress)
    {
        case 10:{
            timer_progress = 9;
            GameTextForAll("10", 1000, 6);
        }
        case 9:{
            timer_progress = 8;
            GameTextForAll("9", 1000, 6);
        }
        case 8:{
            timer_progress = 7;
            GameTextForAll("8", 1000, 6);
        }
        case 7:{
            timer_progress = 6;
            GameTextForAll("7", 1000, 6);
        }
        case 6:{
            timer_progress = 5;
            GameTextForAll("6", 1000, 6);
        }
        case 5:{
            timer_progress = 4;
            GameTextForAll("5", 1000, 6);
        }
        case 4:{
            timer_progress = 3;
            GameTextForAll("4", 1000, 6);
        }
        case 3:{
            timer_progress = 2;
            GameTextForAll("3", 1000, 6);
        }
        case 2:{
            timer_progress = 1;
            GameTextForAll("2", 1000, 6);
        }
        case 1:{
            timer_progress = 0;
            GameTextForAll("1", 1000, 6);
        }
        case 0:{
            timer_progress = -1;
            GameTextForAll(timer_text, 1000, 6);
            KillTimer(timer_count);
        }
    }
    return 1;
}
Obs: Nгo testei ainda...
Reply
#8

Quote:
Originally Posted by NurbWill
Посмотреть сообщение
pawn Код:
new
    timer_count,
    timer_text[32],
    timer_progress = - 1
;

pawn Код:
CMD:contagem(playerid, params[])
{
    new
        iTimer
    ;
    if(timer_progress >= 0) return SendClientMessage(playerid, -1, "Uma contagem jб estб me andamento, tente novamente mais tarde.");
    if(sscanf(params, "ds[32]", iTimer, timer_text))
        return SendClientMessage(playerid, -1, "Use: /contagem [1 ao 10] [mensagem]");
       
    if(iTimer > 10) return SendClientMessage(playerid, -1, "A contagem deve ser 1 ao 10.");
    if(iTimer < 1) return SendClientMessage(playerid, -1, "A contagem deve ser 1 ao 10.");
    timer_progress = iTimer;
    timer_count = SetTimerEx("Contagem", 1000, true, "i");
    return 1;
}
pawn Код:
forward Contagem();
public Contagem()
{
    switch(timer_progress)
    {
        case 10:{
            timer_progress = 9;
            foreach (new i : Player) GameTextForPlayer(i, "10", 1000, 6);
        }
        case 9:{
            timer_progress = 8;
            foreach (new i : Player) GameTextForPlayer(i, "9", 1000, 6);
        }
        case 8:{
            timer_progress = 7;
            foreach (new i : Player) GameTextForPlayer(i, "8", 1000, 6);
        }
        case 7:{
            timer_progress = 6;
            foreach (new i : Player) GameTextForPlayer(i, "7", 1000, 6);
        }
        case 6:{
            timer_progress = 5;
            foreach (new i : Player) GameTextForPlayer(i, "6", 1000, 6);
        }
        case 5:{
            timer_progress = 4;
            foreach (new i : Player) GameTextForPlayer(i, "5", 1000, 6);
        }
        case 4:{
            timer_progress = 3;
            foreach (new i : Player) GameTextForPlayer(i, "4", 1000, 6);
        }
        case 3:{
            timer_progress = 2;
            foreach (new i : Player) GameTextForPlayer(i, "3", 1000, 6);
        }
        case 2:{
            timer_progress = 1;
            foreach (new i : Player) GameTextForPlayer(i, "2", 1000, 6);
        }
        case 1:{
            timer_progress = 0;
            foreach (new i : Player) GameTextForPlayer(i, "1", 1000, 6);
        }
        case 0:{
            timer_progress = -1;
            foreach (new i : Player) GameTextForPlayer(i, timer_text, 1000, 6);
            KillTimer(timer_count);
        }
    }
    return 1;
}
Obs: Nгo testei ainda...
Amigo Quais sгo as Public's que devo por o codigo?
Reply
#9

Basta usar essa funзгo.

Cria o comando, e onde tб escrito valendo, acrescenta o som.
pawn Код:
forward Contar(Contagem);
public Contar(Contagem)
{
    new VBString[3];
    format(VBString, 3, "%d",Contagem);
    if(Contagem > 0)
    {
        GameTextForAll(VBString, 700, 5);
        SetTimerEx("Contar",1000, false, "i", Contagem-1);
    }
    else GameTextForAll("Valendo !", 1000, 5);
}
Reply
#10

REMOVED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)