Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. public GlobalAfkCheck()
  2. {
  3. for(new i; i != GetMaxPlayers(); i++)
  4. {
  5. if(!IsPlayerConnected(i)) continue;
  6. if(GetPVarInt(i,"AFK_Tick") > 10000)
  7. {
  8. SetPVarInt(i,"AFK_Tick",1);
  9. SetPVarInt(i,"AFK_Check",0);
  10. }
  11. if(GetPVarInt(i,"AFK_Use") == 1 && GetPVarInt(i, "AFK_Time") <= 2)
  12. {
  13. GetPlayerPos(i,PlayerInfo[i][pPos_x],PlayerInfo[i][pPos_y],PlayerInfo[i][pPos_z]);
  14. SetPVarInt(i,"AFK_Use",0);
  15. }
  16. if(GetPVarInt(i,"AFK_Check") < GetPVarInt(i,"AFK_Tick") && GetPlayerState(i))
  17. {
  18. SetPVarInt(i,"AFK_Check",GetPVarInt(i,"AFK_Tick"));
  19. SetPVarInt(i,"AFK_Time",0);
  20. }
  21. if(GetPVarInt(i,"AFK_Check") == GetPVarInt(i,"AFK_Tick") && GetPlayerState(i))
  22. {
  23. SetPVarInt(i,"AFK_Time",GetPVarInt(i,"AFK_Time") + 1);
  24. if(GetPVarInt(i, "AFK_Time") > 2)
  25. {
  26. new CB[32];
  27. Convert(GetPVarInt(i,"AFK_Time")-2,CB);
  28. strins(CB,"AFK: ",0);
  29. SetPlayerChatBubble(i,CB,COLOR_LIGHTRED,50.0,1200);
  30. SetPVarInt(i,"AFK_Use",1);
  31. }
  32. }
  33. if (PlayerInfo[i][pJailTime] > 0 && GetPVarInt(i,"AFK_Time") >= 120)
  34. {
  35. format(string, 100, "Speletajs %s tika izkikots no servera. iemesls: Jail Afk", sendername(i));
  36. SendClientMessageToAll(COLOR_LIGHTRED,string);
  37. Kick(i);
  38. }
  39. if(GetPVarInt(i,"AFK_Time") >= 900)
  40. {
  41. if(PlayerInfo[i][pAdmin] > 0) return 0;
  42. format(string, 100, "Speletajs %s tika izkikots no servera. iemesls: AFK", sendername(i));
  43. SendClientMessageToAll(COLOR_LIGHTRED,string);
  44. Kick(i);
  45. }
  46. }
  47. return 1;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement