07.01.2015, 20:35
Yo pienso quй serнa mejor sin usar timers(temporizadores). Mira esto
.
![Smiley](images/smilies/smile.png)
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#include <a_samp>
#include <foreach>
#include <YSI\y_timers>
new tiempo_conectado[MAX_PLAYERS];
public OnFilterScriptInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
tiempo_conectado[i] = 0;
}
return true;
}
public OnPlayerConnect(playerid)
{
tiempo_conectado[playerid] = 0;
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
new string[144];
strdel(string, 0, 144);
if(tiempo_conectado[playerid] < 60)
{
format(string, sizeof(string), "** %s ah abandonado el servidor, segundos conectado: %d.", Nombre(playerid), tiempo_conectado[playerid]*1);
SendClientMessageToAll(-1, string);
}
else if(tiempo_conectado[playerid] >= 60)
{
format(string, sizeof(string), "** %s ah abandonado el servidor, minutos conectado: %d.", Nombre(playerid), tiempo_conectado[playerid]/60*1);
SendClientMessageToAll(-1, string);
}
return true;
}
stock Nombre(playerid)
{
new nombre[24];
GetPlayerName(playerid, nombre, 24);
return nombre;
}
task conteo_tiempo_conectado[1000]()
{
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
tiempo_conectado[i]++;
}
}
return true;
}
#endif