29.08.2012, 07:57
make a timer without parameters with an interval of 1 second and run it, and then increase a value that will count as the seconds. this way you can determine how many seconds each player has been online during their session.
pawn Код:
#include a_samp
public OnGameModeInit()
{
SetTimer("CountPlayersTime", 1000, true);
return;
}
forward CountPlayersTime();
public CountPlayersTime()
{
foreach(Player, i)
{
SetPVarInt(i, "OnlineSeconds", GetPVarInt(playerid, "OnlineSeconds"));
if(GetPVarInt(i, "OnlineSeconds") == 3600*2) // 3600 secs = 1 hour
{
Kick(i);
}
}
return;
}
CMD:myonlinetime(playerid,params[])
{
new output[32];
format(output, sizeof (output), "%d seconds online", GetPVarInt(playerid, "OnlineSeconds"));
SendClientMessage(playerid, -1, output);
return 1;
}