HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. new Handle:MnPerHit
  5. new Handle:MnPerKill
  6. new Handle:MnPerHs
  7.  
  8. new g_iAccount
  9.  
  10. public Plugin:myinfo =
  11. {
  12. name = "Damage Money",
  13. author = "Fredd",
  14. description = "Sebzésért pénz",
  15. version = "1.0",
  16. url = "www.sourcemod.net"
  17. }
  18.  
  19. public OnPluginStart()
  20. {
  21. CreateConVar("damage_money_version", "1.0", "Damage Money Verzió")
  22.  
  23. MnPerHit = CreateConVar("money_per_hit", "5", "Mennyi pénzt adjon sebzésért")
  24. MnPerKill = CreateConVar("money_per_kill", "100", "Mennyi pénzt adjon ölésért")
  25. MnPerHs = CreateConVar("money_per_headshot", "50", "Mennyi pénzt adjon headshot-ért.")
  26.  
  27. g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount")
  28.  
  29.  
  30. HookEvent("player_hurt", DamageEvent, EventHookMode_Post)
  31. HookEvent("player_death", DeathEvent, EventHookMode_Post)
  32. }
  33. public Action:DamageEvent(Handle:event, const String:name[], bool:dontBroadcast)
  34. {
  35. new iAttacker = GetClientOfUserId(GetEventInt(event, "attacker"))
  36.  
  37. new fMoney = (GetMoney(iAttacker) + GetConVarInt(MnPerHit))
  38.  
  39. if(GetMoney(iAttacker) == 1600 || fMoney > 16000)
  40. {
  41. SetMoney(iAttacker, 16000)
  42.  
  43. return Plugin_Handled
  44. }
  45. SetMoney(iAttacker, fMoney)
  46.  
  47. return Plugin_Continue;
  48. }
  49. public Action:DeathEvent(Handle:event, const String:name[], bool:dontBroadcast)
  50. {
  51. new xAttacker = GetClientOfUserId(GetEventInt(event, "attacker"))
  52. new Hs = GetEventBool(event, "headshot")
  53.  
  54. new fMoney = (GetMoney(xAttacker) + GetConVarInt(MnPerKill) - 305)
  55. new HsMoney = (fMoney + GetConVarInt(MnPerHs))
  56.  
  57. if(GetMoney(xAttacker) == 16000 || fMoney > 16000)
  58. {
  59. SetMoney(xAttacker, 16000)
  60.  
  61. return Plugin_Handled
  62. }
  63. SetMoney(xAttacker, fMoney)
  64.  
  65. if(Hs)
  66. {
  67. if(HsMoney > 16000)
  68. {
  69. SetMoney(xAttacker, 16000)
  70.  
  71. return Plugin_Handled
  72. }
  73. SetMoney(xAttacker, HsMoney)
  74. }
  75. return Plugin_Continue;
  76. }
  77. public GetMoney(client)
  78. {
  79. if(g_iAccount != -1)
  80. {
  81. return GetEntData(client, g_iAccount);
  82. }
  83. return 0;
  84. }
  85. public SetMoney(client, amount)
  86. {
  87. if(g_iAccount != -1)
  88. {
  89. SetEntData(client, g_iAccount, amount);
  90. }
  91. }
  92.  
  93.