Код: Выделить всё
enum pAFKInfo
{
bool:pIsAFK,
pAFK,
pDarkAFK
}
new pAFKSystem[MAX_PLAYERS][pAFKInfo];
В любой 1-секундный таймер к примеру OnPlayerUpdateTimer (Только не OnPlayerUpdate!)
Код: Выделить всё
pAFKSystem[i][pAFK] ++;
if(pAFKSystem[i][pAFK] >= 3)
{
new mes[128];
format(mes,sizeof(mes),"Игрок на паузе: %d секунд.",Converts(pAFKSystem[i][pAFK]));
SetPlayerChatBubble(i, mes, 0xFFFF00FF, 19.0, 1500);
pAFKSystem[i][pIsAFK] = true;
}
if(pAFKSystem[i][pIsAFK])
{
pAFKSystem[i][pIsAFK] = false;
}
Добавляем stock для высчитывание времени АФК:
Код: Выделить всё
stock Converts(number)
{
new hours = 0, mins = 0, secs = 0, string[30];
hours = floatround(number / 3600);
mins = floatround((number / 60) - (hours * 60));
secs = floatround(number - ((hours * 3600) + (mins * 60)));
if(hours > 0)
{
format(string, 30, "%d:%02d:%02d", hours, mins, secs);
}
else
{
format(string, 30, "%d:%02d", mins, secs);
}
return string;
}
А теперь в OnPlayerUpdate
Код: Выделить всё
pAFKSystem[playerid][pAFK] = 0;
В OnPlayerConnect
Код: Выделить всё
pAFKSystem[playerid][pIsAFK] = false;
pAFKSystem[playerid][pAFK] = 0;