HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <sourcemod>
  2.  
  3. new Handle:Enabled
  4. new Handle:pBonus
  5. new Handle:dBonus
  6. new bool:g_isHooked
  7.  
  8. new g_iAccount
  9.  
  10. public Plugin:myinfo =
  11. {
  12. name = "Plant/Defuse Money",
  13. author = "Fredd",
  14. description = "C4 Lerakas es felszedesi penz erteke",
  15. version = "1.0",
  16. url = "www.sourcemod.net"
  17. }
  18.  
  19. public OnPluginStart()
  20. {
  21. CreateConVar("pdm_version", "1.0")
  22.  
  23. Enabled = CreateConVar("pdm_enabled", "1", "Engedelyezes/Kikapcsolva C4 Bonusz")
  24. dBonus = CreateConVar("pdm_defuse", "500", "Menyi penzt kapjon bomba hatastalanitasert")
  25. pBonus = CreateConVar("pdm_plant", "500", "Menyi penzt kapjon bomba lerakasert")
  26.  
  27. g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount")
  28.  
  29. HookEvent("bomb_planted", BombPlanted)
  30. HookEvent("bomb_defused", BombDefused)
  31.  
  32. HookConVarChange(Enabled, ConvarChanged)
  33. }
  34. public OnPluginEnd()
  35. {
  36. if (g_isHooked == true)
  37. {
  38. UnhookEvent("bomb_planted", BombPlanted)
  39. UnhookEvent("bomb_defused", BombDefused)
  40. }
  41.  
  42. UnhookConVarChange(Enabled, ConvarChanged);
  43. }
  44. public ConvarChanged(Handle:convar, const String:oldValue[], const String:newValue[])
  45. {
  46. new value = !!StringToInt(newValue);
  47. if (value == 0)
  48. {
  49. if (g_isHooked == true)
  50. {
  51. g_isHooked = false;
  52.  
  53. UnhookEvent("bomb_planted", BombPlanted)
  54. UnhookEvent("bomb_defused", BombDefused)
  55. }
  56. }
  57. else
  58. {
  59. g_isHooked = true;
  60.  
  61. HookEvent("bomb_planted", BombPlanted)
  62. HookEvent("bomb_defused", BombDefused)
  63.  
  64. }
  65. }
  66. public Action:BombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
  67. {
  68. new client = GetClientOfUserId(GetEventInt(event, "userid"))
  69.  
  70. SetMoney(client, (GetMoney(client) + GetConVarInt(pBonus)))
  71.  
  72. return Plugin_Continue;
  73. }
  74. public Action:BombDefused(Handle:event, const String:name[], bool:dontBroadcast)
  75. {
  76. new client = GetClientOfUserId(GetEventInt(event, "userid"))
  77.  
  78. SetMoney(client, (GetMoney(client) + GetConVarInt(dBonus)))
  79.  
  80. return Plugin_Continue;
  81. }
  82. public GetMoney(client)
  83. {
  84. if(g_iAccount != -1)
  85. {
  86. return GetEntData(client, g_iAccount);
  87. }
  88. return 0;
  89. }
  90. public SetMoney(client, amount)
  91. {
  92. if(g_iAccount != -1)
  93. {
  94. SetEntData(client, g_iAccount, amount);
  95. }
  96. }
  97.  
  98.