[Ajuda] Loop de 30 min
#1

Estou interessado num cуdigo q faзa exatamente a funзгo do meu cуdigo, mas como o titulo diz: em loop.
(Й um sistema parecido com PAYDAY, mas n exatamente envolvendo pagamento)

PHP код:

if(Hora == && Min == 30 && Seg == 0)
{
SendClientMessage(playerid, -1"Vocк estб a 30 min no sever");
}
else if(
Hora == && Min == && Seg == 0)

SendClientMessage(playerid, -1"Vocк estб a 60 min no sever");
}
else if(
Hora == && Min == 30 && Seg == 0)

SendClientMessage(playerid, -1"Vocк estб a 120 min no sever");

Como puderam ver, a funзгo manda mensagem de 30 em 30 min, mas o cуdigo ficaria muito grande se fosse dessa forma. Utilizando um loop acredito q daria certo. Alguйm pode dar a luz ai?
Reply
#2

Код:
unixLogged = gettime(); // Quando o jogador entrar no servidor

if ((gettime() - unixLogged) >= (60*30) print("Voce esta logado a 30 minutos");
Reply
#3

pawn Код:
#include <a_samp>

new tempo[MAX_PLAYERS];
forward msg(playerid);

public OnPlayerConnect(playerid)
{
tempo[playerid] = 0;
SetTimerEx("msg", 1800000, true, "i", playerid);
return 1;
}

public msg(playerid)
{
new string[64];
tempo[playerid] = tempo[playerid] + 30;
format(string, 64, "Voce esta no servidor a %d minutos", tempo[playerid]);
SendClientMessage(playerid, -1, string);
}
Reply
#4

Obrigado a vcs 2!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)