Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <hamsandwich>
  4. #include <fakemeta>
  5. #include <fun>
  6.  
  7. #define PLUGIN "RegenHP HNS"
  8. #define VERSION "1.0"
  9. #define AUTHOR "Tabus"
  10.  
  11. #define TASK_REGEN 10000
  12. new hpToRegen[33]
  13. new Float:czasOdrodzenia[33]
  14.  
  15. public plugin_init() {
  16.  
  17. register_plugin(PLUGIN, VERSION, AUTHOR)
  18. register_logevent("newRound", 2, "1=Round_Start")
  19.  
  20. RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage")
  21. }
  22. public ham_TakeDamage(victim, inflictor, attacker, Float:damage, damagebits){
  23. if( (damagebits & DMG_FALL) && (get_gametime()-czasOdrodzenia[victim] > 10.0 ) ){
  24. hpToRegen[victim] = floatround(damage*(has_flag(victim, "t") ? 0.8:0.6))
  25. if( task_exists(TASK_REGEN+victim) )
  26. remove_task(TASK_REGEN+victim)
  27. set_task(0.5, "regenHpFall", TASK_REGEN+victim)
  28. }
  29.  
  30. return HAM_IGNORED
  31. }
  32. public regenHpFall(id){
  33. id -= TASK_REGEN
  34.  
  35. if( !is_user_alive(id) || !is_user_connected(id) )
  36. return
  37.  
  38. set_user_health(id, get_user_health(id) + hpToRegen[id])
  39. hpToRegen[id] = 0;
  40. }
  41.  
  42. public newRound(){
  43. for( new i = 1; i <= get_maxplayers(); i ++ )
  44. czasOdrodzenia[i] = get_gametime()
  45. }
  46. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  47. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
  48. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement