Guest User

Redgie

a guest
Aug 9th, 2008
1,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. #include <a_samp>
  2. #define FILTERSCRIPT
  3. #define AFKTime 30 //This number indicates the number of minutes a player can be AFK
  4. #define ShowTime 0 //This Enables/Disables the AFK Time in the kick message.(0=Disable,1=Enable)
  5. #define Public 0 //This Enables/Disables a notification message being sent to all players.(0=Disable,1=Enable)
  6.  
  7. /* Welcome to my FS, I have no way of ensuring that this FS is kept to my name, so I won't
  8. bother trying, if you want to give credit, that would be wonderful, as time went into
  9. making this filterscript.
  10. Thanks, Redgie (RedgiesRP.co.uk).
  11.  
  12. OTHER NOTES: This AutoKicker only runs the timer every minute, this means that you should allow
  13. up to 1 extra minute for the autokicker to work
  14.  
  15. HOW TO USE: Simply edit the "AFKTime" At the top of the script, to show the value of minutes
  16. you want to be the maximum "AFK Time" in your server, and whether you want this value to be
  17. shown on the kick message by editing the ShowTime value(0=Disable,1=Enable).
  18. */
  19.  
  20.  
  21. /*--------------------------NOTHING BELOW THIS POINT NEEDS TO BE CHANGED--------------------------*/
  22.  
  23. public OnFilterScriptInit()
  24. {
  25. SetTimer("AFKKicker", 60000, 1);
  26. return 1;
  27. }
  28. forward AFKKicker();
  29.  
  30. new Float:PPos[MAX_PLAYERS][3];
  31. new AFKMins[MAX_PLAYERS];
  32. new show = ShowTime;
  33. new pub = Public;
  34.  
  35. public OnPlayerConnect(playerid)
  36. {
  37. PPos[playerid][0] = 0;
  38. PPos[playerid][1] = 0;
  39. PPos[playerid][2] = 0;
  40. AFKMins[playerid] = 0;
  41. }
  42. public AFKKicker()
  43. {
  44. for(new i = 0; i <= MAX_PLAYERS; i++)
  45. {
  46. if(PPos[i][1] == 0)
  47. {
  48. GetPlayerPos(i,PPos[i][0],PPos[i][1],PPos[i][2]);
  49. return 1;
  50. }
  51. new Float:x,Float:y,Float:z;
  52. GetPlayerPos(i,x,y,z);
  53. if(x == PPos[i][0] && y == PPos[i][1] && z == PPos[i][2])
  54. {
  55. AFKMins[i]++;
  56. if(AFKMins[i] >= AFKTime)
  57. {
  58. if(show == 1)
  59. {
  60. new string[128];
  61. format(string, sizeof(string), "You were Away From Keyboard(AFK) for too long(%d minutes)",AFKTime);
  62. SendClientMessage(i,0xAA3333AA,string);
  63. }
  64. else
  65. {
  66. SendClientMessage(i, 0xAA3333AA,"You were Away From Keyboard(AFK) for too long");
  67. }
  68. Kick(i);
  69. if(pub == 1)
  70. {
  71. new string[128];
  72. new name[MAX_PLAYER_NAME];
  73. GetPlayerName(i, name, sizeof(name));
  74. format(string, sizeof(string), "%s was kicked for being AFK too long",name);
  75. SendClientMessageToAll(0xAA3333AA,string);
  76. }
  77. }
  78. }
  79. }
  80. return 1;
  81. }
  82.  
Advertisement
Add Comment
Please, Sign In to add comment