MegastoRM

Untitled

Nov 21st, 2012
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. new g_MsgScreenFade
  5.  
  6. public plugin_init() {
  7. register_plugin("blablabla","isto to","i ovde")
  8. register_event( "Damage", "event_damage", "b", "2!0", "3=0", "4!0");
  9.  
  10. g_MsgScreenFade = get_user_msgid("ScreenFade")
  11. // Add your code here...
  12. }
  13.  
  14. public event_damage(id)
  15. {
  16. new attacker = get_user_attacker(id)
  17. new health = get_user_health(id)
  18.  
  19. if(!Is_Valid_User( attacker ) )
  20. return PLUGIN_HANDLED
  21.  
  22. if(health < 45)
  23. {
  24. fw_Heal( id )
  25. }
  26.  
  27. return PLUGIN_CONTINUE
  28. }
  29.  
  30. public fw_Heal( index )
  31. {
  32. if(!is_user_alive(index))
  33. return PLUGIN_HANDLED
  34.  
  35. new health = get_user_health(index)
  36.  
  37. if(health < 100)
  38. {
  39. set_pev(index, pev_health, pev(index, pev_health) + 5.0)//setuje HP
  40. emit_sound(index, CHAN_ITEM, "cod_bo/heal.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);//Sound
  41.  
  42. message_begin(MSG_ONE, g_MsgScreenFade, {0,0,0}, index);
  43. write_short(5<<10); //Oko trajanja nesto
  44. write_short(3<<5); //Fade
  45. write_short(1<<1); // Tip fade-a (in / out, 1 - 0 )
  46. write_byte(200); // crvena
  47. write_byte(0); // zelena
  48. write_byte(0); // plava
  49. write_byte(90); // Alpha....
  50. message_end();
  51. if(health < 100)
  52. {
  53. set_task(1.0, "fw_Heal", index)
  54. }
  55. }
  56. else if(health > 100)
  57. set_pev(index,pev_health, 100)
  58.  
  59. return PLUGIN_CONTINUE
  60. }
  61.  
  62. public Is_Valid_User( id )
  63. {
  64. if( is_user_connected( id ) && ( pev( id, pev_flags ) & FL_CLIENT ) )
  65. return true;
  66.  
  67. return false;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment