Lirbo

Untitled

May 27th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.86 KB | None | 0 0
  1. // Unix timestamp
  2.  
  3. forward Update();
  4.  
  5. public OnGameModeInit()
  6. {
  7.     SetTimer("Update", 2000, true);
  8.     return 1;
  9. }
  10.  
  11. public OnPlayerConnect(playerid)
  12. {
  13.     SetPVarInt(playerid, "Kick", gettime()+30);
  14.     return 1;
  15. }
  16.  
  17. public Update()
  18. {
  19.     for(new i = 0; i < MAX_PLAYERS; i++)
  20.     {
  21.         if(GetPVarInt(i, "Kick") <= gettime() && GetPVarInt(i, "Kick") != 0)
  22.         {
  23.             SetPVarInt(i, "Kick", 0);
  24.             Kick(i);
  25.         }
  26.     }
  27.     return 1;
  28. }
  29.  
  30. public OnDialogResponse(dialogid)
  31. {
  32.     if(dialogid == DIALOG_LOGIN)
  33.     {
  34.         // If managed to login successfully.
  35.         SetPVarInt(playerid, "Kick", 0);
  36.     }
  37. }
  38.  
  39. // ======================================= Another example of anti spam
  40.  
  41. OnPlayerText(playerid, text[])
  42. {
  43.     if(GetPVarInt(playerid, "CantTalk") < gettime())
  44.     {
  45.         SendClientMessage(playerid, -1, "Don't spam");
  46.         return 0;
  47.     }
  48.     SetPVarInt(playerid, "CantTalk", gettime()+2);
  49.     return 1;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment