[Ajuda] Tempo para usar o comando novamente
#1

Eu queria um jeito de deixar um comando para usar a cada 3 segundos, Pelomenos para evitar o flood do comando.
Por Exemplo
Код:
  	if (strcmp(cmdtext,"/pref", true)==0)
	{
	SetPlayerInterior(playerid,0);
	GameTextForPlayer(playerid,"~w~Voce esta na Prefeituta Bem Vindo!", 3000, 5);
	SetPlayerPos(playerid,1481.5217,-1740.2499,13.5469);
	new pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
	format(string, sizeof(string), "%s foi para a Prefeitura{00ff00} de Los Santos( /pref )", pname);
	SendClientMessageToAll(COLOR_YELLOW, string);
	return 1;
	}
Ajudem a colocar este comando para usar a cada 3 segundos, Tipo um timer
Reply
#2

Jб que estб usando strcmp, faзa um anti-flood de comandos..
Reply
#3

Basta criar um settimer
Reply
#4

pawn Код:
//topo
new bool:pode_usar_comando_pref[MAX_PLAYERS];
forward HabilitarComandoPref(playerid)

if (strcmp(cmdtext,"/pref", true)==0)
{
    if(pode_usar_comando_pref[playerid])
    {
        SetPlayerInterior(playerid,0);
        GameTextForPlayer(playerid,"~w~Voce esta na Prefeituta Bem Vindo!", 3000, 5);
        SetPlayerPos(playerid,1481.5217,-1740.2499,13.5469);

        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, MAX_PLAYER_NAME);

        format(string, sizeof(string), "%s foi para a Prefeitura{00ff00} de Los Santos( /pref )", pname);
        SendClientMessageToAll(COLOR_YELLOW, string);

        pode_usar_comando_pref[playerid] = false;
       
        SetTimerEx("HabilitarComandoPref", 3000, false, "d", playerid);
    }
    return 1;
}

//fim
public HabilitarComandoPref(playerid)
{
    pode_usar_comando_pref[playerid] = true;
    return 1;
}
Reply
#5

Vlw Victor Deu certo aki + Rep pra vc
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)