HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. * _______ _ _ __ __
  3. * | _____/ | | | | \ \ __ / /
  4. * | | | | | | | | / \ | |
  5. * | | | |____| | | |/ __ \| |
  6. * | | ___ | ______ | | / \ |
  7. * | | |_ | | | | | | / \ |
  8. * | | | | | | | | | | | |
  9. * | |____| | | | | | | | | |
  10. * |_______/ |_| |_| \_/ \_/
  11. *
  12. *
  13. *
  14. * Last Edited: 08-04-08
  15. *
  16. * ============
  17. * Changelog:
  18. * ============
  19. *
  20. * v2.1
  21. * -money_after_death CVAR added
  22. * -Minus Money for Team Attack
  23. *
  24. * v2.0
  25. * -Optimized Code
  26. *
  27. * v1.0
  28. * -Initial Release
  29. *
  30. */
  31.  
  32. #define VERSION "2.1"
  33.  
  34. #include <amxmodx>
  35. #include <amxmisc>
  36. #include <cstrike>
  37.  
  38. new mpd, mkb, mhb, mad
  39. new maxplayers
  40.  
  41. new g_money[33][33]
  42.  
  43. public plugin_init()
  44. {
  45. register_plugin("Damage Money",VERSION,"GHW_Chronic")
  46. mpd = register_cvar("money_per_damage","3")
  47. mkb = register_cvar("money_kill_bonus","100")
  48. mhb = register_cvar("money_hs_bonus","50")
  49. mad = register_cvar("money_after_death","1")
  50.  
  51. register_event("Damage","Damage","b")
  52. register_event("DeathMsg","death_msg","a")
  53.  
  54. maxplayers = get_maxplayers()
  55. }
  56.  
  57. public client_disconnect(id)
  58. {
  59. for(new i=1;i<=maxplayers;i++)
  60. {
  61. g_money[i][id] = 0
  62. }
  63. }
  64.  
  65. public Damage(id)
  66. {
  67. new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint)
  68. if(attacker<=maxplayers && is_user_alive(attacker) && attacker!=id)
  69. {
  70. new money = read_data(2) * get_pcvar_num(mpd)
  71. if(hitpoint==1) money += get_pcvar_num(mhb)
  72. if(get_user_team(attacker)==get_user_team(id)) money *= -1
  73. cs_set_user_money2(attacker,id,cs_get_user_money(attacker) + money)
  74. }
  75. }
  76.  
  77. public death_msg()
  78. {
  79. new victim = read_data(2)
  80. if(is_user_connected(victim))
  81. {
  82. new attacker = read_data(1)
  83. if(
  84. attacker &&
  85. attacker<=maxplayers &&
  86. is_user_connected(attacker) &&
  87. attacker!=victim
  88. )
  89. cs_set_user_money2(read_data(1),read_data(2),cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
  90.  
  91.  
  92. give_ad_money(victim)
  93. }
  94. }
  95.  
  96. public cs_set_user_money2(attacker,victim,money)
  97. {
  98. if(get_pcvar_num(mad)) g_money[victim][attacker] += money
  99. else cs_set_user_money(attacker,money)
  100. }
  101.  
  102. public give_ad_money(victim)
  103. {
  104. for(new i=1;i<=maxplayers;i++)
  105. {
  106. if(g_money[victim][i] && is_user_connected(i)) cs_set_user_money(i,g_money[victim][i] + cs_get_user_money(i))
  107. }
  108. }
  109.