Guest User

AG Efficient Anti Glitch EN

a guest
Aug 18th, 2010
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.86 KB | None | 0 0
  1. /*
  2.  
  3. --------------------------------------------------------------------------------
  4.   • AG - Efficient Anti-Glith •
  5.  
  6.  Author: Allan Jader
  7.  Date: 18/08/2010
  8.  Function: To prohibit the use of glitches in combat
  9.  
  10. ------------------------------------------------------------------------------*/
  11.  
  12. #include <a_samp>
  13. #pragma tabsize 0
  14. #define COLOR_WHITE 0xFFFFFFAA
  15.  
  16. //------------------------------------------------------------------------------
  17.  
  18. forward Unfreeze(playerid);
  19.  
  20. //------------------------------------------------------------------------------
  21.  
  22. new Stock_Keys[MAX_PLAYERS][30];
  23. new temp_Stock_Keys[MAX_PLAYERS][20];
  24. new Glitch_Sequences[8][10]={ "1324020","132020","13220","132128","132420","1361281","1321280","13240"};
  25. new GS;
  26.  
  27. //------------------------------------------------------------------------------
  28.  
  29. public OnFilterScriptInit()
  30. {
  31.     for(new i=0; i<MAX_PLAYERS; i++)
  32.     {
  33.         if(IsPlayerConnected(i))
  34.         {
  35.         SetPVarInt(i,"Warned",0);//to debug
  36.         }
  37.     }
  38.  
  39.     return 1;
  40. }
  41.  
  42. //------------------------------------------------------------------------------
  43.  
  44. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  45. {
  46.        if(strlen(Stock_Keys[playerid]) >= 19) format(Stock_Keys[playerid],30,"");
  47.  
  48.        format(temp_Stock_Keys[playerid],20,"%d",newkeys);
  49.        
  50.        strcat(Stock_Keys[playerid],temp_Stock_Keys[playerid],30);
  51.        
  52.  
  53.        for(GS=0; GS<10; GS++)
  54.        {
  55.            if(strfind(Stock_Keys[playerid], Glitch_Sequences[GS], false ) != -1)
  56.            {
  57.                TogglePlayerControllable(playerid,false);
  58.                SetPlayerArmedWeapon(playerid,0);
  59.                
  60.                if(GetPVarInt(playerid,"Warned") == 0)
  61.                {
  62.                SendClientMessage(playerid,COLOR_WHITE,"[WARNING] No glitch, not persist or be kicked!");
  63.                SetPVarInt(playerid,"Warned",1);
  64.                SetPVarInt(playerid,"WarnedTimes",GetPVarInt(playerid,"WarnedTimes")+1);
  65.                SetTimerEx("Unfreeze",3000,false,"i",playerid);
  66.                format(Stock_Keys[playerid],30,"AG");
  67.                }
  68.                
  69.                if(GetPVarInt(playerid,"WarnedTimes") == 4) //or either number by your choice
  70.                {
  71.                new Name[MAX_PLAYER_NAME],string[80];
  72.  
  73.                GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
  74.                format(string,80,"%s was kicked by make glitch.",Name);
  75.                SendClientMessageToAll(COLOR_WHITE,string);
  76.                format(Stock_Keys[playerid],30,"AG");
  77.                Kick(playerid);
  78.                }
  79.            }
  80.        }
  81.  
  82.        return 1;
  83. }
  84.  
  85. //------------------------------------------------------------------------------
  86.  
  87. public Unfreeze(playerid)
  88. {
  89.       SetPVarInt(playerid,"Warned",0);
  90.  
  91.       TogglePlayerControllable(playerid,true);
  92.      
  93.       format(Stock_Keys[playerid],30,"AG");
  94.      
  95.       return 1;
  96. }
  97.  
  98. //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment