HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <cstrike>
  4.  
  5. new bool:g_hasC4[33]
  6. new PcvarCost
  7. static const PLUGIN_NAME[] = "Buy C4"
  8. static const PLUGIN_AUTHOR[] = "Locks"
  9. static const PLUGIN_VERSION[] = "1.2"
  10.  
  11. public plugin_init()
  12. {
  13. register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR)
  14. register_concmd("say buy_c4", "buy_c4")
  15. PcvarCost = register_cvar("amx_c4_cost", "6000")
  16. register_event("DeathMsg", "death", "a")
  17. }
  18.  
  19. public buy_c4(id)
  20. {
  21. new CsTeams:team = cs_get_user_team(id)
  22.  
  23. if ( team == CS_TEAM_CT )
  24. {
  25. client_print(id, print_chat, "[AMXX] Terroristanak kell lenned, hogy megvasarold a bombat.")
  26. return PLUGIN_HANDLED
  27. }
  28.  
  29. if ( g_hasC4[id] )
  30. {
  31. client_print(id, print_chat, "[AMXX] Neked mar van bombad!")
  32. }
  33.  
  34. if ( !is_user_alive(id) )
  35. {
  36. client_print(id,print_chat,"[AMXX] Halottkent nem vasarolhatsz bombat.")
  37. return PLUGIN_HANDLED
  38. }
  39.  
  40. if ( !cs_get_user_buyzone(id) )
  41. {
  42. client_print(id, print_chat, "[AMXX] Vasarlasi Zonaban kell lenned a bomba vasarlashoz.")
  43. return PLUGIN_HANDLED
  44. }
  45.  
  46. new money = cs_get_user_money(id)
  47. new cost = get_pcvar_num(PcvarCost)
  48.  
  49. if ( money < cost )
  50. {
  51. client_print(id, print_chat, "[AMXX] Nincs eleg penzed a bomba megvasarlasahoz. ($%i szukseges).", cost)
  52. return PLUGIN_CONTINUE
  53. }
  54.  
  55. give_item(id, "weapon_c4")
  56. cs_set_user_money(id, money - cost)
  57. client_print(id, print_chat, "[AMXX] Sikeresen vasaroltal bombat.")
  58. cs_set_user_plant(id, 1, 1)
  59. g_hasC4[id] = true
  60.  
  61. return PLUGIN_CONTINUE
  62. }
  63.  
  64. public client_connect(id)
  65. {
  66. g_hasC4[id] = false
  67. return PLUGIN_HANDLED
  68. }
  69.  
  70. public client_disconnect(id)
  71. {
  72. g_hasC4[id] = false
  73. return PLUGIN_HANDLED
  74. }
  75.  
  76. public death()
  77. {
  78. new id = read_data(2)
  79. g_hasC4[id] = false
  80. }