Sean2014

Anti AFK system (Bugged)

Jan 19th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.16 KB | None | 0 0
  1. /*Declared New*/
  2. new AFK_Timer[MAX_PLAYERS];
  3. new AFK_Kick_S[MAX_PLAYERS];
  4. new acstring[128];
  5.  
  6. /*Dialogs*/
  7. #define DIALOG_AFK 11
  8.  
  9. /*Forwards*/
  10. forward AFK_Kick(playerid);
  11. forward AFK_Bye(playerid);
  12.  
  13. /*Publics*/
  14. public AFK_Kick(playerid)
  15. {
  16.     ShowPlayerDialog(playerid, DIALOG_AFK, DIALOG_STYLE_MSGBOX, "Are you here ?", "This system is checking if you are AFK.\nYou will see this message if you are in-active for 1 minute.\nYou have 20 seconds to press the continue button.", "Continue", "");
  17.     AFK_Timer[playerid] = SetTimer("AFK_Bye", 20000, false);
  18.     return 1;
  19. }
  20.  
  21. public AFK_Bye(playerid)
  22. {
  23.     format(acstring, sizeof(acstring), "{FF4500}[ANTI CHEAT]{EE0000} %s (%i){FF4500} has been kicked from server. Reason: AFK (Away From Keyboard)", GetName(playerid), playerid);
  24.     SendClientMessageToAll(COLOR_ORANGE, acstring);
  25.     SetTimer("AntiCheat", 100, false);
  26.     return 1;
  27. }
  28.  
  29. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  30. {
  31.     if(dialogid == DIALOG_AFK)
  32.     {
  33.         if(response)
  34.         {
  35.             KillTimer(AFK_Timer[playerid]);
  36.             KillTimer(AFK_Kick_S[playerid]);
  37.         }
  38.     }
  39.     return 1;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment