[Ajuda] Comando /contar - 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] Comando /contar (
/showthread.php?tid=339709)
[Ajuda] Comando /contar -
Micael.Nees - 04.05.2012
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
Re: [Ajuda] Comando /contar -
ViniBorn - 04.05.2012
https://sampforum.blast.hk/showthread.php?tid=281966
Re: [Ajuda] Comando /contar -
Micael.Nees - 04.05.2012
Esse que vocк me passou da para fazer /contar [segundos] ?
Que й os segundos que eu quero que conte
Re: [Ajuda] Comando /contar -
zSuYaNw - 04.05.2012
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 --;
}
Re: [Ajuda] Comando /contar -
steeldark - 04.05.2012
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
Re: [Ajuda] Comando /contar -
zSuYaNw - 04.05.2012
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.
Re: [Ajuda] Comando /contar -
steeldark - 04.05.2012
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
Re: [Ajuda] Comando /contar -
Micael.Nees - 04.05.2012
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?