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