HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. ChangeLog:
  3.  
  4. v1.0
  5. - First Release
  6.  
  7. v1.5
  8. - Converted some things to fakemeta
  9. - Fixed some menus
  10.  
  11. v2.0
  12. - Added more menus
  13. - Added more stocks
  14.  
  15. v3.0
  16. - Fixed Menu bugs
  17. - Fixed Model reset
  18. - Added new Cvars
  19. - Added ML Support
  20.  
  21. v3.5
  22. - Added cstrike module for the skins
  23. - Added customizable cfg with cvars
  24.  
  25. v3.6
  26. - Fixed rendering bug with the invisibility menu
  27.  
  28. v3.7
  29. - Fixed some fakemeta & cstrike convertions
  30.  
  31. v3.8
  32. - Added ML Translations
  33.  
  34. v4.0
  35. - Replaced all with fakemeta and ham modules
  36. - Fixed a ML Bug
  37. - Fixed some stocks (thanks to Exolent)
  38.  
  39. v4.0a
  40. - Added: is the user alive to open the menu ?
  41. - is the plugin enabled to show the msg ?
  42.  
  43. v4.0b
  44. - Changed: Ham_Spawn to Post hook (Thanks ConnorMcLeod)
  45.  
  46. v4.2
  47. - Now the Fakemeta Utilities are included
  48. - Removed the Fakemeta Utilities stocks
  49. - Added one more menu (Speed menu)
  50. - Added more cvars
  51. - Updated Multi-Lingual Translations
  52.  
  53. v4.5
  54. - The items can be disabled if you set the item cvar to 0
  55. - Now plugin supports Unlimited Money by Ramono
  56. - Huge update on the Multi-Lingual translations (sorry translators)
  57.  
  58. v5.0
  59. - All Menus Updated using global variables to store the name-weapons-other data
  60. - CStrike and Fun Modules restored (efficiency > fakemeta conversions)
  61.  
  62. ------------------------------------------------------------------------
  63.  
  64. Cvar List:
  65.  
  66. // Main Cvars
  67. amx_shop_enable 1/0 - Enable / Disable CS Shop (Default: 1)
  68. amx_shop_msg 1/0 - Enable / Disable CS Shop Message (Default: 1)
  69. amx_shop_prefix - CS Shop Messages Prefix (Default: [CS Shop])
  70.  
  71. // CT's Guns Menu
  72. amx_shop_ct 1/0 - Enable / Disable CT's Guns Menu (Default: 1)
  73. amx_shop_m4a1 - M4A1 Cost (Default: 3100)
  74. amx_shop_bullpup - BullPup Cost (Default: 3500)
  75. amx_shop_tmp - TMP Cost (Default: 1250)
  76. amx_shop_fiveseven - Five Seven Cost (Default: 750)
  77. amx_shop_famas - Famas Cost (Default: 2250)
  78. amx_shop_shield - Shield Cost (Default: 2200)
  79.  
  80. // T's Guns Menu
  81. amx_shop_t 1/0 - Enable / Disable T's Guns Menu (Default: 1)
  82. amx_shop_ak47 - Ak 47 Cost (Default: 2500)
  83. amx_shop_sg552 - Sg552 Cost (Default: 3500)
  84. amx_shop_mac10 - Mac 10 Cost (Default: 1400)
  85. amx_shop_elites - Dual Elites Cost (Default: 800)
  86. amx_shop_galil - Galil Cost (Default: 2000)
  87.  
  88. // Invisibility Menu
  89. amx_shop_invis 1/0 - Enable / Disable Invisibility Menu (Default: 1)
  90. amx_shop_low - Low Invisibility Cost (still visible) (Default: 3000)
  91. amx_shop_medium - Medium Invisibility Cost (semiclip) (Default: 6000)
  92. amx_shop_high - High Invisibility Cost (almost invisible) (Default: 12000)
  93.  
  94. // Gravity Menu
  95. amx_shop_grav 1/0 - Enable / Disable Gravity Menu (Default: 1)
  96. amx_shop_g500 - 500 Gravity Cost (Default: 1500)
  97. amx_shop_g400 - 400 Gravity Cost (Default: 3000)
  98. amx_shop_g300 - 300 Gravity Cost (Default: 4500)
  99. amx_shop_g200 - 200 Gravity Cost (Default: 6000)
  100.  
  101. // Health Menu
  102. amx_shop_hp 1/0 - Enable / Disable Health Menu (Default: 1)
  103. amx_shop_15hp - +15 Health Cost (Default: 1500)
  104. amx_shop_35hp - +35 Health Cost (Default: 3000)
  105. amx_shop_65hp - +65 Health Cost (Default: 6000)
  106. amx_shop_95hp - +95 Health Cost (Default: 7500)
  107.  
  108. // Speed Menu
  109. amx_shop_speed 1/0 - Enable / Disable Speed Menu (Default: 1)
  110. amx_shop_260speed - 260 MaxSpeed Cost (Default: 3000)
  111. amx_shop_300speed - 300 MaxSpeed Cost (Default: 6000)
  112. amx_shop_340speed - 340 MaxSpeed Cost (Default: 9000)
  113. amx_shop_380speed - 380 MaxSpeed Cost (Default: 12000)
  114. amx_shop_420speed - 420 MaxSpeed Cost (Default: 15000)
  115.  
  116. // Skins Menu
  117. amx_shop_skins 1/0 - Enable / Disable Skins Menu (Default: 1)
  118. amx_shop_tskin - Terrorist Skin Cost (Default: 9000)
  119. amx_shop_ctskin - Counter-Terrorist Skin Cost (Default: 9000)
  120.  
  121. ---------------------------------------------------------------------
  122.  
  123. Credits:
  124.  
  125. PvtSmithFSSF - Original idea, Principal Code
  126. VEN - Fakemeta Utilities
  127. Dr. Jan Itor - Gravity Menu help
  128. Minimiller - Lot of things
  129. MeRcyLeZZ - For his svc_bad and models tutorial (Tutorial Link)
  130. ConnorMcLeod - Little fix with user spawn ^.^
  131. XxAvalanchexX - Some code of the gungame colored print
  132.  
  133. ---------------------------------------------------------------------
  134.  
  135. Plugin Thread: http://forums.alliedmods.net/showthread.php?t=78224
  136. Licensed under the GPL - http://www.gnu.org/copyleft/gpl.html
  137.  
  138. ---------------------------------------------------------------------
  139. */
  140.  
  141. // Uncomment this to enable Unlimited Money support by Ramono
  142. //#define UL_COMPAT
  143.  
  144. #include <amxmodx>
  145. #include <cstrike>
  146. #include <fakemeta>
  147. #include <hamsandwich>
  148. #include <fun>
  149.  
  150. #if defined UL_COMPAT
  151. #include <money_ul>
  152. #endif
  153.  
  154. /*================================================================================
  155.  [Defines & Variables]
  156. =================================================================================*/
  157.  
  158. // Plugin Info
  159. #define PLUGIN_NAME "CS Shop"
  160. #define PLUGIN_VERS "5.0"
  161. #define PLUGIN_AUTH "iNeedHelp" // Old Name :(
  162.  
  163. // Weapons BitSum (drop stocks)
  164. #define PRIMARY_WEAPONS_BITSUM ((1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90))
  165.  
  166. // Max Players
  167. #define MAX_PLAYERS 32
  168.  
  169. // Compatibility with Unlimited Money
  170. #if defined UL_COMPAT
  171. #define get_user_money(%1) cs_get_user_money_ul(%1)
  172. #define set_user_money(%1,%2) cs_set_user_money_ul(%1,%2)
  173. #else
  174. #define set_user_money(%1,%2) cs_set_user_money(%1,%2)
  175. #define get_user_money(%1) cs_get_user_money(%1)
  176. #endif
  177.  
  178. // Pointers
  179. new g_pGravityCvarPointer
  180.  
  181. // Main Cvars
  182. new g_pCvarEnable
  183. new g_pCvarMessage
  184. new g_pCvarPrefix
  185.  
  186. // Menu Cvars
  187. new g_pMenuEnableCvars[7]
  188.  
  189. new g_pCtGunsMenuCvars[6]
  190. new g_pTeGunsMenuCvars[5]
  191.  
  192. new g_pInvisibilityMenuCvars[3]
  193. new g_pGravityMenuCvars[4]
  194. new g_pHealthMenuCvars[4]
  195. new g_pSpeedMenuCvars[5]
  196. new g_pSkinsMenuCvars[2]
  197.  
  198. // Menu vars
  199. new g_iHasSpeed[MAX_PLAYERS+1] = { -1, ... }
  200. new bool:g_bHasCustomModel[MAX_PLAYERS+1] = { false, ... }
  201.  
  202. // Menus Items
  203. new g_szMainShopMenu[][] =
  204. {
  205. "CT Fegyver",
  206. "T Fegyver",
  207. "Láthatatlanság Menü",
  208. "Gravitáció Menü",
  209. "Élet Menü",
  210. "Sebesség Menü",
  211. "Skin Menü"
  212. }
  213.  
  214. new g_szCTGunsMenu[][] =
  215. {
  216. "M4A1",
  217. "Bullpup",
  218. "TMP",
  219. "Five Seven",
  220. "Famas",
  221. "Pajzs"
  222. }
  223.  
  224. new g_szTGunsMenu[][] =
  225. {
  226. "AK47",
  227. "Krieg 552",
  228. "Mac10",
  229. "Dual Elites",
  230. "Galil"
  231. }
  232.  
  233. new g_szInvisibilityMenu[][] =
  234. {
  235. "Alacsony láthatatlanság",
  236. "Közepes láthatatlanság",
  237. "Magas láthatatlanság"
  238. }
  239.  
  240. new g_szGravityMenu[][] =
  241. {
  242. "500 Gravitáció",
  243. "400 Gravitáció",
  244. "300 Gravitáció",
  245. "200 Gravitáció"
  246. }
  247.  
  248. new g_szHealthMenu[][] =
  249. {
  250. "+15 HP",
  251. "+35 HP",
  252. "+65 HP",
  253. "+95 HP"
  254. }
  255.  
  256. new g_szSpeedMenu[][] =
  257. {
  258. "260 Sebesség",
  259. "300 Sebesség",
  260. "340 Sebesség",
  261. "380 Sebesség",
  262. "420 Sebesség"
  263. }
  264.  
  265. new g_szSkinsMenu[][] =
  266. {
  267. "Terrorista Skin",
  268. "Counter-Terrorista Skin"
  269. }
  270.  
  271. // Menus Data
  272. new g_szCTGunsWeapons[][] =
  273. {
  274. "weapon_m4a1",
  275. "weapon_aug",
  276. "weapon_tmp",
  277. "weapon_fiveseven",
  278. "weapon_famas",
  279. "weapon_shield"
  280. }
  281.  
  282. new g_szTGunsWeapons[][] =
  283. {
  284. "weapon_ak47",
  285. "weapon_sg552",
  286. "weapon_mac10",
  287. "weapon_elite",
  288. "weapon_galil"
  289. }
  290.  
  291. new g_szCTGunsAmmo[][] = { "556nato", "556nato", "9mm", "57mm", "556nato" }
  292. new g_szTGunsAmmo[][] = { "762nato", "556nato", "45acp", "9mm", "556nato" }
  293.  
  294. new g_iCTGunsLoad[] = { 90, 90, 120, 100, 90 }
  295. new g_iTGunsLoad[] = { 90, 90, 100, 120, 90 }
  296.  
  297. new g_iCTGunsMaxAmmo[] = { 90, 90, 120, 100, 90 }
  298. new g_iTGunsMaxAmmo[] = { 90, 90, 100, 120, 90 }
  299.  
  300. new g_iInvisibilityLevel[] = { 150, 100, 25 }
  301. new g_iHealthLevel[] = { 15, 35, 65, 95 }
  302.  
  303. new Float:g_flGravityLevel[] = { 500.0, 400.0, 300.0, 200.0 }
  304. new Float:g_flSpeedLevel[] = { 260.0, 300.0, 340.0, 380.0, 420.0 }
  305.  
  306. new g_szSkinsName[][] = { "gign", "leet" }
  307.  
  308. // Message Hooks
  309. new g_iMsgSayText
  310.  
  311. // Others
  312. new const g_szShopFile[] = "shop.cfg"; // Shop file
  313.  
  314. /*================================================================================
  315.  [Init]
  316. =================================================================================*/
  317.  
  318. public plugin_init()
  319. {
  320. register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
  321.  
  322. // Multi-Lingual
  323. register_dictionary("shop.txt")
  324.  
  325. // Commands
  326. register_clcmd("say /shop", "ClCmd_Say")
  327. register_clcmd("say_team /shop", "ClCmd_Say")
  328.  
  329. // Ham Forwards
  330. RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
  331.  
  332. // FM Forwards
  333. register_forward(FM_SetClientKeyValue, "Fwd_SetClientKeyValue")
  334.  
  335. // Events
  336. register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  337.  
  338. // Variables....
  339.  
  340. // Messages Hooks
  341. g_iMsgSayText = get_user_msgid("SayText")
  342.  
  343. // Cvars
  344. g_pGravityCvarPointer = get_cvar_pointer("sv_gravity")
  345.  
  346. g_pCvarEnable = register_cvar("amx_shop_enable", "1")
  347. g_pCvarMessage = register_cvar("amx_shop_msg", "1")
  348. g_pCvarPrefix = register_cvar("amx_shop_prefix", "[CS Shop]")
  349.  
  350. g_pMenuEnableCvars[0] = register_cvar("amx_shop_ct", "1")
  351. g_pCtGunsMenuCvars[0] = register_cvar("amx_shop_m4a1", "3100")
  352. g_pCtGunsMenuCvars[1] = register_cvar("amx_shop_bullpup", "3500")
  353. g_pCtGunsMenuCvars[2] = register_cvar("amx_shop_tmp", "1250")
  354. g_pCtGunsMenuCvars[3] = register_cvar("amx_shop_fiveseven", "750")
  355. g_pCtGunsMenuCvars[4] = register_cvar("amx_shop_famas", "2250")
  356. g_pCtGunsMenuCvars[5] = register_cvar("amx_shop_shield", "2200")
  357.  
  358. g_pMenuEnableCvars[1] = register_cvar("amx_shop_t", "1")
  359. g_pTeGunsMenuCvars[0] = register_cvar("amx_shop_ak47", "2500")
  360. g_pTeGunsMenuCvars[1] = register_cvar("amx_shop_sg552", "3500")
  361. g_pTeGunsMenuCvars[2] = register_cvar("amx_shop_mac10", "1400")
  362. g_pTeGunsMenuCvars[3] = register_cvar("amx_shop_elites", "800")
  363. g_pTeGunsMenuCvars[4] = register_cvar("amx_shop_galil", "2000")
  364.  
  365. g_pMenuEnableCvars[2] = register_cvar("amx_shop_invis", "1")
  366. g_pInvisibilityMenuCvars[0] = register_cvar("amx_shop_low", "3000")
  367. g_pInvisibilityMenuCvars[1] = register_cvar("amx_shop_medium", "6000")
  368. g_pInvisibilityMenuCvars[2] = register_cvar("amx_shop_high", "12000")
  369.  
  370. g_pMenuEnableCvars[3] = register_cvar("amx_shop_grav", "1")
  371. g_pGravityMenuCvars[0] = register_cvar("amx_shop_g500", "1500")
  372. g_pGravityMenuCvars[1] = register_cvar("amx_shop_g400", "3000")
  373. g_pGravityMenuCvars[2] = register_cvar("amx_shop_g300", "4500")
  374. g_pGravityMenuCvars[3] = register_cvar("amx_shop_g200", "6000")
  375.  
  376. g_pMenuEnableCvars[4] = register_cvar("amx_shop_hp", "1")
  377. g_pHealthMenuCvars[0] = register_cvar("amx_shop_15hp", "1500")
  378. g_pHealthMenuCvars[1] = register_cvar("amx_shop_35hp", "3000")
  379. g_pHealthMenuCvars[2] = register_cvar("amx_shop_65hp", "6000")
  380. g_pHealthMenuCvars[3] = register_cvar("amx_shop_95hp", "7500")
  381.  
  382. g_pMenuEnableCvars[5] = register_cvar("amx_shop_speed", "1")
  383. g_pSpeedMenuCvars[0] = register_cvar("amx_shop_260speed", "3000")
  384. g_pSpeedMenuCvars[1] = register_cvar("amx_shop_300speed", "6000")
  385. g_pSpeedMenuCvars[2] = register_cvar("amx_shop_340speed", "9000")
  386. g_pSpeedMenuCvars[3] = register_cvar("amx_shop_380speed", "12000")
  387. g_pSpeedMenuCvars[4] = register_cvar("amx_shop_420speed", "15000")
  388.  
  389. g_pMenuEnableCvars[6] = register_cvar("amx_shop_skins", "1")
  390. g_pSkinsMenuCvars[0] = register_cvar("amx_shop_tskin", "9000")
  391. g_pSkinsMenuCvars[1] = register_cvar("amx_shop_ctskin", "9000")
  392. }
  393.  
  394. public plugin_precache()
  395. {
  396. new sModels[128]
  397.  
  398. for (new i = 0; i < sizeof(g_szSkinsName); i++)
  399. {
  400. format(sModels, sizeof(sModels)-1, "models/player/%s/%s.mdl", g_szSkinsName[i], g_szSkinsName[i])
  401. precache_model(sModels)
  402. }
  403. }
  404.  
  405. public plugin_cfg()
  406. {
  407. new ConfigsDir[64]
  408. get_localinfo("amxx_configsdir", ConfigsDir, charsmax(ConfigsDir))
  409. format(ConfigsDir, charsmax(ConfigsDir), "%s/%s", ConfigsDir, g_szShopFile)
  410.  
  411. if (!file_exists(ConfigsDir))
  412. {
  413. server_print("CS Shop fájl [%s] nem létezik!", ConfigsDir)
  414. return;
  415. }
  416. server_cmd("exec ^"%s^"", ConfigsDir)
  417. }
  418.  
  419. /*================================================================================
  420.  [Menus]
  421. =================================================================================*/
  422.  
  423. public ClCmd_Say(id)
  424. {
  425. if (!is_user_alive(id))
  426. {
  427. client_print_c(id, "%L", id, "SHOP_DEAD")
  428. return PLUGIN_HANDLED
  429. }
  430.  
  431. if (!get_pcvar_num(g_pCvarEnable))
  432. {
  433. client_print_c(id, "%L", id, "SHOP_DISABLED")
  434. return PLUGIN_HANDLED
  435. }
  436. Create_Menu(id)
  437. return PLUGIN_HANDLED
  438. }
  439.  
  440. Create_Menu(id)
  441. {
  442. new Menu = menu_create("\\rCS Shop Menü", "MainMenu_Handler")
  443. new Items[32], Position[3]
  444.  
  445. for (new i = 0; i < sizeof(g_szMainShopMenu); i++)
  446. {
  447. formatex(Items, charsmax(Items), "%s%s", get_pcvar_num(g_pMenuEnableCvars[i]) ? "\\w" : "\\d", g_szMainShopMenu[i])
  448. num_to_str(i, Position, charsmax(Position))
  449.  
  450. menu_additem(Menu, Items, Position)
  451. }
  452. menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL)
  453. menu_display(id, Menu, 0)
  454. }
  455.  
  456. public MainMenu_Handler(id, Menu, item)
  457. {
  458. if (item == MENU_EXIT)
  459. {
  460. menu_destroy(Menu)
  461. return PLUGIN_HANDLED
  462. }
  463.  
  464. new Data[6], Name[64];
  465. new Access, Callback;
  466. menu_item_getinfo(Menu, item, Access, Data, 5, Name, 63, Callback)
  467.  
  468. new Key = str_to_num(Data);
  469.  
  470. switch (Key)
  471. {
  472. case 0:
  473. {
  474. new Cts_Menu = menu_create("\\rCT Fegyver", "CtMenu_Handler")
  475. new Items[32], PriceString[32], Position[3]
  476.  
  477. for (new i = 0; i < sizeof(g_szCTGunsMenu); i++)
  478. {
  479. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pCtGunsMenuCvars[i]))
  480. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pCtGunsMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szCTGunsMenu[i], get_pcvar_num(g_pCtGunsMenuCvars[i]) > 0 ? PriceString : "")
  481.  
  482. num_to_str(i, Position, charsmax(Position))
  483.  
  484. menu_additem(Cts_Menu, Items, Position)
  485. }
  486.  
  487. menu_setprop(Cts_Menu, MPROP_EXIT, MEXIT_ALL)
  488.  
  489. if (!get_pcvar_num(g_pMenuEnableCvars[0]))
  490. {
  491. client_print_c(id, "%L", id, "SHOP_CT_OFF")
  492. return PLUGIN_HANDLED;
  493. }
  494. else
  495. menu_display(id, Cts_Menu, 0)
  496. }
  497.  
  498. case 1:
  499. {
  500. new Ts_Menu = menu_create("\\rT Fegyver", "TeMenu_Handler")
  501. new Items[32], PriceString[32], Position[3]
  502.  
  503. for (new i = 0; i < sizeof(g_szTGunsMenu); i++)
  504. {
  505. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pTeGunsMenuCvars[i]))
  506. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pTeGunsMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szTGunsMenu[i], get_pcvar_num(g_pTeGunsMenuCvars[i]) > 0 ? PriceString : "")
  507.  
  508. num_to_str(i, Position, charsmax(Position))
  509.  
  510. menu_additem(Ts_Menu, Items, Position)
  511. }
  512.  
  513. menu_setprop(Ts_Menu, MPROP_EXIT, MEXIT_ALL)
  514.  
  515. if (!get_pcvar_num(g_pMenuEnableCvars[1]))
  516. {
  517. client_print_c(id, "%L", id, "SHOP_T_OFF")
  518. return PLUGIN_HANDLED
  519. }
  520. else
  521. menu_display(id, Ts_Menu, 0)
  522.  
  523. }
  524.  
  525. case 2:
  526. {
  527. new Inv_Menu = menu_create("\\rLáthatatlanság Menü", "InvisibilityMenu_Handler")
  528. new Items[32], PriceString[32], Position[3]
  529.  
  530. for (new i = 0; i < sizeof(g_szInvisibilityMenu); i++)
  531. {
  532. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pInvisibilityMenuCvars[i]))
  533. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pInvisibilityMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szInvisibilityMenu[i], get_pcvar_num(g_pInvisibilityMenuCvars[i]) > 0 ? PriceString : "")
  534.  
  535. num_to_str(i, Position, charsmax(Position))
  536.  
  537. menu_additem(Inv_Menu, Items, Position)
  538. }
  539.  
  540. menu_setprop(Inv_Menu, MPROP_EXIT, MEXIT_ALL)
  541.  
  542. if (!get_pcvar_num(g_pMenuEnableCvars[2]))
  543. {
  544. client_print_c(id, "%L", id, "SHOP_INVIS_OFF")
  545. return PLUGIN_HANDLED
  546. }
  547. else
  548. menu_display(id, Inv_Menu, 0)
  549. }
  550.  
  551. case 3:
  552. {
  553. new Grav_Menu = menu_create("\\rGravitáció Menü", "GravityMenu_Handler")
  554. new Items[32], PriceString[32], Position[3]
  555.  
  556. for (new i = 0; i < sizeof(g_szGravityMenu); i++)
  557. {
  558. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pGravityMenuCvars[i]))
  559. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pGravityMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szGravityMenu[i], get_pcvar_num(g_pGravityMenuCvars[i]) > 0 ? PriceString : "")
  560.  
  561. num_to_str(i, Position, charsmax(Position))
  562.  
  563. menu_additem(Grav_Menu, Items, Position)
  564. }
  565.  
  566. menu_setprop(Grav_Menu, MPROP_EXIT, MEXIT_ALL)
  567.  
  568. if (!get_pcvar_num(g_pMenuEnableCvars[3]))
  569. {
  570. client_print_c(id, "%L", id, "SHOP_GRAV_OFF")
  571. return PLUGIN_HANDLED
  572. }
  573. else
  574. menu_display(id, Grav_Menu, 0)
  575. }
  576.  
  577. case 4:
  578. {
  579. new Hp_Menu = menu_create("\\rÉlet Menü", "HealthMenu_Handler")
  580. new Items[32], PriceString[32], Position[3]
  581.  
  582. for (new i = 0; i < sizeof(g_szHealthMenu); i++)
  583. {
  584. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pHealthMenuCvars[i]))
  585. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pHealthMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szHealthMenu[i], get_pcvar_num(g_pHealthMenuCvars[i]) > 0 ? PriceString : "")
  586.  
  587. num_to_str(i, Position, charsmax(Position))
  588.  
  589. menu_additem(Hp_Menu, Items, Position)
  590. }
  591.  
  592. menu_setprop(Hp_Menu, MPROP_EXIT, MEXIT_ALL)
  593.  
  594. if (!get_pcvar_num(g_pMenuEnableCvars[4]))
  595. {
  596. client_print_c(id, "%L", id, "SHOP_HEALTH_OFF")
  597. return PLUGIN_HANDLED
  598. }
  599. else
  600. menu_display(id, Hp_Menu, 0)
  601. }
  602.  
  603. case 5:
  604. {
  605. new Speed_Menu = menu_create("\\rSebesség Menü", "SpeedMenu_Handler")
  606. new Items[32], PriceString[32], Position[3]
  607.  
  608. for (new i = 0; i < sizeof(g_szSpeedMenu); i++)
  609. {
  610. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pSpeedMenuCvars[i]))
  611. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pSpeedMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szSpeedMenu[i], get_pcvar_num(g_pSpeedMenuCvars[i]) > 0 ? PriceString : "")
  612.  
  613. num_to_str(i, Position, charsmax(Position))
  614.  
  615. menu_additem(Speed_Menu, Items, Position)
  616. }
  617.  
  618. menu_setprop(Speed_Menu, MPROP_EXIT, MEXIT_ALL)
  619.  
  620. if (!get_pcvar_num(g_pMenuEnableCvars[5]))
  621. {
  622. client_print_c(id, "%L", id, "SHOP_SPEED_OFF")
  623. return PLUGIN_HANDLED
  624. }
  625. else
  626. menu_display(id, Speed_Menu, 0)
  627. }
  628.  
  629. case 6:
  630. {
  631. new Skins_Menu = menu_create("\\yKinézet Menü", "SkinsMenu_Handler")
  632. new Items[32], PriceString[32], Position[3]
  633.  
  634. for (new i = 0; i < sizeof(g_szSkinsMenu); i++)
  635. {
  636. formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pSkinsMenuCvars[i]))
  637. formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pSkinsMenuCvars[i]) > 0 ? "\\w" : "\\d", g_szSkinsMenu[i], get_pcvar_num(g_pSkinsMenuCvars[i]) > 0 ? PriceString : "")
  638.  
  639. num_to_str(i, Position, charsmax(Position))
  640.  
  641. menu_additem(Skins_Menu, Items, Position)
  642. }
  643.  
  644. menu_setprop(Skins_Menu, MPROP_EXIT, MEXIT_ALL)
  645.  
  646. if (!get_pcvar_num(g_pMenuEnableCvars[6]))
  647. {
  648. client_print_c(id, "%L", id, "SHOP_SKINS_OFF")
  649. return PLUGIN_HANDLED
  650. }
  651. else
  652. menu_display(id, Skins_Menu, 0)
  653. }
  654. }
  655. menu_destroy(Menu)
  656. return PLUGIN_HANDLED
  657. }
  658.  
  659. public CtMenu_Handler(id, Cts_Menu, item)
  660. {
  661. if (item == MENU_EXIT)
  662. {
  663. menu_destroy(Cts_Menu)
  664. return PLUGIN_HANDLED
  665. }
  666.  
  667. new Data[6], Name[64]
  668. new Access, Callback;
  669. menu_item_getinfo(Cts_Menu, item, Access, Data, 5, Name, 63, Callback)
  670.  
  671. new Key = str_to_num(Data)
  672.  
  673. new Money = get_user_money(id)
  674. new Pcvar = get_pcvar_num(g_pCtGunsMenuCvars[Key])
  675.  
  676. if (!Pcvar)
  677. {
  678. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  679. return PLUGIN_HANDLED
  680. }
  681.  
  682. if (Money < Pcvar)
  683. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  684. else
  685. {
  686. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szCTGunsMenu[Key])
  687.  
  688. set_user_money(id, Money-Pcvar)
  689.  
  690. if (equali(g_szCTGunsMenu[Key], "Five Seven"))
  691. secondary_wpn_drop(id)
  692. else
  693. primary_wpn_drop(id)
  694.  
  695. give_item(id, g_szCTGunsWeapons[Key])
  696.  
  697. if (!equali(g_szCTGunsMenu[Key], "Shield"))
  698. ExecuteHamB(Ham_GiveAmmo, id, g_iCTGunsLoad[Key], g_szCTGunsAmmo[Key], g_iCTGunsMaxAmmo[Key])
  699. }
  700. menu_destroy(Cts_Menu)
  701. return PLUGIN_HANDLED
  702. }
  703.  
  704. public TeMenu_Handler(id, Tts_Menu, item)
  705. {
  706. if (item == MENU_EXIT)
  707. {
  708. menu_destroy(Tts_Menu)
  709. return PLUGIN_HANDLED
  710. }
  711.  
  712. new Data[6], Name[64]
  713. new Access, Callback;
  714. menu_item_getinfo(Tts_Menu, item, Access, Data, 5, Name, 63, Callback)
  715.  
  716. new Key = str_to_num(Data)
  717.  
  718. new Money = get_user_money(id)
  719. new Pcvar = get_pcvar_num(g_pTeGunsMenuCvars[Key])
  720.  
  721. if (!Pcvar)
  722. {
  723. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  724. return PLUGIN_HANDLED
  725. }
  726.  
  727. if (Money < Pcvar)
  728. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  729. else
  730. {
  731. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szTGunsMenu[Key])
  732.  
  733. set_user_money(id, Money-Pcvar)
  734.  
  735. if (equali(g_szTGunsMenu[Key], "Dual Elites"))
  736. secondary_wpn_drop(id)
  737. else
  738. primary_wpn_drop(id)
  739.  
  740. give_item(id, g_szTGunsWeapons[Key])
  741. ExecuteHamB(Ham_GiveAmmo, id, g_iTGunsLoad[Key], g_szTGunsAmmo[Key], g_iTGunsMaxAmmo[Key])
  742. }
  743. menu_destroy(Tts_Menu)
  744. return PLUGIN_HANDLED
  745. }
  746.  
  747. public InvisibilityMenu_Handler(id, Inv_Menu, item)
  748. {
  749. if (item == MENU_EXIT)
  750. {
  751. menu_destroy(Inv_Menu)
  752. return PLUGIN_HANDLED
  753. }
  754.  
  755. new Data[6], Name[64]
  756. new Access, Callback;
  757. menu_item_getinfo(Inv_Menu, item, Access, Data, 5, Name, 63, Callback)
  758.  
  759. new Key = str_to_num(Data)
  760.  
  761. new Money = get_user_money(id)
  762. new Pcvar = get_pcvar_num(g_pInvisibilityMenuCvars[Key])
  763.  
  764. if (!Pcvar)
  765. {
  766. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  767. return PLUGIN_HANDLED
  768. }
  769.  
  770. if (Money < Pcvar)
  771. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  772. else
  773. {
  774. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szInvisibilityMenu[Key])
  775.  
  776. set_user_money(id, Money-Pcvar)
  777. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, g_iInvisibilityLevel[Key])
  778. }
  779. menu_destroy(Inv_Menu)
  780. return PLUGIN_HANDLED
  781. }
  782.  
  783. public GravityMenu_Handler(id, Grav_Menu, item)
  784. {
  785. if (item == MENU_EXIT)
  786. {
  787. menu_destroy(Grav_Menu)
  788. return PLUGIN_HANDLED
  789. }
  790.  
  791. new Data[6], Name[64]
  792. new Access, Callback;
  793. menu_item_getinfo(Grav_Menu, item, Access, Data, 5, Name, 63, Callback)
  794.  
  795. new Key = str_to_num(Data)
  796.  
  797. new Money = get_user_money(id)
  798. new Pcvar = get_pcvar_num(g_pGravityMenuCvars[Key])
  799.  
  800. if (!Pcvar)
  801. {
  802. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  803. return PLUGIN_HANDLED
  804. }
  805.  
  806. if (Money < Pcvar)
  807. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  808. else
  809. {
  810. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szGravityMenu[Key])
  811.  
  812. set_user_money(id, Money-Pcvar)
  813. set_user_gravity(id, (g_flGravityLevel[Key] / get_pcvar_float(g_pGravityCvarPointer)))
  814. }
  815. menu_destroy(Grav_Menu)
  816. return PLUGIN_HANDLED
  817. }
  818.  
  819. public HealthMenu_Handler(id, Hp_Menu, item)
  820. {
  821. if (item == MENU_EXIT)
  822. {
  823. menu_destroy(Hp_Menu)
  824. return PLUGIN_HANDLED
  825. }
  826.  
  827. new Data[6], Name[64]
  828. new Access, Callback
  829. menu_item_getinfo(Hp_Menu, item, Access, Data, 5, Name, 63, Callback)
  830.  
  831. new Key = str_to_num(Data)
  832.  
  833. new Money = get_user_money(id)
  834. new Pcvar = get_pcvar_num(g_pHealthMenuCvars[Key])
  835. new Health = get_user_health(id)
  836.  
  837. if (!Pcvar)
  838. {
  839. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  840. return PLUGIN_HANDLED
  841. }
  842.  
  843. if (Money < Pcvar)
  844. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  845. else
  846. {
  847. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szHealthMenu[Key])
  848.  
  849. set_user_money(id, Money-Pcvar)
  850. set_user_health(id, Health+g_iHealthLevel[Key])
  851. }
  852. menu_destroy(Hp_Menu)
  853. return PLUGIN_HANDLED
  854. }
  855.  
  856. public SpeedMenu_Handler(id, Speed_Menu, item)
  857. {
  858. if (item == MENU_EXIT)
  859. {
  860. menu_destroy(Speed_Menu)
  861. return PLUGIN_HANDLED
  862. }
  863.  
  864. new Data[6], Name[64]
  865. new Access, Callback;
  866. menu_item_getinfo(Speed_Menu, item, Access, Data, 5, Name, 63, Callback)
  867.  
  868. new Key = str_to_num(Data)
  869.  
  870. new Money = get_user_money(id)
  871. new Pcvar = get_pcvar_num(g_pSpeedMenuCvars[Key])
  872.  
  873. if (!Pcvar)
  874. {
  875. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  876. return PLUGIN_HANDLED
  877. }
  878.  
  879. if (Money < Pcvar)
  880. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  881. else
  882. {
  883. g_iHasSpeed[id] = Key
  884.  
  885. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szSpeedMenu[Key])
  886.  
  887. set_user_money(id, Money-Pcvar)
  888. set_user_maxspeed(id, g_flSpeedLevel[Key])
  889. }
  890. menu_destroy(Speed_Menu)
  891. return PLUGIN_HANDLED
  892. }
  893.  
  894. public SkinsMenu_Handler(id, Mdl_Menu, item)
  895. {
  896. if (item == MENU_EXIT)
  897. {
  898. menu_destroy(Mdl_Menu)
  899. return PLUGIN_HANDLED
  900. }
  901.  
  902. new Data[6], Name[64]
  903. new Access, Callback
  904. menu_item_getinfo(Mdl_Menu, item, Access, Data, 5, Name, 63, Callback)
  905.  
  906. new Key = str_to_num(Data)
  907.  
  908. new Money = get_user_money(id)
  909. new Pcvar = get_pcvar_num(g_pSkinsMenuCvars[Key])
  910.  
  911. new CsTeams:Team = cs_get_user_team(id)
  912.  
  913. if (!Pcvar)
  914. {
  915. client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
  916. return PLUGIN_HANDLED
  917. }
  918.  
  919. switch (Team)
  920. {
  921. case CS_TEAM_T:
  922. {
  923. if (Key == 0)
  924. {
  925. client_print_c(id, "%L", id, "SHOP_ITEM_NOT")
  926. return PLUGIN_HANDLED
  927. }
  928. }
  929.  
  930. case CS_TEAM_CT:
  931. {
  932. if (Key == 1)
  933. {
  934. client_print_c(id, "%L", id, "SHOP_ITEM_NOCT")
  935. return PLUGIN_HANDLED
  936. }
  937. }
  938. }
  939.  
  940. if (Money < Pcvar)
  941. client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
  942. else
  943. {
  944. client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szSkinsMenu[Key])
  945.  
  946. set_user_money(id, Money-Pcvar)
  947. fm_set_user_model(id, g_szSkinsName[Key])
  948. }
  949. menu_destroy(Mdl_Menu)
  950. return PLUGIN_HANDLED
  951. }
  952.  
  953. /*================================================================================
  954.  [Forwards]
  955. =================================================================================*/
  956.  
  957. public Fwd_PlayerSpawn_Post(id)
  958. {
  959. if (is_user_alive(id))
  960. {
  961. set_user_rendering(id)
  962. set_user_gravity(id, 1.0)
  963.  
  964. if (g_bHasCustomModel[id])
  965. fm_reset_user_model(id)
  966.  
  967. if (g_iHasSpeed[id])
  968. {
  969. set_user_maxspeed(id, 250.0)
  970. g_iHasSpeed[id] = -1
  971. }
  972.  
  973. if (get_pcvar_num(g_pCvarEnable))
  974. if (get_pcvar_num(g_pCvarMessage))
  975. client_print_c(id, "%L", id, "SHOP_PRINT")
  976. }
  977. }
  978.  
  979. public Fwd_SetClientKeyValue(id, const infobuffer[], const key[])
  980. {
  981. if (g_bHasCustomModel[id] && equal(key, "model"))
  982. return FMRES_SUPERCEDE
  983.  
  984. return FMRES_IGNORED
  985. }
  986.  
  987. public Event_CurWeapon(id)
  988. {
  989. if (!is_user_alive(id))
  990. return
  991.  
  992. switch (g_iHasSpeed[id])
  993. {
  994. case 0: set_user_maxspeed(id, 260.0)
  995. case 1: set_user_maxspeed(id, 300.0)
  996. case 2: set_user_maxspeed(id, 340.0)
  997. case 3: set_user_maxspeed(id, 380.0)
  998. case 4: set_user_maxspeed(id, 420.0)
  999. }
  1000. }
  1001.  
  1002. /*================================================================================
  1003.  [Stocks]
  1004. =================================================================================*/
  1005.  
  1006. stock primary_wpn_drop(index)
  1007. {
  1008. new weapons[32], num, Weapon
  1009. get_user_weapons(index, weapons, num)
  1010.  
  1011. for (new i = 0; i < num; i++)
  1012. {
  1013. Weapon = weapons[i]
  1014.  
  1015. if (PRIMARY_WEAPONS_BITSUM & (1<<Weapon))
  1016. {
  1017. static wname[32]
  1018. get_weaponname(Weapon, wname, sizeof wname - 1)
  1019.  
  1020. engclient_cmd(index, "drop", wname)
  1021. }
  1022. }
  1023. }
  1024.  
  1025. stock secondary_wpn_drop(index)
  1026. {
  1027. new weapons[32], num, Weapon
  1028. get_user_weapons(index, weapons, num)
  1029.  
  1030. for (new i = 0; i < num; i++)
  1031. {
  1032. Weapon = weapons[i]
  1033.  
  1034. if (!(PRIMARY_WEAPONS_BITSUM & (1<<Weapon)))
  1035. {
  1036. static wname[32]
  1037. get_weaponname(Weapon, wname, sizeof wname - 1)
  1038.  
  1039. engclient_cmd(index, "drop", wname)
  1040. }
  1041. }
  1042. }
  1043.  
  1044. stock fm_set_user_model(index, const mdl[])
  1045. {
  1046. engfunc(EngFunc_SetClientKeyValue, index, engfunc(EngFunc_GetInfoKeyBuffer, index), "model", mdl)
  1047. g_bHasCustomModel[index] = true
  1048. }
  1049.  
  1050. stock fm_reset_user_model(index)
  1051. {
  1052. g_bHasCustomModel[index] = false
  1053. dllfunc(DLLFunc_ClientUserInfoChanged, index, engfunc(EngFunc_GetInfoKeyBuffer, index))
  1054. }
  1055.  
  1056. stock client_print_c(index, const Msg[], {Float, Sql, Result,_}:...)
  1057. {
  1058. if (!is_user_connected(index))
  1059. return;
  1060.  
  1061. new Buffer[512], Buffer2[512], Prefix[32]
  1062. get_pcvar_string(g_pCvarPrefix, Prefix, charsmax(Prefix))
  1063. formatex(Buffer2, charsmax(Buffer2), "^x04%s ^x01%s", Prefix, Msg);
  1064. vformat(Buffer, charsmax(Buffer), Buffer2, 3);
  1065.  
  1066. message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, index);
  1067. write_byte(index);
  1068. write_string(Buffer);
  1069. message_end();
  1070. }
  1071.  
  1072.  
  1073.  
  1074.  
  1075.