Oh my god! The code is terrible.
pawn Код:
new AFK[MAX_PLAYERS]; // after include a_samp
new AKick[MAX_PLAYERS]; // after include a_samp
new ASTOP[MAX_PLAYERS]; // after include a_samp
public OnPlayerConnect(playerid)
{
AFK[playerid]=0;
AKick[playerid]=0;
ASTOP[playerid]=0;
}
if (strcmp("/afk", cmdtext, true) == 0)
{
if(!AFK[playerid])
(
if(IsPlayerVipMember(playerid))
{
AFK[playerid] = 1;
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid, 293, 2414, 17);
SendClientMessage(playerid, COLOR_Red, "to back type /back");
AFKCount++;
ASTOP[playerid] = SetTimer("stop", 1000, true);
}
else
{
AFK[playerid] = 1;
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid, 293, 2414, 17);
SendClientMessage(playerid, COLOR_Red, "you will kick after 10 min if you didn't type /back");
AFKCount++;
ASTOP[playerid] = SetTimer("stop", 1000, true);
AKick[playerid] = SetTimer("kick", 600000, true);
}
}
else SendClientMessage(playerid. COLOR_Red, "you are alredy AFK");
return 1;
}
if (strcmp("/back", cmdtext, true) == 0)
{
if(AFK[playerid] == 1)
(
if(IsPlayerVipMember(playerid))
{
AccInfo[playerid][AFK] = 0;
TogglePlayerControllable(playerid, 1);
SetPlayerPos(playerid, 334, 2417, 17);
KillTimer(ASTOP[playerid]);
AFKCount--;
}
else
{
AFK[playerid] = 0;
KillTimer(ASTOP[playerid]);
TogglePlayerControllable(playerid, 1);
SetPlayerPos(playerid, 334, 2417, 17);
KillTimer(AKick[playerid]);
AFKCount--;
}
}
else SendClientMessage(playerid. COLOR_Red, "you are not AFK");
return 1;
}
Should work just fine.