Проверяет, если игрок был АФК в течение 2 минут, то кикнет его (вы, конечно, можете редактировать время)
Код: Выделить всё
//First copy this on top of your script.
#define COLOR_RED 0xFF0000AA //{FF0000}
forward KickPlayer(ID);
public KickPlayer(ID)
{
Kick(ID);
return 1;
}
forward PauseCheck(playerid);
public PauseCheck(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(GetPVarFloat(playerid,"pausex1") == 0)
{
SetPVarFloat(playerid,"pausex1",x);
SetPVarFloat(playerid,"pausey1",y);
return 1;
}
if(GetPVarFloat(playerid,"pausex1") != 0)
{
SetPVarFloat(playerid,"pausex2",x);
SetPVarFloat(playerid,"pausey2",y);
if(GetPVarFloat(playerid,"pausex1") == GetPVarFloat(playerid,"pausex2") && GetPVarFloat(playerid,"pausey1") == GetPVarFloat(playerid,"pausey2"))
{
if(!IsPlayerAdmin) //if player is not RCON logged in.
{
new string[128];
new pname[24];
GetPlayerName(playerid,pname,sizeof(pname));
format(string, sizeof(string), "~r~KICKED!");
GameTextForPlayer(playerid, string, 3000, 1);
SendClientMessage(playerid,COLOR_RED,"[KICKED] You have been kicked from the server. [Reason: Paused player]");
format(string,sizeof(string),"[SERVER KICK] %s(%d) has been kicked. [Reason: Paused player]",pname,playerid);
SendClientMessageToAll(COLOR_RED,string);
format(string,sizeof(string),"13[SERVER KICK] %s(%d) has been kicked. [Reason: Paused player]",pname,playerid);
SetTimerEx("KickPlayer",1000,false,"i",playerid);
return 1;
}
}
SetPVarFloat(playerid,"pausex1",0);
SetPVarFloat(playerid,"pausey1",0);
}
return 1;
}
//Add this under OnPlayerDeath if you don't have a reset variables public.
SetPVarFloat(playerid,"pausex1",0);
SetPVarFloat(playerid,"pausey1",0);
SetPVarFloat(playerid,"pausex2",0);
SetPVarFloat(playerid,"pausey2",0);
Скрипт не переведён
Автор: Vanter