Код:
{
GetPlayerName(playerid, Name, 24);
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
if(Afk[playerid]==0){
Afk[playerid]=1;
Timer[playerid] = SetTimer("SendMessage",100,0);
SetPlayerVirtualWorld(playerid, 15);
TogglePlayerControllable(playerid,0);
format(string, sizeof(string), "%s this afk", Name);
SendClientMessageToAll(0x33CCFFAA, string);
}else{SendClientMessage(playerid,0xFF0000AA, "You're on AFK mode to exit type /exitafk");}
return 1;
}
pawn Код:
// somewhere on the bottom of your script
forward NoAFK(playerid);
public NoAFK(playerid);
{
Afk[playerid] = 0;
}
// In Your Command
SetTimerEx("NoAFK", 10000, false, "d", playerid);