HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. OciXCrom's Custom Shop
  3. The shop contains the following items (by default):
  4.  
  5. [a] +50 Health -- Gives you +50 health points
  6. [b] +100 Armor -- Gives you +100 armor points
  7. [c] Unlimited Clip -- Makes your current weapon have unlimited bullets (without reloading). This item can only be activated on a weapon that actually uses bullets, reloading will remove the unlimited clip
  8. [d] Unlimited Ammo -- Adds unlimited backpack ammo to your current weapon
  9. [e] All Grenades -- Gives you HE Grenade, 2x Flashbang and a Smoke Grenade
  10. [f] Bomber -- Gives you 20 HE Grenades
  11. [g] Silent Footsteps -- You won't make noise when running
  12. [h] Faster Speed -- Makes you run faster
  13. [i] Low Gravity -- Allows you to jump higher
  14. [j] Chameleon -- Use this item to fool your enemies by disguising as them
  15. [k] Drugs (Speed + Health) -- Distorts your screen, makes you run faster and gives you additional health. The distortion is lost when zooming in
  16. [l] Transparency -- Makes you transparent
  17. [m] Invisibility (15 Seconds) -- Buying this will make you fully invisible for 15 seconds
  18. [n] Double Damage -- Doubles the damage you make on an enemy player
  19. [o] GodMode (5 Seconds) -- Become immortal for 5 seconds
  20. [p] Health Regeneration -- Regenerates 1 health point each half of a second
  21. [q] Armor Regeneration -- Regenerates 10 armor points each half of a second
  22. [r] No Recoil -- Removes weapon recoil
  23.  
  24. Every single item can be disabled and modified by using various cvars.
  25. To disable any item, you can use the cvar "customshop_disableditems", add the item's letter in the cvar string to disable it.
  26.  
  27. Use these cvars to control the main options of the Shop:
  28.  
  29. * customshop_disableditems <any available item letter (case sensitive)> -- Leave it empty if you want all items to be enabled
  30. * customshop_viponly <default: 0> -- Set to "1" if you want the Shop to be available only for players with a certain flag, you can change the flag by editing SHOP_ACCESS
  31. * customshop_infomessage_enabled <default: 1> -- Enable/Disable information message showing in chat
  32. * customshop_infomessage_time <default: 90.0> -- Controls the time needed (in seconds) for the information message to display in chat
  33. * customshop_buyequip <default: 1> -- Use "0" if you don't want the shop to be accessed by using the "buyequip" command (or button "o" by default)
  34. * customshop_currency_symbol <default: $ / Pts.> -- Set the currency symbol that is shown in the shop menu
  35. * customshop_teamonly <default: 0> -- Use this to make the shop available only for a certain team (0 = None; 1 = T; 2 = CT; 3 = Spectator)
  36.  
  37. Cvars for the Points System:
  38.  
  39. * customshop_points <default: 0> -- Set to "1" if you want to use special points, instead of money
  40. * customshop_savepoints <default: 1> -- Controls whether the plugin will save players' points on disconnect
  41. * customshop_teamkillpoints <default: 0> -- If you want players to get points when killing a teammate
  42. * customshop_killmessage <default: 1> -- Use "0" to disable the kill messages in chat
  43. * customshop_reward_normal <default: 15> -- Controls how many points you get for a normal kill
  44. * customshop_reward_headshot <default: 30> -- Controls how many points you get for a headshot
  45. * customshop_reward_knife <default: 50> -- Controls how many points you get for a knife kill
  46.  
  47. Commands:
  48.  
  49. * say /shop -- Opens up the Shop Menu
  50. * say /points -- Shows the player his current points status
  51. * amx_points <nick|#userid|@team> <points to give/take> -- An admin command to give or take points, you can use "0" to take all points from the player
  52.  
  53. You can change any item's price by using the following cvars:
  54.  
  55. [a] customshop_health_price <default: 1500>
  56. [b] customshop_armor_price <default: 1000>
  57. [c] customshop_unlclip_price <default: 3000>
  58. [d] customshop_unlammo_price <default: 200>
  59. [e] customshop_allgrenades_price <default: 800>
  60. [f] customshop_bomber_price <default: 1600>
  61. [g] customshop_silentsteps_price <default: 3000>
  62. [h] customshop_fasterspeed_price <default: 4300>
  63. [i] customshop_lowgravity_price <default: 2800>
  64. [j] customshop_chameleon_price <default: 9000>
  65. [k] customshop_drugs_price <default: 8000>
  66. [l] customshop_transparency_price <default: 2500>
  67. [m] customshop_invisibility_price <default: 16000>
  68. [n] customshop_doubledamage_price <default: 10000>
  69. [o] customshop_godmode_price <default: 16000>
  70. [p] customshop_healthregen_price <default: 1800>
  71. [q] customshop_armorregen_price <default: 2000>
  72. [r] customshop_norecoil_price <default: 12000>
  73.  
  74. Note: The cvars above are for the regular Money System, and the other ones are for the Points System.
  75.  
  76. [a] customshop_health_price2 <default: 150>
  77. [b] customshop_armor_price2 <default: 100>
  78. [c] customshop_unlclip_price2 <default: 300>
  79. [d] customshop_unlammo_price2 <default: 20>
  80. [e] customshop_allgrenades_price2 <default: 80>
  81. [f] customshop_bomber_price2 <default: 160>
  82. [g] customshop_silentsteps_price2 <default: 300>
  83. [h] customshop_fasterspeed_price2 <default: 430>
  84. [i] customshop_lowgravity_price2 <default: 280>
  85. [j] customshop_chameleon_price2 <default: 900>
  86. [k] customshop_drugs_price2 <default: 800>
  87. [l] customshop_transparency_price2 <default: 250>
  88. [m] customshop_invisibility_price2 <default: 1600>
  89. [n] customshop_doubledamage_price2 <default: 1000>
  90. [o] customshop_godmode_price2 <default: 1600>
  91. [p] customshop_healthregen_price2 <default: 180>
  92. [q] customshop_armorregen_price2 <default: 200>
  93. [r] customshop_norecoil_price2 <default: 1200>
  94.  
  95. Use these cvars to control the item limit:
  96.  
  97. [a] customshop_health_limit <default: 5>
  98. [b] customshop_armor_limit <default: 8>
  99. [c] customshop_unlclip_limit <default: 3>
  100. [d] customshop_unlammo_limit <default: 5>
  101. [e] customshop_allgrenades_limit <default: 10>
  102. [f] customshop_bomber_limit <default: 3>
  103. [g] customshop_silentsteps_limit <default: 1>
  104. [h] customshop_fasterspeed_limit <default: 1>
  105. [i] customshop_lowgravity_limit <default: 1>
  106. [j] customshop_chameleon_limit <default: 1>
  107. [k] customshop_drugs_limit <default: 2>
  108. [l] customshop_transparency_limit <default: 1>
  109. [m] customshop_invisibility_limit <default: 3>
  110. [n] customshop_doubledamage_limit <default: 1>
  111. [o] customshop_godmode_limit <default: 1>
  112. [p] customshop_healthregen_limit <default: 2>
  113. [q] customshop_armorregen_limit <default: 2>
  114. [r] customshop_norecoil_limit <default: 1>
  115.  
  116. Other item cvars:
  117.  
  118. [a] customshop_health_amount <default: 50> -- Controls the health points you get when buying item "a"
  119. [b] customshop_armor_amount <default: 100> -- Controls the armor points you get when buying item "b"
  120. [f] customshop_bomber_amount <default: 20> -- Controls how many HE Grenades you get when buying item "f"
  121. [h] customshop_fasterspeed_amount <default: 300.0> -- Controls the speed boost you get when buying item "h"
  122. [i] customshop_lowgravity_amount <default: 0.5> -- Controls the gravity you get when buying item "i". Be aware that the lower the gravity is, the higher you jump
  123. [k] customshop_drugs_speedamount <default: 300.0> -- Controls the speed boost you get when buying item "k"
  124. [k] customshop_drugs_healthamount <default: 200> -- Controls the health points you get when buying item "k"
  125. [l] customshop_transparency_amount <default: 75> -- Controls the transparency amount when buying item "l". Use a number from 0 to 255, the lower the number, the more transparency you get
  126. [m] customshop_invisibility_time <default: 15.0> -- Controls how many seconds you're invisible when buying item "m"
  127. [o] customshop_godmode_time <default: 5.0> -- Controls how many seconds you're immortal when buying item "o"
  128. [p] customshop_healthregen_amount <default: 1> -- Controls how many health points you get every second when buying item "p"
  129. [p] customshop_healthregen_time <default: 0.5> -- Controls the speed of regeneration when buying item "p"
  130. [p] customshop_healthregen_max <default: 150> -- Controls the maximum amount of regenerated health when buying item "p"
  131. [q] customshop_armorregen_amount <default: 10> -- Controls how many armor points you get every second when buying item "p"
  132. [q] customshop_armorregen_time <default: 0.5> -- Controls the speed of regeneration when buying item "p"
  133. [q] customshop_armorregen_max <default: 150> -- Controls the maximum amount of regenerated armor when buying item "p"
  134.  
  135. The plugin also allows you to add a custom sound for every item, check g_itemSounds.
  136. */
  137.  
  138. #include <amxmodx>
  139. #include <amxmisc>
  140. #include <cstrike>
  141. #include <fakemeta>
  142. #include <fun>
  143. #include <hamsandwich>
  144. #include <nvault>
  145.  
  146. #define PLUGIN_NAME "Custom Shop"
  147. #define PLUGIN_VERSION "2.0"
  148. #define PLUGIN_AUTHOR "OciXCrom"
  149.  
  150. #define SHOP_ACCESS ADMIN_RESERVATION
  151. #define FLAG_ADMIN ADMIN_SLAY
  152. #define MAX_ITEMS 17
  153. #define m_pActiveItem 373
  154.  
  155. #define sNo "buttons/button11.wav"
  156. #define sOver "buttons/blip2.wav"
  157.  
  158. new const szPrefix[] = "^4[Custom Shop]"
  159.  
  160. enum Color
  161. {
  162. NORMAL = 1, // clients scr_concolor cvar color
  163. GREEN, // Green Color
  164. TEAM_COLOR, // Red, grey, blue
  165. GREY, // grey
  166. RED, // Red
  167. BLUE, // Blue
  168. }
  169.  
  170. new TeamName[][] =
  171. {
  172. "",
  173. "TERRORIST",
  174. "CT",
  175. "SPECTATOR"
  176. }
  177.  
  178. new const g_playerModels[][] = {
  179. "arctic",
  180. "guerilla",
  181. "leet",
  182. "terror",
  183. "gign",
  184. "gsg9",
  185. "sas",
  186. "urban"
  187. }
  188.  
  189. new const g_itemSounds[][] = {
  190. "items/smallmedkit1.wav", // Item "a": +50 Health
  191. "items/ammopickup2.wav", // Item "b": +50 Armor
  192. "items/gunpickup2.wav", // Item "c": Unlimited Clip
  193. "items/gunpickup2.wav", // Item "d": Unlimited Ammo
  194. "items/gunpickup2.wav", // Item "e": All Grenades
  195. "x/x_pain2.wav", // Item "f": Bomber
  196. "items/gunpickup2.wav", // Item "g": Silent Footsteps
  197. "misc/bipbip.wav", // Item "h": Faster Speed
  198. "items/gunpickup2.wav", // Item "i": Low Gravity
  199. "items/gunpickup2.wav", // Item "j": Chameleon
  200. "items/gunpickup2.wav", // Item "k": Drugs (Speed + Health)
  201. "items/gunpickup2.wav", // Item "l": Transparency
  202. "hornet/ag_buzz1.wav", // Item "m": Invisibility (15 Seconds)
  203. "items/gunpickup2.wav", // Item "n": Double Damage
  204. "misc/stinger12.wav", // Item "o": GodMode (5 Seconds)
  205. "items/suitchargeok1.wav", // Item "p": Health Regeneration
  206. "items/suitchargeok1.wav", // Item "q": Armor Regeneration
  207. "items/gunpickup2.wav" // Item "r": No Recoil
  208. }
  209.  
  210. new DisabledItems, VIPOnly, gmsg_SetFOV
  211. new HealthAmount, HealthPrice, ArmorAmount, ArmorPrice, UnlimitedClipPrice, UnlimitedAmmoPrice, AllGrenadesPrice, BomberPrice, BomberAmount, SilentFootstepsPrice
  212. new FasterSpeedAmount, FasterSpeedPrice, LowGravityAmount, LowGravityPrice, ChameleonPrice, DrugsSpeedAmount, DrugsHealthAmount, DrugsPrice
  213. new TransparencyAmount, TransparencyPrice, InvisibilityTime, InvisibilityPrice, DoubleDamagePrice, GodModeTime, GodModePrice, HealthRegenAmount, HealthRegenTime
  214. new HealthRegenMax, HealthRegenPrice, ArmorRegenAmount, ArmorRegenTime, ArmorRegenMax, ArmorRegenPrice, InfoMessageEnabled, InfoMessageTime, ShopEquip, ShopPoints
  215. new SavePoints, TeamKillPoints, KillMessage, NormalReward, HeadshotReward, KnifeReward, CurrencySymbol, NoRecoilPrice, TeamOnly
  216. new HealthLimit, ArmorLimit, UnlimitedClipLimit, UnlimitedAmmoLimit, AllGrenadesLimit, BomberLimit, SilentFootstepsLimit, FasterSpeedLimit, LowGravityLimit, ChameleonLimit
  217. new DrugsLimit, TransparencyLimit, InvisibilityLimit, DoubleDamageLimit, GodModeLimit, HealthRegenLimit, ArmorRegenLimit, NoRecoilLimit
  218. new g_vault, activity, cvar
  219.  
  220. new weapon[33], points[33]
  221. new userlimit[33][33]
  222.  
  223. new bool:cshop_speed[33]
  224. new bool:cshop_ddamage[33]
  225. new bool:cshop_healthregen[33]
  226. new bool:cshop_armorregen[33]
  227. new bool:cshop_norecoil[33]
  228.  
  229. new bool:use_points
  230.  
  231. new const g_itemLanguage[][] = {
  232. "CSHOP_HEALTH",
  233. "CSHOP_ARMOR",
  234. "CSHOP_UNLCLIP",
  235. "CSHOP_UNLAMMO",
  236. "CSHOP_ALLGRENADES",
  237. "CSHOP_BOMBER",
  238. "CSHOP_SILENTSTEPS",
  239. "CSHOP_FASTERSPEED",
  240. "CSHOP_LOWGRAVITY",
  241. "CSHOP_CHAMELEON",
  242. "CSHOP_DRUGS",
  243. "CSHOP_TRANSPARENCY",
  244. "CSHOP_INVISIBILITY",
  245. "CSHOP_DDAMAGE",
  246. "CSHOP_GODMODE",
  247. "CSHOP_HEALTHREGEN",
  248. "CSHOP_ARMORREGEN",
  249. "CSHOP_NORECOIL"
  250. }
  251.  
  252. public plugin_init()
  253. {
  254. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  255. register_dictionary("custom_shop.txt")
  256.  
  257. register_event("CurWeapon", "change_weapon", "be", "1=1")
  258. register_event("DeathMsg", "player_killed", "a")
  259. RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
  260. RegisterHam(Ham_TakeDamage, "player", "player_damage")
  261. register_forward(FM_PlayerPreThink, "player_prethink")
  262.  
  263. register_clcmd("say /shop", "cshop_main")
  264. register_clcmd("say_team /shop", "cshop_main")
  265. register_clcmd("say /points", "cmd_points")
  266. register_clcmd("say_team /points", "cmd_points")
  267.  
  268. ShopPoints = register_cvar("customshop_points", "0")
  269. use_points = (get_pcvar_num(ShopPoints) == 1) ? true : false
  270.  
  271. DisabledItems = register_cvar("customshop_disableditems", "")
  272. VIPOnly = register_cvar("customshop_viponly", "0")
  273.  
  274. if(use_points)
  275. {
  276. HealthPrice = register_cvar("customshop_health_price2", "150")
  277. ArmorPrice = register_cvar("customshop_armor_price2", "100")
  278. UnlimitedClipPrice = register_cvar("customshop_unlclip_price2", "300")
  279. UnlimitedAmmoPrice = register_cvar("customshop_unlammo_price2", "20")
  280. AllGrenadesPrice = register_cvar("customshop_allgrenades_price2", "80")
  281. BomberPrice = register_cvar("customshop_bomber_price2", "160")
  282. SilentFootstepsPrice = register_cvar("customshop_silentsteps_price2", "300")
  283. FasterSpeedPrice = register_cvar("customshop_fasterspeed_price2", "430")
  284. LowGravityPrice = register_cvar("customshop_lowgravity_price2", "280")
  285. ChameleonPrice = register_cvar("customshop_chameleon_price2", "900")
  286. DrugsPrice = register_cvar("customshop_drugs_price2", "800")
  287. TransparencyPrice = register_cvar("customshop_transparency_price2", "250")
  288. InvisibilityPrice = register_cvar("customshop_invisibility_price2", "1600")
  289. DoubleDamagePrice = register_cvar("customshop_doubledamage_price2", "1000")
  290. GodModePrice = register_cvar("customshop_godmode_price2", "1600")
  291. HealthRegenPrice = register_cvar("customshop_healthregen_price2", "180")
  292. ArmorRegenPrice = register_cvar("customshop_armorregen_price2", "200")
  293. SavePoints = register_cvar("customshop_savepoints", "1")
  294. TeamKillPoints = register_cvar("customshop_teamkillpoints", "0")
  295. KillMessage = register_cvar("customshop_killmessage", "1")
  296. NormalReward = register_cvar("customshop_reward_normal", "15")
  297. HeadshotReward = register_cvar("customshop_reward_headshot", "30")
  298. KnifeReward = register_cvar("customshop_reward_knife", "50")
  299. CurrencySymbol = register_cvar("customshop_currency_symbol2", " Pts.")
  300. NoRecoilPrice = register_cvar("customshop_norecoil_price2", "1200")
  301.  
  302. register_concmd("amx_points", "cmd_givepoints", FLAG_ADMIN, "<nick|#userid|@team> <points to give/take>")
  303. }
  304. else
  305. {
  306. HealthPrice = register_cvar("customshop_health_price", "1500")
  307. ArmorPrice = register_cvar("customshop_armor_price", "1000")
  308. UnlimitedClipPrice = register_cvar("customshop_unlclip_price", "3000")
  309. UnlimitedAmmoPrice = register_cvar("customshop_unlammo_price", "200")
  310. AllGrenadesPrice = register_cvar("customshop_allgrenades_price", "800")
  311. BomberPrice = register_cvar("customshop_bomber_price", "1600")
  312. SilentFootstepsPrice = register_cvar("customshop_silentsteps_price", "3000")
  313. FasterSpeedPrice = register_cvar("customshop_fasterspeed_price", "4300")
  314. LowGravityPrice = register_cvar("customshop_lowgravity_price", "2800")
  315. ChameleonPrice = register_cvar("customshop_chameleon_price", "9000")
  316. DrugsPrice = register_cvar("customshop_drugs_price", "8000")
  317. TransparencyPrice = register_cvar("customshop_transparency_price", "2500")
  318. InvisibilityPrice = register_cvar("customshop_invisibility_price", "16000")
  319. DoubleDamagePrice = register_cvar("customshop_doubledamage_price", "10000")
  320. GodModePrice = register_cvar("customshop_godmode_price", "16000")
  321. HealthRegenPrice = register_cvar("customshop_healthregen_price", "1800")
  322. ArmorRegenPrice = register_cvar("customshop_armorregen_price", "2000")
  323. CurrencySymbol = register_cvar("customshop_currency_symbol", "$")
  324. NoRecoilPrice = register_cvar("customshop_norecoil_price", "12000")
  325. }
  326.  
  327. HealthAmount = register_cvar("customshop_health_amount", "50")
  328. ArmorAmount = register_cvar("customshop_armor_amount", "100")
  329. BomberAmount = register_cvar("customshop_bomber_amount", "20")
  330. FasterSpeedAmount = register_cvar("customshop_fasterspeed_amount", "300.0")
  331. LowGravityAmount = register_cvar("customshop_lowgravity_amount", "0.5")
  332. DrugsSpeedAmount = register_cvar("customshop_drugs_speedamount", "300.0")
  333. DrugsHealthAmount = register_cvar("customshop_drugs_healthamount", "200")
  334. TransparencyAmount = register_cvar("customshop_transparency_amount", "75")
  335. InvisibilityTime = register_cvar("customshop_invisibility_time", "15.0")
  336. GodModeTime = register_cvar("customshop_godmode_time", "5.0")
  337. HealthRegenAmount = register_cvar("customshop_healthregen_amount", "1")
  338. HealthRegenTime = register_cvar("customshop_healthregen_time", "0.5")
  339. HealthRegenMax = register_cvar("customshop_healthregen_max", "150")
  340. ArmorRegenAmount = register_cvar("customshop_armorregen_amount", "10")
  341. ArmorRegenTime = register_cvar("customshop_armorregen_time", "0.5")
  342. ArmorRegenMax = register_cvar("customshop_armorregen_max", "150")
  343. InfoMessageEnabled = register_cvar("customshop_infomessage_enabled", "1")
  344. InfoMessageTime = register_cvar("customshop_infomessage_time", "90.0")
  345. ShopEquip = register_cvar("customshop_buyequip", "1")
  346. TeamOnly = register_cvar("customshop_teamonly", "0")
  347.  
  348. HealthLimit = register_cvar("customshop_health_limit", "5")
  349. ArmorLimit = register_cvar("customshop_armor_limit", "8")
  350. UnlimitedClipLimit = register_cvar("customshop_unlclip_limit", "3")
  351. UnlimitedAmmoLimit = register_cvar("customshop_unlammo_limit", "5")
  352. AllGrenadesLimit = register_cvar("customshop_allgrenades_limit", "10")
  353. BomberLimit = register_cvar("customshop_bomber_limit", "3")
  354. SilentFootstepsLimit = register_cvar("customshop_silentsteps_limit", "1")
  355. FasterSpeedLimit = register_cvar("customshop_fasterspeed_limit", "1")
  356. LowGravityLimit = register_cvar("customshop_lowgravity_limit", "1")
  357. ChameleonLimit = register_cvar("customshop_chameleon_limit", "1")
  358. DrugsLimit = register_cvar("customshop_drugs_limit", "2")
  359. TransparencyLimit = register_cvar("customshop_transparency_limit", "1")
  360. InvisibilityLimit = register_cvar("customshop_invisibility_limit", "3")
  361. DoubleDamageLimit = register_cvar("customshop_doubledamage_limit", "1")
  362. GodModeLimit = register_cvar("customshop_godmode_limit", "1")
  363. HealthRegenLimit = register_cvar("customshop_healthregen_limit", "2")
  364. ArmorRegenLimit = register_cvar("customshop_armorregen_limit", "2")
  365. NoRecoilLimit = register_cvar("customshop_norecoil_limit", "1")
  366.  
  367. if(get_pcvar_num(ShopEquip) == 1) register_clcmd("buyequip", "cshop_main")
  368. if(get_pcvar_num(InfoMessageEnabled) == 1) set_task(get_pcvar_float(InfoMessageTime), "infoMessage", 1111, "", 0, "b", 0)
  369.  
  370. gmsg_SetFOV = get_user_msgid("SetFOV")
  371. g_vault = nvault_open("CutomShop")
  372. activity = get_pcvar_num(get_cvar_pointer("amx_show_activity"))
  373. }
  374.  
  375. public client_putinserver(id)
  376. {
  377. cshop_speed[id] = false
  378. cshop_ddamage[id] = false
  379. cshop_healthregen[id] = false
  380. cshop_armorregen[id] = false
  381. cshop_norecoil[id] = false
  382. LoadData(id)
  383. }
  384.  
  385. public client_disconnect(id)
  386. if(use_points && get_pcvar_num(SavePoints) == 1) SaveData(id)
  387.  
  388. public SaveData(id)
  389. {
  390. new name[32]
  391. get_user_name(id, name, 31)
  392. new vaultkey[64], vaultdata[256]
  393.  
  394. format(vaultkey, 63, "%s", name)
  395. format(vaultdata, 255, "%i", points[id])
  396. nvault_set(g_vault, vaultkey, vaultdata)
  397.  
  398. return PLUGIN_CONTINUE
  399. }
  400.  
  401. LoadData(id)
  402. {
  403. new name[32]
  404. get_user_name(id, name, 31)
  405. new vaultkey[64], vaultdata[256]
  406.  
  407. format(vaultkey, 63, "%s", name)
  408. format(vaultdata, 255, "%i", points[id])
  409. nvault_get(g_vault, vaultkey, vaultdata, 255)
  410.  
  411. new points_user[10]
  412. parse(vaultdata, points_user, 9)
  413.  
  414. new points_set = str_to_num(points_user)
  415. points[id] = points_set
  416.  
  417. return PLUGIN_CONTINUE
  418. }
  419.  
  420. public player_spawn(id)
  421. {
  422. cshop_speed[id] = false
  423. cshop_ddamage[id] = false
  424. cshop_healthregen[id] = false
  425. cshop_armorregen[id] = false
  426. cshop_norecoil[id] = false
  427. if(is_user_alive(id))
  428. {
  429. set_user_footsteps(id, 0)
  430. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)
  431. }
  432. if(is_user_connected(id)) cs_reset_user_model(id)
  433.  
  434. for(new i = 0; i < MAX_ITEMS + 1; i++)
  435. set_user_limit(id, i, 0)
  436. }
  437.  
  438. public change_weapon(id)
  439. {
  440. weapon[id] = get_user_weapon(id)
  441. if(cshop_speed[id]) set_user_maxspeed(id, get_pcvar_float(FasterSpeedAmount))
  442. }
  443.  
  444. public infoMessage()
  445. ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_INFO", PLUGIN_NAME, PLUGIN_AUTHOR)
  446.  
  447. public cmd_points(id)
  448. {
  449. if(!use_points) ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOPOINTS")
  450. else ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_YOURPOINTS", points[id])
  451.  
  452. return PLUGIN_HANDLED
  453. }
  454.  
  455. public cmd_givepoints(id, level, cid)
  456. {
  457. if(!cmd_access(id, level, cid, 3))
  458. return PLUGIN_HANDLED
  459.  
  460. new arg[32], arg2[8], name[32], name2[32], g_players[32], num, player
  461. read_argv(1, arg, 31)
  462. read_argv(2, arg2, 7)
  463. get_players(g_players, num)
  464. get_user_name(id, name, 31)
  465.  
  466. new amount = str_to_num(arg2)
  467. new count = 0
  468.  
  469. if(arg[0] == '@')
  470. {
  471. for(new i = 0; i < num; i++)
  472. {
  473. player = g_players[i]
  474.  
  475. if((equali(arg, "@T") && get_user_team(player) == 1) || (equali(arg, "@CT") && get_user_team(player) == 2) || equali(arg, "@ALL"))
  476. {
  477. points[player] += amount
  478. count++
  479. }
  480. }
  481.  
  482. if(count == 0)
  483. {
  484. ColorChat(id, RED, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOPLAYERS")
  485. client_print(id, print_console, "%s %L", szPrefix, LANG_SERVER, "CSHOP_NOPLAYERS")
  486. return PLUGIN_HANDLED
  487. }
  488.  
  489. if(equali(arg, "@T")) formatex(name2, 31, "%L", LANG_SERVER, "CSHOP_ALL_T")
  490. else if(equali(arg, "@CT")) formatex(name2, 31, "%L", LANG_SERVER, "CSHOP_ALL_CT")
  491. else formatex(name2, 31, "%L", LANG_SERVER, "CSHOP_ALL_PLR")
  492. }
  493. else
  494. {
  495. player = cmd_target(id, arg, 0)
  496. if(!player) return PLUGIN_HANDLED
  497.  
  498. get_user_name(player, name2, 31)
  499.  
  500. if(amount == 0)
  501. {
  502. ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_TOOKALL", name, name2)
  503. client_print(id, print_console, "%s %L", szPrefix, LANG_SERVER, "CSHOP_TOOKALL_CONSOLE", name2)
  504. log_amx("%s %L", szPrefix, LANG_SERVER, "CSHOP_TOOKALL_LOG", name, name2)
  505.  
  506. points[player] = 0
  507. return PLUGIN_HANDLED
  508. }
  509.  
  510. points[player] += amount
  511. }
  512.  
  513. switch(activity)
  514. {
  515. case 1: ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS", LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
  516. case 2: ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS", name, LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
  517. }
  518.  
  519. client_print(id, print_console, "%s %L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS_CONSOLE", LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
  520. log_amx("%s %L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS_LOG", name, LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
  521.  
  522. return PLUGIN_HANDLED
  523. }
  524.  
  525. public cshop_main(id)
  526. {
  527. if(get_pcvar_num(VIPOnly) == 1)
  528. {
  529. if(!(get_user_flags(id) & SHOP_ACCESS))
  530. {
  531. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOACCESS")
  532. client_cmd(id, "spk %s", sNo)
  533. return PLUGIN_HANDLED
  534. }
  535. }
  536.  
  537. new shop_team = get_pcvar_num(TeamOnly)
  538. new team = get_user_team(id)
  539.  
  540. if(shop_team != 0)
  541. {
  542. if(shop_team != team)
  543. {
  544. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_TEAMONLY", (shop_team == 1) ? "T" : (shop_team == 2) ? "CT" : "Spectator")
  545. client_cmd(id, "spk %s", sNo)
  546. return PLUGIN_HANDLED
  547. }
  548. }
  549.  
  550. if(!is_user_alive(id))
  551. {
  552. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOTALIVE")
  553. client_cmd(id, "spk %s", sNo)
  554. return PLUGIN_HANDLED
  555. }
  556.  
  557. new menu_title[200], items[30], symbol[20]
  558. new amount = use_points ? points[id] : cs_get_user_money(id)
  559. get_pcvar_string(DisabledItems, items, charsmax(items))
  560. get_pcvar_string(CurrencySymbol, symbol, charsmax(symbol))
  561.  
  562. formatex(menu_title, charsmax(menu_title), "\yOciXCrom's \rCustom Shop^n\w%L: \r%i \d| \w%L:\d", LANG_SERVER, use_points ? "CSHOP_POINTS" : "CSHOP_MONEY", amount, LANG_SERVER, "CSHOP_PAGE")
  563. new customshop = menu_create(menu_title, "cshop_handler")
  564.  
  565. new item[80], close[15], back[15], next[15]
  566.  
  567. if(contain(items, "a") == -1) // Item "a": +50 Health
  568. {
  569. formatex(item, charsmax(item), "%s+%i %L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(HealthPrice)) ? "" : "\d", get_pcvar_num(HealthAmount), LANG_SERVER, "CSHOP_HEALTH", get_pcvar_num(HealthPrice), symbol, get_user_limit(id, 0), itemlimit(0))
  570. menu_additem(customshop, item, "0", 0)
  571. }
  572.  
  573. if(contain(items, "b") == -1) // Item "b": +50 Armor
  574. {
  575. formatex(item, charsmax(item), "%s+%i %L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(ArmorPrice)) ? "" : "\d", get_pcvar_num(ArmorAmount), LANG_SERVER, "CSHOP_ARMOR", get_pcvar_num(ArmorPrice), symbol, get_user_limit(id, 1), itemlimit(1))
  576. menu_additem(customshop, item, "1", 0)
  577. }
  578.  
  579. if(contain(items, "c") == -1) // Item "c": Unlimited Clip
  580. {
  581. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(UnlimitedClipPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_UNLCLIP", get_pcvar_num(UnlimitedClipPrice), symbol, get_user_limit(id, 2), itemlimit(2))
  582. menu_additem(customshop, item, "2", 0)
  583. }
  584.  
  585. if(contain(items, "d") == -1) // Item "d": Unlimited Ammo
  586. {
  587. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(UnlimitedAmmoPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_UNLAMMO", get_pcvar_num(UnlimitedAmmoPrice), symbol, get_user_limit(id, 3), itemlimit(3))
  588. menu_additem(customshop, item, "3", 0)
  589. }
  590.  
  591. if(contain(items, "e") == -1) // Item "e": All Grenades
  592. {
  593. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(AllGrenadesPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_ALLGRENADES", get_pcvar_num(AllGrenadesPrice), symbol, get_user_limit(id, 4), itemlimit(4))
  594. menu_additem(customshop, item, "4", 0)
  595. }
  596.  
  597. if(contain(items, "f") == -1) // Item "f": Bomber
  598. {
  599. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(BomberPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_BOMBER", get_pcvar_num(BomberPrice), symbol, get_user_limit(id, 5), itemlimit(5))
  600. menu_additem(customshop, item, "5", 0)
  601. }
  602.  
  603. if(contain(items, "g") == -1) // Item "g": Silent Footsteps
  604. {
  605. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(SilentFootstepsPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_SILENTSTEPS", get_pcvar_num(SilentFootstepsPrice), symbol, get_user_limit(id, 6), itemlimit(6))
  606. menu_additem(customshop, item, "6", 0)
  607. }
  608.  
  609. if(contain(items, "h") == -1) // Item "h": Faster Speed
  610. {
  611. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(FasterSpeedPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_FASTERSPEED", get_pcvar_num(FasterSpeedPrice), symbol, get_user_limit(id, 7), itemlimit(7))
  612. menu_additem(customshop, item, "7", 0)
  613. }
  614.  
  615. if(contain(items, "i") == -1) // Item "i": Low Gravity
  616. {
  617. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(LowGravityPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_LOWGRAVITY", get_pcvar_num(LowGravityPrice), symbol, get_user_limit(id, 8), itemlimit(8))
  618. menu_additem(customshop, item, "8", 0)
  619. }
  620.  
  621. if(contain(items, "j") == -1) // Item "j": Chameleon
  622. {
  623. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(ChameleonPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_CHAMELEON", get_pcvar_num(ChameleonPrice), symbol, get_user_limit(id, 9), itemlimit(9))
  624. menu_additem(customshop, item, "9", 0)
  625. }
  626.  
  627. if(contain(items, "k") == -1) // Item "k": Drugs (Speed + Health)
  628. {
  629. formatex(item, charsmax(item), "%s%L (%L) \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(DrugsPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_DRUGS", LANG_SERVER, "CSHOP_DRUGS2", get_pcvar_num(DrugsPrice), symbol, get_user_limit(id, 10), itemlimit(10))
  630. menu_additem(customshop, item, "10", 0)
  631. }
  632.  
  633. if(contain(items, "l") == -1) // Item "l": Transparency
  634. {
  635. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(TransparencyPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_TRANSPARENCY", get_pcvar_num(TransparencyPrice), symbol, get_user_limit(id, 11), itemlimit(11))
  636. menu_additem(customshop, item, "11", 0)
  637. }
  638.  
  639. if(contain(items, "m") == -1) // Item "m": Invisibility (15 Seconds)
  640. {
  641. formatex(item, charsmax(item), "%s%L (%i %L) \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(InvisibilityPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_INVISIBILITY", get_pcvar_num(InvisibilityTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(InvisibilityPrice), symbol, get_user_limit(id, 12), itemlimit(12))
  642. menu_additem(customshop, item, "12", 0)
  643. }
  644.  
  645. if(contain(items, "n") == -1) // Item "n": Double Damage
  646. {
  647. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(DoubleDamagePrice)) ? "" : "\d", LANG_SERVER, "CSHOP_DDAMAGE", get_pcvar_num(DoubleDamagePrice), symbol, get_user_limit(id, 13), itemlimit(13))
  648. menu_additem(customshop, item, "13", 0)
  649. }
  650.  
  651. if(contain(items, "o") == -1) // Item "o": GodMode (5 Seconds)
  652. {
  653. formatex(item, charsmax(item), "%s%L (%i %L) \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(GodModePrice)) ? "" : "\d", LANG_SERVER, "CSHOP_GODMODE", get_pcvar_num(GodModeTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(InvisibilityPrice), symbol, get_user_limit(id, 14), itemlimit(14))
  654. menu_additem(customshop, item, "14", 0)
  655. }
  656.  
  657. if(contain(items, "p") == -1) // Item "p": Health Regeneration
  658. {
  659. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(HealthRegenPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_HEALTHREGEN", get_pcvar_num(HealthRegenPrice), symbol, get_user_limit(id, 15), itemlimit(15))
  660. menu_additem(customshop, item, "15", 0)
  661. }
  662.  
  663. if(contain(items, "q") == -1) // Item "q": Armor Regeneration
  664. {
  665. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(ArmorRegenPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_ARMORREGEN", get_pcvar_num(ArmorRegenPrice), symbol, get_user_limit(id, 16), itemlimit(16))
  666. menu_additem(customshop, item, "16", 0)
  667. }
  668.  
  669. if(contain(items, "r") == -1) // Item "r": No Recoil
  670. {
  671. formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(NoRecoilPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_NORECOIL", get_pcvar_num(NoRecoilPrice), symbol, get_user_limit(id, 17), itemlimit(17))
  672. menu_additem(customshop, item, "17", 0)
  673. }
  674.  
  675. formatex(close, charsmax(close), "%L", LANG_SERVER, "CSHOP_EXIT")
  676. formatex(back, charsmax(back), "%L", LANG_SERVER, "CSHOP_BACK")
  677. formatex(next, charsmax(next), "%L", LANG_SERVER, "CSHOP_NEXT")
  678.  
  679. menu_setprop(customshop, MPROP_EXITNAME, close)
  680. menu_setprop(customshop, MPROP_BACKNAME, back)
  681. menu_setprop(customshop, MPROP_NEXTNAME, next)
  682.  
  683. menu_display(id, customshop, 0)
  684. return PLUGIN_HANDLED
  685. }
  686.  
  687. public cshop_handler(id, customshop, item)
  688. {
  689. if(!is_user_alive(id) || item == MENU_EXIT)
  690. {
  691. menu_destroy(customshop)
  692. return PLUGIN_HANDLED
  693. }
  694.  
  695. new data[6], iName[64], access, callback
  696. menu_item_getinfo(customshop, item, access, data, charsmax(data), iName, charsmax(iName), callback)
  697.  
  698. new key = str_to_num(data)
  699.  
  700. check_cvars(key)
  701. buy_item(id, key, cvar, g_itemLanguage[key])
  702.  
  703. menu_destroy(customshop)
  704. return PLUGIN_HANDLED
  705. }
  706.  
  707. stock buy_item(id, item, price, const msg[])
  708. {
  709. if(get_user_limit(id, item) == itemlimit(item))
  710. {
  711. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_LIMITREACHED", itemlimit(item))
  712. client_cmd(id, "spk %s", sNo)
  713. return
  714. }
  715.  
  716. new amount = (use_points) ? points[id] : cs_get_user_money(id)
  717.  
  718. new text[50]
  719. formatex(text, charsmax(text), "%s", msg)
  720.  
  721. new symbol[20]
  722. get_pcvar_string(CurrencySymbol, symbol, charsmax(symbol))
  723.  
  724. if(amount >= price)
  725. {
  726. if(item == 2 || item == 3)
  727. {
  728. buy_unlimited(id, item, price, text, symbol)
  729. return
  730. }
  731. else
  732. {
  733. switch(item)
  734. {
  735. case 0: set_user_health(id, get_user_health(id) + get_pcvar_num(HealthAmount))
  736. case 1: set_user_armor(id, get_user_armor(id) + get_pcvar_num(ArmorAmount))
  737. case 4:
  738. {
  739. give_item(id, "weapon_hegrenade")
  740. give_item(id, "weapon_flashbang")
  741. give_item(id, "weapon_flashbang")
  742. give_item(id, "weapon_smokegrenade")
  743. }
  744. case 5:
  745. {
  746. give_item(id, "weapon_hegrenade")
  747. cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(BomberAmount))
  748. }
  749. case 6: set_user_footsteps(id, 1)
  750. case 7:
  751. {
  752. cshop_speed[id] = true
  753. set_user_maxspeed(id, get_pcvar_float(FasterSpeedAmount))
  754. }
  755. case 8: set_user_gravity(id, get_pcvar_float(LowGravityAmount))
  756. case 9:
  757. {
  758. switch(get_user_team(id))
  759. {
  760. case 1: cs_set_user_model(id, g_playerModels[random_num(4, 7)])
  761. case 2: cs_set_user_model(id, g_playerModels[random_num(0, 3)])
  762. }
  763. }
  764. case 10:
  765. {
  766. set_user_health(id, get_pcvar_num(DrugsHealthAmount))
  767. set_user_maxspeed(id, get_pcvar_float(DrugsSpeedAmount))
  768. drug_player(id)
  769. }
  770. case 11: set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(TransparencyAmount))
  771. case 12:
  772. {
  773. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
  774. set_task(get_pcvar_float(InvisibilityTime), "NoMoreInvis", id)
  775. }
  776. case 13: cshop_ddamage[id] = true
  777. case 14:
  778. {
  779. set_user_godmode(id, 1)
  780. set_task(get_pcvar_float(GodModeTime), "NoMoreGod", id)
  781. }
  782. case 15:
  783. {
  784. cshop_healthregen[id] = true
  785. set_task(get_pcvar_float(HealthRegenTime), "healthRegenTicker", id, "", 0, "b", 0)
  786. }
  787. case 16:
  788. {
  789. cshop_armorregen[id] = true
  790. set_task(get_pcvar_float(ArmorRegenTime), "armorRegenTicker", id, "", 0, "b", 0)
  791. }
  792. case 17: cshop_norecoil[id] = true
  793. }
  794. }
  795.  
  796. set_user_limit(id, item, get_user_limit(id, item) + 1)
  797. player_charge(id, price)
  798. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, msg, price, symbol)
  799. emit_sound(id, CHAN_ITEM, g_itemSounds[item], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  800. }
  801. else notenough(id)
  802. }
  803.  
  804. public check_cvars(item)
  805. {
  806. switch(item)
  807. {
  808. case 0: cvar = get_pcvar_num(HealthPrice)
  809. case 1: cvar = get_pcvar_num(ArmorPrice)
  810. case 2: cvar = get_pcvar_num(UnlimitedClipPrice)
  811. case 3: cvar = get_pcvar_num(UnlimitedAmmoPrice)
  812. case 4: cvar = get_pcvar_num(AllGrenadesPrice)
  813. case 5: cvar = get_pcvar_num(BomberPrice)
  814. case 6: cvar = get_pcvar_num(SilentFootstepsPrice)
  815. case 7: cvar = get_pcvar_num(FasterSpeedPrice)
  816. case 8: cvar = get_pcvar_num(LowGravityPrice)
  817. case 9: cvar = get_pcvar_num(ChameleonPrice)
  818. case 10: cvar = get_pcvar_num(DrugsPrice)
  819. case 11: cvar = get_pcvar_num(TransparencyPrice)
  820. case 12: cvar = get_pcvar_num(InvisibilityPrice)
  821. case 13: cvar = get_pcvar_num(DoubleDamagePrice)
  822. case 14: cvar = get_pcvar_num(GodModePrice)
  823. case 15: cvar = get_pcvar_num(HealthRegenPrice)
  824. case 16: cvar = get_pcvar_num(ArmorRegenPrice)
  825. case 17: cvar = get_pcvar_num(NoRecoilPrice)
  826. }
  827. }
  828.  
  829. stock buy_unlimited(id, item, price, msg[], symbol[20])
  830. {
  831. if(weapon[id] == CSW_KNIFE || weapon[id] == CSW_HEGRENADE || weapon[id] == CSW_FLASHBANG || weapon[id] == CSW_SMOKEGRENADE || weapon[id] == CSW_C4)
  832. {
  833. cantactivateitem(id, item)
  834. return
  835. }
  836. else switch(item)
  837. {
  838. case 2:
  839. {
  840. cs_set_weapon_ammo(get_pdata_cbase(id, m_pActiveItem), 97280)
  841. cs_set_user_bpammo(id, weapon[id], 0)
  842. }
  843. case 3: cs_set_user_bpammo(id, weapon[id], 99999)
  844. }
  845.  
  846. set_user_limit(id, item, get_user_limit(id, item) + 1)
  847. player_charge(id, price)
  848. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, msg, price, symbol)
  849. emit_sound(id, CHAN_ITEM, g_itemSounds[item], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  850. }
  851.  
  852. stock itemlimit(item)
  853. {
  854. new limit
  855.  
  856. switch(item)
  857. {
  858. case 0: limit = get_pcvar_num(HealthLimit)
  859. case 1: limit = get_pcvar_num(ArmorLimit)
  860. case 2: limit = get_pcvar_num(UnlimitedClipLimit)
  861. case 3: limit = get_pcvar_num(UnlimitedAmmoLimit)
  862. case 4: limit = get_pcvar_num(AllGrenadesLimit)
  863. case 5: limit = get_pcvar_num(BomberLimit)
  864. case 6: limit = get_pcvar_num(SilentFootstepsLimit)
  865. case 7: limit = get_pcvar_num(FasterSpeedLimit)
  866. case 8: limit = get_pcvar_num(LowGravityLimit)
  867. case 9: limit = get_pcvar_num(ChameleonLimit)
  868. case 10: limit = get_pcvar_num(DrugsLimit)
  869. case 11: limit = get_pcvar_num(TransparencyLimit)
  870. case 12: limit = get_pcvar_num(InvisibilityLimit)
  871. case 13: limit = get_pcvar_num(DoubleDamageLimit)
  872. case 14: limit = get_pcvar_num(GodModeLimit)
  873. case 15: limit = get_pcvar_num(HealthRegenLimit)
  874. case 16: limit = get_pcvar_num(ArmorRegenLimit)
  875. case 17: limit = get_pcvar_num(NoRecoilLimit)
  876. }
  877.  
  878. return limit
  879. }
  880.  
  881. stock set_user_limit(id, item, limit)
  882. userlimit[id][item] = limit
  883.  
  884. stock get_user_limit(id, item)
  885. return userlimit[id][item]
  886.  
  887. stock notenough(id)
  888. {
  889. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOTENOUGH", LANG_SERVER, use_points ? "CSHOP_POINTS_SMALL" : "CSHOP_MONEY_SMALL")
  890. client_cmd(id, "spk %s", sNo)
  891. }
  892.  
  893. stock cantactivateitem(id, item)
  894. {
  895. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_CANNOT_ACTIVATE", LANG_SERVER, (item == 2) ? "CSHOP_UNLCLIP" : "CSHOP_UNLAMMO")
  896. client_cmd(id, "spk %s", sNo)
  897. }
  898.  
  899. public NoMoreInvis(id)
  900. {
  901. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)
  902. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOMOREINVIS")
  903. client_cmd(id, "spk %s", sOver)
  904. }
  905.  
  906. public NoMoreGod(id)
  907. {
  908. if(is_user_alive(id)) set_user_godmode(id, 0)
  909. ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOMOREGOD")
  910. client_cmd(id, "spk %s", sOver)
  911. }
  912.  
  913. public player_damage(victim, inflictor, attacker, Float:damage, damage_bits)
  914. {
  915. if(is_user_alive(attacker) && cshop_ddamage[attacker] && attacker != victim)
  916. SetHamParamFloat(4, damage * 2)
  917. }
  918.  
  919. public player_prethink(id)
  920. {
  921. if(!is_user_alive(id) || !cshop_norecoil[id])
  922. return
  923.  
  924. set_pev(id, pev_punchangle, {0.0, 0.0, 0.0})
  925. }
  926.  
  927. stock player_charge(id, price)
  928. {
  929. if(use_points) points[id] -= price
  930. else cs_set_user_money(id, cs_get_user_money(id) - price)
  931. }
  932.  
  933. stock drug_player(id)
  934. {
  935. message_begin(MSG_ONE, gmsg_SetFOV, {0, 0, 0}, id)
  936. write_byte(180)
  937. message_end()
  938. }
  939.  
  940. public player_killed()
  941. {
  942. new attacker = read_data(1)
  943. new victim = read_data(2)
  944.  
  945. if(!use_points || !is_user_connected(attacker) || !is_user_connected(victim) || attacker == victim)
  946. return HAM_IGNORED
  947.  
  948. new headshot = read_data(3)
  949.  
  950. new wep[32]
  951. read_data(4, wep, 31)
  952.  
  953. new team_attacker = get_user_team(attacker)
  954. new team_victim = get_user_team(victim)
  955.  
  956. if(team_attacker == team_victim)
  957. {
  958. if(get_pcvar_num(TeamKillPoints) == 0)
  959. return HAM_IGNORED
  960. }
  961.  
  962. new reward
  963.  
  964. if(equali(wep, "knife")) reward = get_pcvar_num(KnifeReward)
  965. else if(headshot) reward = get_pcvar_num(HeadshotReward)
  966. else reward = get_pcvar_num(NormalReward)
  967.  
  968. points[attacker] += reward
  969.  
  970. if(get_pcvar_num(KillMessage) == 1)
  971. {
  972. new name_victim[32]
  973. get_user_name(victim, name_victim, 31)
  974.  
  975. ColorChat(attacker, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_KILL", reward, name_victim)
  976. }
  977.  
  978. return HAM_IGNORED
  979. }
  980.  
  981. public healthRegenTicker(id)
  982. {
  983. if(!is_user_alive(id) || !cshop_healthregen[id]) remove_task(id)
  984.  
  985. new health = get_user_health(id)
  986. new healthamount = get_pcvar_num(HealthRegenAmount)
  987. new healthmax = get_pcvar_num(HealthRegenMax)
  988.  
  989. if(cshop_healthregen[id] && is_user_alive(id))
  990. {
  991. if(health < healthmax)
  992. {
  993. if(health + healthamount > healthmax) set_user_health(id, healthmax)
  994. else set_user_health(id, health + healthamount)
  995. }
  996. }
  997. }
  998.  
  999. public armorRegenTicker(id)
  1000. {
  1001. if(!is_user_alive(id) || !cshop_armorregen[id]) remove_task(id)
  1002.  
  1003. new armor = get_user_armor(id)
  1004. new armoramount = get_pcvar_num(ArmorRegenAmount)
  1005. new armormax = get_pcvar_num(ArmorRegenMax)
  1006.  
  1007. if(cshop_armorregen[id] && is_user_alive(id))
  1008. {
  1009. if(armor < armormax)
  1010. {
  1011. if(armor + armoramount > armormax) set_user_armor(id, armormax)
  1012. else set_user_armor(id, armor + armoramount)
  1013. }
  1014. }
  1015. }
  1016.  
  1017. public plugin_precache()
  1018. {
  1019. for(new i = 0; i < sizeof g_itemSounds; i++)
  1020. precache_sound(g_itemSounds[i])
  1021. }
  1022.  
  1023. /* ======================================================================================================= */
  1024. /* ColorChat */
  1025. /* ======================================================================================================= */
  1026. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  1027. {
  1028. if( !get_playersnum() ) return;
  1029.  
  1030. new message[256];
  1031.  
  1032. switch(type)
  1033. {
  1034. case NORMAL: // clients scr_concolor cvar color
  1035. {
  1036. message[0] = 0x01;
  1037. }
  1038. case GREEN: // Green
  1039. {
  1040. message[0] = 0x04;
  1041. }
  1042. default: // White, Red, Blue
  1043. {
  1044. message[0] = 0x03;
  1045. }
  1046. }
  1047.  
  1048. vformat(message[1], 251, msg, 4);
  1049.  
  1050. replace_all(message, 191, "!n", "^x01")
  1051. replace_all(message, 191, "!t", "^x03")
  1052. replace_all(message, 191, "!g", "^x04")
  1053.  
  1054. // Make sure message is not longer than 192 character. Will crash the server.
  1055. message[192] = '^0';
  1056.  
  1057. new team, ColorChange, index, MSG_Type;
  1058.  
  1059. if(id)
  1060. {
  1061. MSG_Type = MSG_ONE;
  1062. index = id;
  1063. } else {
  1064. index = FindPlayer();
  1065. MSG_Type = MSG_ALL;
  1066. }
  1067.  
  1068. team = get_user_team(index);
  1069. ColorChange = ColorSelection(index, MSG_Type, type);
  1070.  
  1071. ShowColorMessage(index, MSG_Type, message);
  1072.  
  1073. if(ColorChange)
  1074. {
  1075. Team_Info(index, MSG_Type, TeamName[team]);
  1076. }
  1077. }
  1078.  
  1079. ShowColorMessage(id, type, message[])
  1080. {
  1081. static bool:saytext_used;
  1082. static get_user_msgid_saytext;
  1083. if(!saytext_used)
  1084. {
  1085. get_user_msgid_saytext = get_user_msgid("SayText");
  1086. saytext_used = true;
  1087. }
  1088. message_begin(type, get_user_msgid_saytext, _, id);
  1089. write_byte(id)
  1090. write_string(message);
  1091. message_end();
  1092. }
  1093.  
  1094. Team_Info(id, type, team[])
  1095. {
  1096. static bool:teaminfo_used;
  1097. static get_user_msgid_teaminfo;
  1098. if(!teaminfo_used)
  1099. {
  1100. get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
  1101. teaminfo_used = true;
  1102. }
  1103. message_begin(type, get_user_msgid_teaminfo, _, id);
  1104. write_byte(id);
  1105. write_string(team);
  1106. message_end();
  1107.  
  1108. return 1;
  1109. }
  1110.  
  1111. ColorSelection(index, type, Color:Type)
  1112. {
  1113. switch(Type)
  1114. {
  1115. case RED:
  1116. {
  1117. return Team_Info(index, type, TeamName[1]);
  1118. }
  1119. case BLUE:
  1120. {
  1121. return Team_Info(index, type, TeamName[2]);
  1122. }
  1123. case GREY:
  1124. {
  1125. return Team_Info(index, type, TeamName[0]);
  1126. }
  1127. }
  1128.  
  1129. return 0;
  1130. }
  1131.  
  1132. FindPlayer()
  1133. {
  1134. new i = -1;
  1135.  
  1136. while(i <= get_maxplayers())
  1137. {
  1138. if(is_user_connected(++i))
  1139. return i;
  1140. }
  1141.  
  1142. return -1;
  1143. }