[Ajuda] Timer em Comando
#1

Opa firme ? criei um sistema de vip , й estou tendo dificuldades em montar um comando...

pawn Код:
CMD:boost(playerid)
{
if(gettime() - boost[playerid] < 300)     return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк tem que esperar 300 segundos para poder usar o comando novamente !");
boost[playerid] = gettime();
if(PlayerInfo[playerid][Vip] >= 2)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
for(new x = 0; x < MAX_PLAYERS; x++) {
if(IsPlayerInRangeOfPoint(x, 10.0, X, Y, Z))
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid))
SetPlayerHealth(x, 100);
SetPlayerArmour(x, 100);
GivePlayerWeapon(x, 24, 150);
GivePlayerWeapon(x, 27, 250);
GivePlayerWeapon(x, 31, 300);
GivePlayerWeapon(x, 35, 2);
new name[MAX_PLAYER_NAME], string[300];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Vocк ganhou equipamentos do Vip %s!",name);
SendClientMessageToAll(cor_azulzin, string);
}
}
}
return 1;
}
tipo , se eu nгo for vip , nada й setado para mim , porйm o timer й inicializado , ou seja quando eu uso o comando 2 vezes , na segunda aparece "Vocк tem que esperar 300 segundos para poder usar o comando novamente"...

fiz varios comandos parecidos com esse , й queria saber se tem um geito mas pratico e simples de usar timer em comandos ...

att: Moda
Reply
#2

Aqui no meu gm eu uso assim, ai tu muda o tempo para quanto tu quiser.

pawn Код:
//topo do gm
new EquiparVIP[MAX_PLAYERS];

//no topo do comando
if(PlayerInfo[playerid][Vip] == false) return SendClientMessage(playerid, -1,"ERRO: Vocк nгo tem permissгo para usar este comando.");
if(EquiparVIP[playerid] == 1) return SendClientMessage(playerid, -,1"ERRO: Ainda nгo deu o tempo para equipar novamente.");

//no fim do comando
    EquiparVIP[playerid] = 1;
    SetTimerEx("EquiparVIPP",5*60*1000,false,"d",playerid);


//fim do gm
forward EquiparVIPP(playerid);
public EquiparVIPP(playerid)
{
      EquiparVIP[playerid] = 0;
}
Reply
#3

Resolvido obrigado pela ajuda!!! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)