se supone que tiene que funcionar cada 30 segundos, pero funcionada cuando quieras..
Код:
CMD:intentar(playerid, params[])
{
new tiempo_ms = 1 * 3000, string[160];
if(TiempoIntentar[playerid] > GetTickCount())
{
new Float:tiempo = floatdiv(floatsub(TiempoIntentar[playerid], GetTickCount()), 3000), string2[128];
format(string2, 128, "Info: Debes de esperar %.2f segundo(s) para volver a usar este comando.", tiempo);
SendClientMessage(playerid, COLOR_GRIS, string2);
return 1;
}
if(isnull(params)) return SendClientMessage(playerid, COLOR_GRIS, "» "#CBLANCO"El comando, es: "#CCELESTE"/intentar [Acciуn]");
switch(random(2))
{
case 0:
{
format(string, sizeof(string), "* %s intentу %s, y no consiguiу hacerlo.",NombreJugador(playerid), params);
ProxDetector(20.0, playerid, string, COLOR_ROJO, COLOR_ROJO, COLOR_ROJO, COLOR_ROJO, COLOR_ROJO);
TiempoDudas[playerid] = GetTickCount() + tiempo_ms;
}
case 1:
{
format(string, sizeof(string), "* %s intentу %s, y consiguiу hacerlo.",NombreJugador(playerid), params);
ProxDetector(20.0, playerid, string, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF);
TiempoDudas[playerid] = GetTickCount() + tiempo_ms;
}
}
return 1;
}
Hacelo con gettime.
pawn Код:
// Al momento de usar el comando le seteas el tiempo
TiempoIntentar[playerid] = gettime() + 30;
// Y luego haces la comprobaciуn
if(gettime() < TiempoIntentar[playerid])
return SendClientMessage(playerid, -1, "* Debes esperar 30 segundos para volver a usar el comando");