HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by ds811888 */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <cstrike>
  6. #include <fun>
  7.  
  8. #define PLUGIN "Counter-Strike Impulse 101"
  9. #define VERSION "1.1"
  10. #define AUTHOR "ds811888"
  11.  
  12. new cvar_enabled, cvar_buycost
  13.  
  14. public plugin_init()
  15. {
  16. register_plugin(PLUGIN, VERSION, AUTHOR)
  17.  
  18. /* Commands */
  19. register_clcmd("say /buy_impulse101", "cmd_buyimpulse")
  20. register_clcmd("say buy_impulse101", "cmd_buyimpulse")
  21.  
  22. /* Admin Commands */
  23. register_concmd("amx_giveimpulse", "cmd_giveimpulse", ADMIN_BAN, "<name>")
  24.  
  25. /* Cvars */
  26. cvar_enabled = register_cvar("amx_buyimpulse", "1")
  27. cvar_buycost = register_cvar("amx_impulse_cost", "16000")
  28.  
  29. /* Language */
  30. register_dictionary("cs_impulse101.txt")
  31. }
  32.  
  33. /* Admin Commands: amx_giveimpulse */
  34. public cmd_giveimpulse(id,level,cid)
  35. {
  36. /* Check user admin */
  37. if (!cmd_access(id,level,cid,2))
  38. return PLUGIN_HANDLED;
  39.  
  40. new arg[32];
  41. read_argv(1,arg,31);
  42.  
  43. new player = cmd_target(id,arg,7);
  44. if (!player)
  45. return PLUGIN_HANDLED;
  46.  
  47. new name[32];
  48. get_user_name(player,name,31);
  49.  
  50. /* Check user alive */
  51. if(!is_user_alive(player))
  52. return PLUGIN_HANDLED
  53.  
  54. /* Give user full weapons, full ammo, and full items */
  55. give_full_weapons(player)
  56. give_full_ammo(player)
  57. give_full_items(player)
  58.  
  59. return PLUGIN_HANDLED
  60. }
  61.  
  62. /* Commands: impulse 101 */
  63. public cmd_buyimpulse(id)
  64. {
  65. if(get_pcvar_num(cvar_enabled))
  66. {
  67. new money = cs_get_user_money(id)
  68. new price = get_pcvar_num(cvar_buycost)
  69.  
  70. /* Check user alive */
  71. if(!is_user_alive(id))
  72. return PLUGIN_HANDLED
  73.  
  74. /* Check user money */
  75. if(money <= price)
  76. {
  77. client_print(id, print_center, "[AMXX] %L", LANG_PLAYER, "NOT_ENOUGH_MONEY" , price)
  78. }
  79. else
  80. {
  81. /* -user money to buy a Impulse 101 */
  82. cs_set_user_money(id, money - price)
  83.  
  84. /* Client Print */
  85. client_print(id, print_center, "[AMXX] %L", LANG_PLAYER, "BOUGHT_IMPULSE")
  86.  
  87. /* Give user full weapons, full ammo, and full items */
  88. give_full_weapons(id)
  89. give_full_ammo(id)
  90. give_full_items(id)
  91. }
  92. }
  93. return PLUGIN_HANDLED
  94. }
  95.  
  96. stock give_full_weapons(id)
  97. {
  98. /* Give all weapons */
  99. give_item(id,"weapon_usp")
  100. give_item(id,"weapon_glock18")
  101. give_item(id,"weapon_deagle")
  102. give_item(id,"weapon_p228")
  103. give_item(id,"weapon_elite")
  104. give_item(id,"weapon_fiveseven")
  105. give_item(id,"weapon_m3")
  106. give_item(id,"weapon_xm1014")
  107. give_item(id,"weapon_mp5navy")
  108. give_item(id,"weapon_tmp")
  109. give_item(id,"weapon_p90")
  110. give_item(id,"weapon_mac10")
  111. give_item(id,"weapon_ump45")
  112. give_item(id,"weapon_famas")
  113. give_item(id,"weapon_sg552")
  114. give_item(id,"weapon_ak47")
  115. give_item(id,"weapon_m4a1")
  116. give_item(id,"weapon_aug")
  117. give_item(id,"weapon_scout")
  118. give_item(id,"weapon_awp")
  119. give_item(id,"weapon_g3sg1")
  120. give_item(id,"weapon_sg550")
  121. give_item(id,"weapon_galil")
  122. give_item(id,"weapon_m249")
  123. }
  124.  
  125. stock give_full_ammo(id)
  126. {
  127. /* Give full ammo */
  128. cs_set_user_bpammo(id, CSW_P228, 52) // ammo_357sig
  129. cs_set_user_bpammo(id, CSW_SCOUT, 90) // ammo_762nato
  130. cs_set_user_bpammo(id, CSW_XM1014, 32) // ammo_buckshot
  131. cs_set_user_bpammo(id, CSW_MAC10, 100) // ammo_45acp
  132. cs_set_user_bpammo(id, CSW_AUG, 90) // ammo_556nato
  133. cs_set_user_bpammo(id, CSW_ELITE, 120) // ammo_9mm
  134. cs_set_user_bpammo(id, CSW_FIVESEVEN, 100) // ammo_57mm
  135. cs_set_user_bpammo(id, CSW_AWP, 30) // ammo_338magnum
  136. cs_set_user_bpammo(id, CSW_M249, 200) // ammo_556natobox
  137. cs_set_user_bpammo(id, CSW_DEAGLE, 35) // ammo_50ae
  138. }
  139.  
  140. stock give_full_items(id)
  141. {
  142. /* Give all items */
  143. cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)
  144.  
  145. give_item(id,"weapon_flashbang")
  146. cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
  147. give_item(id,"weapon_hegrenade")
  148. give_item(id,"weapon_smokegrenade")
  149.  
  150. cs_set_user_nvg(id, 1)
  151. give_item(id,"weapon_shield")
  152.  
  153. /* if team terrorist */
  154. if(cs_get_user_team(id) == CS_TEAM_T)
  155. {
  156. give_item(id, "weapon_c4")
  157. cs_set_user_plant(id, 1, 1)
  158. } else
  159. {
  160. /* if team ct */
  161. cs_set_user_defuse(id, 1)
  162. }
  163. }