Advertisement
YiinY

yInv

Sep 27th, 2012
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 OnPlayerUpdate(playerid)
  41. {
  42.     afkc[playerid] = 0;
  43.     return 1;
  44. }
  45.  
  46. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
  47. {
  48.     if(afk[damagedid]) return 0;
  49.     new
  50.         Float: hp,
  51.         Float: arm,
  52.         Float: HitPoints;
  53.        
  54.     GetPlayerHealth(damagedid, hp);
  55.     GetPlayerArmour(damagedid, arm);
  56.     HitPoints = hp + arm;
  57.  
  58.     if(last_hit[damagedid] < HitPoints)
  59.             inv_w[damagedid]++;
  60.     else
  61.             inv_w[damagedid] = 0;
  62.  
  63.     if(inv_w[damagedid] > 12){
  64.             SendClientMessage(damagedid, COLOR_BLUE, "INV detected");
  65.             Kick(damagedid);
  66.     }
  67.     last_hit[damagedid] = HitPoints - amount;
  68.  
  69.     return 1;
  70. }
  71.  
  72. public CheckPaused()
  73. {
  74.     foreach(new i : Player)
  75.     {
  76.         if(afkc[i] > 2 && !afk[i])
  77.         {
  78.             afk[i] = true;
  79.         }
  80.         else if(afkc[i] < 3 && afk[i])
  81.         {
  82.             afk[i] = false;
  83.         }
  84.         afkc[i]++;
  85.     }
  86.     return 1;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement