ProdigaL
Компетентный
Всем привет, если игрок в AFK 15-30 мин то чтоб его кикало?
Я написал это, не пойму куда вставить, либо ставить цикл сюда иначе ероры
Код:
publics AFKSystem()
{
foreach(Player, playerid)
{
if(IsPlayerConnected(playerid))
{
if(GetPVarInt(playerid, "PlayerInAFK") == 0) SetPVarInt(playerid, "PlayerInAFK", -1);
else if(GetPVarInt(playerid, "PlayerInAFK") == -1)
{
SetPVarInt(playerid, "PlayerInAFK", 1);
new string[64];
format(string, sizeof(string), "[AFK]: {FFFFFF}%s", ConvertSeconds(GetPVarInt(playerid, "PlayerInAFK")));
SetPlayerChatBubble(playerid, string, 0x20A9FFFF, 153.0, 1200);
}
else if(GetPVarInt(playerid, "PlayerInAFK") > 0)
{
new string[64];
SetPVarInt(playerid, "PlayerInAFK", GetPVarInt(playerid, "PlayerInAFK")+1);
format(string, sizeof(string), "[AFK]: {FFFFFF}%s", ConvertSeconds(GetPVarInt(playerid, "PlayerInAFK")));
SetPlayerChatBubble(playerid, string, 0x20A9FFFF, 153.0, 1200);
}
}
}
}
stock ConvertSeconds(time)
{
new string[64];
if(time < 60) format(string, sizeof(string), "%d секунд", time);
else if(time == 60) string = "1 минута";
else if(time > 60 && time < 3600)
{
new Float: minutes;
new seconds;
minutes = time / 60;
seconds = time % 60;
format(string, sizeof(string), "%.0f минут и %d секунд", minutes, seconds);
}
return string;
}
Код:
else if(time == 1800) string = "30 мин";
{
SendClientMessage(playerid, COLOR_RED, "Вы были кикнуты за AFK[30 минут]");
Kick(playerid);
}
Последнее редактирование:
