YiinY

yInv

Sep 27th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.31 KB | None | 0 0
  1. #define COLOR_BLUE 0x576E86FF
  2. #include <a_samp>
  3. #include <foreach>
  4.  
  5. new
  6.  
  7.     bool: afk[MAX_PLAYERS],
  8.     Float: last_hit[MAX_PLAYERS],
  9.     inv_w[MAX_PLAYERS], // Warnings
  10.     afkc[MAX_PLAYERS];
  11.    
  12. forward CheckPaused();
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.     print(" ---:: yInv by Yiin ");
  17.     SetTimer("CheckPaused",5000,true);
  18.    
  19.     return 1;
  20. }
  21.  
  22. public OnFilterScriptExit()
  23.     return 1;
  24.  
  25. public OnPlayerConnect(playerid)
  26. {
  27.     afkc[playerid] = 0;
  28.     afk[playerid] = false;
  29.    
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerSpawn(playerid)
  34. {
  35.     inv_w[playerid] = 0;
  36.    
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
  41. {
  42.     if(afk[damagedid]) return 0;
  43.     new
  44.         Float: hp,
  45.         Float: arm,
  46.         Float: HitPoints;
  47.        
  48.     GetPlayerHealth(damagedid, hp);
  49.     GetPlayerArmour(damagedid, arm);
  50.     HitPoints = hp + arm;
  51.  
  52.     if(last_hit[damagedid] < HitPoints)
  53.             inv_w[damagedid]++;
  54.     else
  55.             inv_w[damagedid] = 0;
  56.  
  57.     if(inv_w[damagedid] > 12){
  58.             SendClientMessage(damagedid, COLOR_BLUE, "INV detected");
  59.             Kick(playerid);
  60.     }
  61.     last_hit[damagedid] = HitPoints - amount;
  62.  
  63.     return 1;
  64. }
  65.  
  66. public CheckPaused()
  67. {
  68.     foreach(new i : Player)
  69.     {
  70.         if(afkc[i] > 2 && !afk[i])
  71.         {
  72.             afk[i] = true;
  73.         }
  74.         else if(afkc[i] < 3 && afk[i])
  75.         {
  76.             afk[i] = false;
  77.         }
  78.         afkc[i]++;
  79.     }
  80.     return 1;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment