Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public GlobalAfkCheck()
- {
- for(new i; i != GetMaxPlayers(); i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(GetPVarInt(i,"AFK_Tick") > 10000)
- {
- SetPVarInt(i,"AFK_Tick",1);
- SetPVarInt(i,"AFK_Check",0);
- }
- if(GetPVarInt(i,"AFK_Use") == 1 && GetPVarInt(i, "AFK_Time") <= 2)
- {
- GetPlayerPos(i,PlayerInfo[i][pPos_x],PlayerInfo[i][pPos_y],PlayerInfo[i][pPos_z]);
- SetPVarInt(i,"AFK_Use",0);
- }
- if(GetPVarInt(i,"AFK_Check") < GetPVarInt(i,"AFK_Tick") && GetPlayerState(i))
- {
- SetPVarInt(i,"AFK_Check",GetPVarInt(i,"AFK_Tick"));
- SetPVarInt(i,"AFK_Time",0);
- }
- if(GetPVarInt(i,"AFK_Check") == GetPVarInt(i,"AFK_Tick") && GetPlayerState(i))
- {
- SetPVarInt(i,"AFK_Time",GetPVarInt(i,"AFK_Time") + 1);
- if(GetPVarInt(i, "AFK_Time") > 2)
- {
- new CB[32];
- Convert(GetPVarInt(i,"AFK_Time")-2,CB);
- strins(CB,"AFK: ",0);
- SetPlayerChatBubble(i,CB,COLOR_LIGHTRED,50.0,1200);
- SetPVarInt(i,"AFK_Use",1);
- }
- }
- if (PlayerInfo[i][pJailTime] > 0 && GetPVarInt(i,"AFK_Time") >= 120)
- {
- format(string, 100, "Speletajs %s tika izkikots no servera. iemesls: Jail Afk", sendername(i));
- SendClientMessageToAll(COLOR_LIGHTRED,string);
- Kick(i);
- }
- if(GetPVarInt(i,"AFK_Time") >= 900)
- {
- if(PlayerInfo[i][pAdmin] > 0) return 0;
- format(string, 100, "Speletajs %s tika izkikots no servera. iemesls: AFK", sendername(i));
- SendClientMessageToAll(COLOR_LIGHTRED,string);
- Kick(i);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement