#include <a_samp>
#include <zcmd>
new afkba[MAX_PLAYERS];
new asd;
public OnFilterScriptInit()
{
print(\"\\n_-_-_---------------------------_-_-_-\");
print(\"\\n [ Nesze Olie - AwayFromKeyboard ] \");
print(\"\\n_-_-_---------------------------_-_-_-\");
return 1;
}
public OnFilterScriptExit()
{
KillTimer(asd);
return 1;
}
forward AJEFKA(playerid);
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_UP || newkeys & KEY_DOWN || newkeys & KEY_LEFT || newkeys & KEY_RIGHT)
{
if(afkba[playerid] == 0)
{
KillTimer(asd);
asd = SetTimerEx(\"AJEFKA\", 5*(60*1000), 0, \"i\", playerid);
SendClientMessage(playerid, 0x00FF00, \"Teszt: Nem vagy AFK. Timer elindítva\");
}
else SendClientMessage(playerid, 0x00FF00, \"Teszt: AFK vagy.\");
}
return 1;
}
public AJEFKA(playerid)
{
if(afkba[playerid] == 0)
{
SendClientMessage(playerid, 0x00FF00, \"Túl sokáig voltál AFK! Máskor /afk\");
Kick(playerid);
}
SendClientMessage(playerid, -1, \"Teszt: Most rúgott volna ki.\");
}
CMD:afk(playerid)
{
if(afkba[playerid] == 0)
{
SetPlayerVirtualWorld(playerid, 4);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, 0x00FF00, \"AFK-ba léptél.\");
afkba[playerid] = 1;
}
else if(afkba[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, 0x00FF00, \"Már nem vagy AFK.\");
afkba[playerid] = 0;
}
return 1;
}
Így?( Nem tudok tesztelni gép hiányában )