Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: C  |  size: 1.66 KB  |  hits: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <sourcemod>
  2. #include <timers>
  3. #include <sdkhooks>
  4.  
  5. public Plugin:myinfo =
  6. {
  7.         name = "De-TripleSlice",
  8.         author = "Reevezy",
  9.         description = "Will take 4 hits to kill as hidden unless hits are spaced out",
  10.         version = "1.0.0.0",
  11.         url = "http://www.sourcemod.net/"
  12. };
  13.  
  14. new Victim;
  15. new sameClientCount = 0;
  16. //new Health = 0;
  17.  
  18. new Handle:hsm_handicap
  19. new HandicapValue
  20.  
  21. public OnPluginStart()
  22. {
  23.         hsm_handicap = FindConVar("hsm_handicap_damagereduction");
  24.         HandicapValue = GetConVarInt(hsm_handicap);
  25.            
  26.         for(new i = 1; i <= MaxClients; i++)
  27.     {
  28.         if(IsClientInGame(i))
  29.         {
  30.             OnClientPutInServer(i);
  31.         }
  32.     }
  33. }
  34.  
  35. public OnClientPutInServer(client)
  36. {
  37.     SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
  38. }      
  39.  
  40.  
  41. public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
  42. {
  43.                
  44.                 if(GetClientTeam(inflictor) == 3 && HandicapValue == 0)
  45.         {
  46.                 if(sameClientCount==0)
  47.                 {
  48.                         CreateTimer(3.0, CountToZero);
  49.                 }
  50.                 if(THit(Victim))        //If victim has been hit twice already.
  51.                 {
  52.                        
  53.                         //Health = GetClientHealth(Victim);
  54.                         //SetEntityHealth(Victim, (Health - 20));
  55.                         //damage = 20.0;
  56.                         //return Plugin_Changed;
  57.                         SetEntityHealth(Victim, GetClientHealth(victim) + 17);
  58.                         PrintToChat(inflictor, "Damage reduced from knife spam.");
  59.                        
  60.                 }
  61.                 Victim = GetClientOfUserId(victim);
  62.         }
  63.                 return Plugin_Continue;
  64.        
  65. }
  66.  
  67.  
  68. public Action:CountToZero(Handle:timer)
  69. {
  70.         sameClientCount = 0;
  71. }
  72.  
  73.  
  74. public bool:THit(vi)
  75. {
  76.         if(Victim == vi)
  77.         {
  78.                 sameClientCount++;
  79.                 if(sameClientCount > 2)
  80.                 {
  81.                         return true;
  82.                 }              
  83.         }
  84.         else
  85.         {
  86.                 sameClientCount = 0;
  87.         }
  88.         return false;
  89. }