SA-MP Forums Archive
[Ajuda] Anti-Afk auto-kick - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Anti-Afk auto-kick (/showthread.php?tid=361254)



Anti-Afk auto-kick - [XPG]MarlonCS - 20.07.2012

Seguinte, esse anti-afk era para funcionar assim:
Se o player ficar 10 parado ele й kickado automaticamente, mas se ele voltar, a contagem zera.
Mas nгo estб funcionando

pawn Код:
public OnGameModeInt()
{
    SetTimerEx("SlowTick", 60000, true, "i"); // Tempo para aumentar os minutos AFK
    SetTimerEx("SetPlayerAfk", 10, true, "i"); // Define que o player estб AFK caso ele nгo se mova
    SetTimerEx("ChecarAfk", 10, true, "i"); // Checa e kicka automaticamente o player muito tempo AFK
return 1;

public OnPlayerUpdate(playerid)
{
    // Se o player se mover
    AfkCount[playerid] = 0;
    AFK[playerid]=0;
}
pawn Код:
forward ChecarAfk(playerid);
public ChecarAfk(playerid)
{
    if(AFK[playerid]==1 && AfkCount[playerid] > 10) {
        SendClientMessage(playerid, COLOR_RED, "[SERVER] Vocк foi kickado por estar AFK por muito tempo!");
        Kick(playerid);
        format(string, sizeof string, "[SERVER] %s foi kickado por estar AFK por 10 minutos.", pnome(playerid));
        SendClientMessageToAll(COLOR_RED, string);
    }
    return 1;
}
forward SetPlayerAfk(playerid);
public SetPlayerAfk(playerid)
{
    if(IsPlayerAfk(playerid)) {
        AFK[playerid]=1;
        AfkCount[playerid]=0;
        AfkCount[playerid]++;
    }
    return 1;
}
forward SlowTick(playerid);
public SlowTick(playerid)
{
    AfkCount[playerid]++;
}
stock IsPlayerAfk(playerid) return (AfkCount[playerid] > 1);



Re: Anti-Afk auto-kick - [XPG]MarlonCS - 20.07.2012

ninguйm? aff