SA-MP Forums Archive
Bloquear conteo en proceso - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Bloquear conteo en proceso (/showthread.php?tid=577781)



Bloquear conteo en proceso - Zodiaco - 14.06.2015

Hola amigos del samp como puedo bloquear el comando cuando el conteo este en proceso.


PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/conteo"cmdtexttrue10) == 0)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ ! ] Conteo en inicio");
        
PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
        
TextDrawShowForPlayer(playerid,C3);
        
SetTimer("conteo2",1000,0);
  return 
1;
    }
    return 
0;

saludos-


Re: Bloquear conteo en proceso - Unrea1 - 14.06.2015

Crea un variable general.

Код:
new ConteoON = 0;
Y el comando:

Код:
if (strcmp("/conteo", cmdtext, true, 10) == 0) 
{ 
     if(ConteoON == 1) return SendClientMessage(playerid, -1, "Ya se ha iniciado un conteo."); // Si el conteo ya se iniciу marcarб йste mensaje. (Variable en 1)
     SendClientMessage(playerid,COLOR_RED,"[ ! ] Conteo en inicio"); 
     PlayerPlaySound(playerid,1056,0.0,0.0,0.0); 
     TextDrawShowForPlayer(playerid,C3); 
     SetTimer("conteo2",1000,0); 
     return ConteoON = 1; // retornaremos en la variable, colocбndole 1 para que no se pueda ejecutar el comando.
}
Y al final del conteo colocas:

Код:
ConteoON = 0; // Setea a 0 la variable para que se pueda usar de nuevo.
Eso serнa todo.


Re: Bloquear conteo en proceso - Zodiaco - 14.06.2015

Quote:
Originally Posted by LatinZ
Посмотреть сообщение
Crea un variable general.

Код:
new ConteoON = 0;
Y el comando:

Код:
if (strcmp("/conteo", cmdtext, true, 10) == 0) 
{ 
     if(ConteoON == 1) return SendClientMessage(playerid, -1, "Ya se ha iniciado un conteo."); // Si el conteo ya se iniciу marcarб йste mensaje. (Variable en 1)
     SendClientMessage(playerid,COLOR_RED,"[ ! ] Conteo en inicio"); 
     PlayerPlaySound(playerid,1056,0.0,0.0,0.0); 
     TextDrawShowForPlayer(playerid,C3); 
     SetTimer("conteo2",1000,0); 
     return ConteoON = 1; // retornaremos en la variable, colocбndole 1 para que no se pueda ejecutar el comando.
}
Y al final del conteo colocas:

Код:
ConteoON = 0; // Setea a 0 la variable para que se pueda usar de nuevo.
Eso serнa todo.
muchas, gracias funciono +rept