new TiempoJugando[MAX_PLAYERS];
SetTimer("PagoDiario", 60000, true); // 1 minuto
public PagoDiario(playerid)
{
new hora, minuto, segundo, string[128];
gettime(hora, minuto, segundo);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) & JugadorLogueado[i] == 1)
{
TiempoJugando[i]++;
}
}
if (minuto == 0 || minuto == 1)
{
SetWorldTime(hora);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) & JugadorLogueado[i] == 1)
{
format(string, sizeof(string), "SERVIDOR: Hora de pago.");
SendClientMessage(i, COLOR_BLANCO, string);
if (TiempoJugando[playerid] >= 20)
{
TiempoJugando[playerid] = 0;
JugadorInfo[playerid][Experiencia]++;
GuardarDato_INT(i, "usuarios", "Experiencia", JugadorInfo[playerid][Experiencia]);
format(string, sizeof(string), "SERVIDOR: Felicidades, has recibido tu pago diario.");
SendClientMessage(i, COLOR_BLANCO, string);
}
else
{
TiempoJugando[playerid] = 0;
format(string, sizeof(string), "SERVIDOR: No has jugado lo suficiente para recibir tu pago.");
SendClientMessage(i, COLOR_BLANCO, string);
}
}
}
}
return 1;
}
new TiempoJugando[MAX_PLAYERS];
SetTimer("PagoDiario", 60000, true); // 1 minuto
public PagoDiario(playerid)
{
new hora, minuto, segundo, string[128];
gettime(hora, minuto, segundo);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) & JugadorLogueado[i] == 1)
{
TiempoJugando[i]++;
}
}
switch(minuto)
{
case 0,1:
{
SetWorldTime(hora);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) & JugadorLogueado[i] == 1)
{
format(string, sizeof(string), "SERVIDOR: Hora de pago.");
SendClientMessage(i, COLOR_BLANCO, string);
if (TiempoJugando[playerid] >= 20)
{
TiempoJugando[playerid] = 0;
JugadorInfo[playerid][Experiencia]++;
GuardarDato_INT(i, "usuarios", "Experiencia", JugadorInfo[playerid][Experiencia]);
format(string, sizeof(string), "SERVIDOR: Felicidades, has recibido tu pago diario.");
SendClientMessage(i, COLOR_BLANCO, string);
}
else
{
TiempoJugando[playerid] = 0;
format(string, sizeof(string), "SERVIDOR: No has jugado lo suficiente para recibir tu pago.");
SendClientMessage(i, COLOR_BLANCO, string);
}
}
}
}
}
return 1;
}
SendClientMessage(i, COLOR_BLANCO, "SERVIDOR: Hora de pago.");
SendClientMessage(i, COLOR_BLANCO, "SERVIDOR: Felicidades, has recibido tu pago diario.");
SendClientMessage(i, COLOR_BLANCO,"SERVIDOR: No has jugado lo suficiente para recibir tu pago.");
Usa 'foreach' en vez de ese bucle que recorre todos los jugadores.
|