Bloquear conteo en proceso
#1

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-
Reply
#2

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.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)