Advertisement
GaMeRFoReVeR

DeathRun Damage Restrict

Jul 8th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.07 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <hamsandwich>
  4.  
  5. #define PLUGIN "Damage restrict"
  6. #define VERSION "1.0"
  7. #define AUTHOR "GaMeR FoReVeR"
  8.  
  9. new pFrags[33];
  10. new cvar_kills;
  11.  
  12. public plugin_init()
  13. {
  14.     register_plugin(PLUGIN, VERSION, AUTHOR);
  15.    
  16.     cvar_kills = register_cvar("dr_kills_dmg", "5");
  17.    
  18.     register_event("DeathMsg", "DeathMsg", "b");
  19.    
  20.     RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
  21. }
  22.  
  23. public client_putinserver(id)
  24. {
  25.     pFrags[id] = 0;
  26. }
  27.  
  28. public client_disconnect(id)
  29. {
  30.     pFrags[id] = 0;
  31. }
  32.  
  33. public DeathMsg()
  34. {
  35.     new Attacker = read_data(1);
  36.     new Victim = read_data(2);
  37.    
  38.     if(!is_user_connected(Attacker) || !is_user_connected(Victim))
  39.         return PLUGIN_HANDLED;
  40.    
  41.     if(Attacker == Victim)
  42.         return PLUGIN_HANDLED;
  43.    
  44.     pFrags[Attacker]++;
  45.     pFrags[Victim] = 0;
  46.    
  47.     return PLUGIN_CONTINUE;
  48. }
  49.  
  50. public TakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
  51. {
  52.     if(pFrags[attacker] >= get_pcvar_num(cvar_kills))
  53.         if(is_user_connected(attacker) && victim != attacker)
  54.             SetHamParamFloat(4, 0.0);
  55.    
  56.     return HAM_IGNORED;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement