MegastoRM

eXtreme Weapons System

Dec 27th, 2012
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.79 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <hamsandwich>
  6. #include <cstrike>
  7. #include <fakemeta>
  8.  
  9. new const LAUNCHERS_FILE[] = "launchers.ini"
  10. new const SNIPERS_FILE[] = "snipers.ini"
  11. new const RIFLES_FILE[] = "rifles.ini"
  12. new const SMGS_FILE[] = "smgs.ini"
  13. new const SHOTGUNS_FILE[] = "shotguns.ini"
  14. new const GUNS_FILE[] = "guns.ini"
  15.  
  16. new g_launcher_selected, g_sniper_selected, g_rifle_selected, g_smg_selected, g_shotgun_selected, g_gun_selected
  17. new g_fwDummyResult
  18. const I_PLUGIN_HANDLED = 97
  19. const PEV_ADDITIONAL_AMMO = pev_iuser1
  20.  
  21. new const EXTRA_LAUNCHERS_STARTID = 0, EXTRA_SNIPERS_STARTID = 0, EXTRA_RIFLES_STARTID = 0,
  22. EXTRA_SMG_STARTID = 0, EXTRA_SHOTGUNS_STARTID = 0, EXTRA_GUNS_STARTID = 0
  23.  
  24. new Array:g_launchername,Array:g_launchercost, Array:g_extra_sniper_name, Array:g_extra_sniper_cost,
  25. Array:g_extra_rifle_name, Array:g_extra_rifle_cost, Array:g_extra_smg_name, Array:g_extra_smg_cost,
  26. Array:g_extra_shotgun_name, Array:g_extra_shotgun_cost, Array:g_extra_gun_name, Array:g_extra_gun_cost
  27.  
  28. new g_launchers_i, g_snipers_i, g_extraitem_i, g_extra_smg_i, g_extra_shotgun_i, g_extra_gun_i
  29.  
  30. new bool:g_arrays_created
  31.  
  32. new Array:g_launcher_realname, Array:g_launcher2name, Array:g_launcher2cost,
  33. Array:g_extra_launcher_new, Array:g_launcher_names, Array:g_extra_launcher_items,
  34. Array:g_extra_sniper2_realname, Array:g_extra_sniper2_name, Array:g_extra_sniper2_cost,
  35. Array:g_extra_sniper_new, Array:g_extra_sniper_names, Array:g_extra_sniper_items,
  36. Array:g_extra_rifle2_realname, Array:g_extra_rifle2_name, Array:g_extra_rifle2_cost,
  37. Array:g_extra_rifle_new, Array:g_extra_rifle_names, Array:g_extra_rifle_items,
  38. Array:g_extra_smg2_realname, Array:g_extra_smg2_name, Array:g_extra_smg2_cost,
  39. Array:g_extra_smg_new, Array:g_extra_smg_names, Array:g_extra_smg_items,
  40. Array:g_extra_shotgun2_realname, Array:g_extra_shotgun2_name, Array:g_extra_shotgun2_cost,
  41. Array:g_extra_shotgun_new, Array:g_extra_shotgun_names, Array:g_extra_shotgun_items,
  42. Array:g_extra_gun2_realname, Array:g_extra_gun2_name, Array:g_extra_gun2_cost,
  43. Array:g_extra_gun_new, Array:g_extra_gun_names, Array:g_extra_gun_items
  44.  
  45. #define LAUNCHERS_CUSTOM_STARTID (EXTRA_LAUNCHERS_STARTID + ArraySize(g_launcher_names))
  46. #define SNIPERS_CUSTOM_STARTID (EXTRA_SNIPERS_STARTID + ArraySize(g_extra_sniper_names))
  47. #define RIFLES_CUSTOM_STARTID (EXTRA_RIFLES_STARTID + ArraySize(g_extra_rifle_names))
  48. #define SMGS_CUSTOM_STARTID (EXTRA_SMG_STARTID + ArraySize(g_extra_smg_names))
  49. #define SHOTGUNS_CUSTOM_STARTID (EXTRA_SHOTGUNS_STARTID + ArraySize(g_extra_shotgun_names))
  50. #define GUNS_CUSTOM_STARTID (EXTRA_GUNS_STARTID + ArraySize(g_extra_gun_names))
  51.  
  52. new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
  53. 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
  54.  
  55. new const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10,
  56. 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }
  57.  
  58. new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
  59. "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
  60. "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
  61.  
  62. new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
  63. "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
  64. "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
  65. "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
  66. "weapon_ak47", "weapon_knife", "weapon_p90" }
  67.  
  68. const PRIMARY_WEAPONS_BIT_SUM = (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)
  69. const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
  70.  
  71.  
  72. public plugin_init() {
  73. register_plugin("eXtreme Weapons System","1.0beta","MeRcyLeZZ | MegastorM")
  74.  
  75. register_library("xws")
  76.  
  77. register_clcmd("say /shop","CmdShopMenu")
  78. register_clcmd("say /menu","CmdShopMenu")
  79. register_clcmd("say /items","CmdShopMenu")
  80.  
  81. g_launcher_selected = CreateMultiForward("xws_launcher_selected", ET_CONTINUE, FP_CELL, FP_CELL)
  82. g_sniper_selected = CreateMultiForward("xws_sniper_selected", ET_CONTINUE, FP_CELL, FP_CELL)
  83. g_rifle_selected = CreateMultiForward("xws_rifle_selected", ET_CONTINUE, FP_CELL, FP_CELL)
  84. g_smg_selected = CreateMultiForward("xws_smg_selected", ET_CONTINUE, FP_CELL, FP_CELL)
  85. g_shotgun_selected = CreateMultiForward("xws_shotgun_selected", ET_CONTINUE, FP_CELL, FP_CELL)
  86. g_gun_selected = CreateMultiForward("xws_gun_selected", ET_CONTINUE, FP_CELL, FP_CELL)
  87. // Add your code here...
  88. }
  89.  
  90. public CmdShopMenu(id)
  91. {
  92. if(!is_user_alive(id))
  93. return PLUGIN_HANDLED
  94.  
  95. new menu = menu_create("Select option:","MainMenu_H")
  96. menu_additem(menu,"Guns")
  97. menu_additem(menu,"Shotguns")
  98. menu_additem(menu,"SMGs")
  99. menu_additem(menu,"Rifles")
  100. menu_additem(menu,"Snipers")
  101. menu_additem(menu,"Launchers")
  102.  
  103. menu_setprop(menu, MPROP_EXITNAME, "Izadji")
  104.  
  105. menu_display(id, menu)
  106.  
  107. return PLUGIN_CONTINUE
  108. }
  109.  
  110. public MainMenu_H(id, menu, item)
  111. {
  112. if(item == MENU_EXIT)
  113. {
  114. menu_destroy(menu)
  115. return PLUGIN_CONTINUE
  116. }
  117. switch(item)
  118. {
  119. case 0: show_menu_guns(id);
  120. case 1: show_menu_shotguns(id);
  121. case 2: show_extra_smgs(id);
  122. case 3: show_extra_rifles(id);
  123. case 4: show_extra_snipers(id);
  124. case 5: show_extra_launchers(id);
  125. }
  126. return PLUGIN_CONTINUE
  127. }
  128.  
  129. public plugin_natives()
  130. {
  131. register_native("xws_register_launcher", "native_register_launcher", 1)
  132. register_native("xws_give_launcher", "native_force_give_launcher", 1)
  133. register_native("xws_get_launcher_id", "native_get_launcher_id", 1)
  134. register_native("xws_launchers_menu", "show_extra_launchers", 1)
  135.  
  136. register_native("xws_register_sniper", "native_register_sniper", 1)
  137. register_native("xws_give_sniper", "native_force_give_sniper", 1)
  138. register_native("xws_get_sniper_id", "native_get_sniper_id", 1)
  139. register_native("xws_snipers_menu", "show_extra_snipers", 1)
  140.  
  141. register_native("xws_register_rifle", "native_register_rifle", 1)
  142. register_native("xws_give_rifle", "native_force_give_rifle", 1)
  143. register_native("xws_get_rifle_id", "native_get_rifle_id", 1)
  144. register_native("xws_rifles_menu", "show_extra_rifles", 1)
  145.  
  146. register_native("xws_register_smg", "native_register_smg", 1)
  147. register_native("xws_give_smg", "native_force_give_smg", 1)
  148. register_native("xws_get_smg_id", "native_get_smg_id", 1)
  149. register_native("xws_smgs_menu", "show_extra_smgs", 1)
  150.  
  151. register_native("xws_register_shotgun", "native_register_shotgun", 1)
  152. register_native("xws_give_shotgun", "native_force_give_shotgun", 1)
  153. register_native("xws_get_shotgun_id", "native_get_shotgun_id", 1)
  154. register_native("xws_shotguns_menu", "show_menu_shotguns", 1)
  155.  
  156. register_native("xws_register_gun", "native_register_gun", 1)
  157. register_native("xws_give_gun", "native_force_give_gun", 1)
  158. register_native("xws_get_gun_id", "native_get_gun_id", 1)
  159. register_native("xws_guns_menu", "show_menu_guns", 1)
  160. }
  161.  
  162. public plugin_precache()
  163. {
  164. g_launcher_names = ArrayCreate(32, 1)
  165. g_extra_launcher_items = ArrayCreate(32, 1)
  166. g_launchername = ArrayCreate(32, 1)
  167. g_launchercost = ArrayCreate(1, 1)
  168. g_launcher_realname = ArrayCreate(32, 1)
  169. g_launcher2name = ArrayCreate(32, 1)
  170. g_launcher2cost = ArrayCreate(1, 1)
  171. g_extra_launcher_new = ArrayCreate(1, 1)
  172.  
  173. g_extra_sniper_names = ArrayCreate(32, 1)
  174. g_extra_sniper_items = ArrayCreate(32, 1)
  175. g_extra_sniper_name = ArrayCreate(32, 1)
  176. g_extra_sniper_cost = ArrayCreate(1, 1)
  177. g_extra_sniper2_realname = ArrayCreate(32, 1)
  178. g_extra_sniper2_name = ArrayCreate(32, 1)
  179. g_extra_sniper2_cost = ArrayCreate(1, 1)
  180. g_extra_sniper_new = ArrayCreate(1, 1)
  181.  
  182. g_extra_rifle_names = ArrayCreate(32, 1)
  183. g_extra_rifle_items = ArrayCreate(32, 1)
  184. g_extra_rifle_name = ArrayCreate(32, 1)
  185. g_extra_rifle_cost = ArrayCreate(1, 1)
  186. g_extra_rifle2_realname = ArrayCreate(32, 1)
  187. g_extra_rifle2_name = ArrayCreate(32, 1)
  188. g_extra_rifle2_cost = ArrayCreate(1, 1)
  189. g_extra_rifle_new = ArrayCreate(1, 1)
  190.  
  191. g_extra_smg_names = ArrayCreate(32, 1)
  192. g_extra_smg_items = ArrayCreate(32, 1)
  193. g_extra_smg_name = ArrayCreate(32, 1)
  194. g_extra_smg_cost = ArrayCreate(1, 1)
  195. g_extra_smg2_realname = ArrayCreate(32, 1)
  196. g_extra_smg2_name = ArrayCreate(32, 1)
  197. g_extra_smg2_cost = ArrayCreate(1, 1)
  198. g_extra_smg_new = ArrayCreate(1, 1)
  199.  
  200. g_extra_shotgun_names = ArrayCreate(32, 1)
  201. g_extra_shotgun_items = ArrayCreate(32, 1)
  202. g_extra_shotgun_name = ArrayCreate(32, 1)
  203. g_extra_shotgun_cost = ArrayCreate(1, 1)
  204. g_extra_shotgun2_realname = ArrayCreate(32, 1)
  205. g_extra_shotgun2_name = ArrayCreate(32, 1)
  206. g_extra_shotgun2_cost = ArrayCreate(1, 1)
  207. g_extra_shotgun_new = ArrayCreate(1, 1)
  208.  
  209. g_extra_gun_names = ArrayCreate(32, 1)
  210. g_extra_gun_items = ArrayCreate(32, 1)
  211. g_extra_gun_name = ArrayCreate(32, 1)
  212. g_extra_gun_cost = ArrayCreate(1, 1)
  213. g_extra_gun2_realname = ArrayCreate(32, 1)
  214. g_extra_gun2_name = ArrayCreate(32, 1)
  215. g_extra_gun2_cost = ArrayCreate(1, 1)
  216. g_extra_gun_new = ArrayCreate(1, 1)
  217.  
  218. g_arrays_created = true
  219.  
  220. load_customization()
  221. }
  222.  
  223. public plugin_cfg()
  224. {
  225. g_arrays_created = false
  226.  
  227. save_customization()
  228. }
  229.  
  230. load_customization()
  231. {
  232. new path1[64], path2[64], path3[64], path4[64] , path5[64], path6[64]
  233. get_configsdir(path1, charsmax(path1))
  234. get_configsdir(path2, charsmax(path2))
  235. get_configsdir(path3, charsmax(path3))
  236. get_configsdir(path4, charsmax(path4))
  237. get_configsdir(path5, charsmax(path5))
  238. get_configsdir(path6, charsmax(path6))
  239. format(path1, charsmax(path1), "%s/xws/%s", path1, LAUNCHERS_FILE)
  240. format(path2, charsmax(path2), "%s/xws/%s", path2, SNIPERS_FILE)
  241. format(path3, charsmax(path3), "%s/xws/%s", path3, RIFLES_FILE)
  242. format(path4, charsmax(path4), "%s/xws/%s", path4, SMGS_FILE)
  243. format(path5, charsmax(path5), "%s/xws/%s", path5, SHOTGUNS_FILE)
  244. format(path6, charsmax(path6), "%s/xws/%s", path6, GUNS_FILE)
  245.  
  246. new file
  247. new linedata[1024], key[64], value[960]
  248.  
  249. if (file_exists(path1))
  250. {
  251. file = fopen(path1, "rt")
  252.  
  253. while (file && !feof(file))
  254. {
  255. fgets(file, linedata, charsmax(linedata))
  256. replace(linedata, charsmax(linedata), "^n", "")
  257. if (!linedata[0] || linedata[0] == ';') continue;
  258.  
  259. if (linedata[0] == '[')
  260. {
  261. linedata[strlen(linedata) - 1] = 0
  262. copy(linedata, charsmax(linedata), linedata[1])
  263. ArrayPushString(g_launcher_realname, linedata)
  264. continue;
  265. }
  266. strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
  267. trim(key)
  268. trim(value)
  269.  
  270. if (equal(key, "NAME"))
  271. ArrayPushString(g_launcher2name, value)
  272. else if (equal(key, "COST"))
  273. ArrayPushCell(g_launcher2cost, str_to_num(value))
  274. }
  275. if (file) fclose(file)
  276. }
  277. if (file_exists(path2))
  278. {
  279. file = fopen(path2, "rt")
  280. while (file && !feof(file))
  281. {
  282. fgets(file, linedata, charsmax(linedata))
  283. replace(linedata, charsmax(linedata), "^n", "")
  284. if (!linedata[0] || linedata[0] == ';') continue;
  285. if (linedata[0] == '[')
  286. {
  287. linedata[strlen(linedata) - 1] = 0
  288. copy(linedata, charsmax(linedata), linedata[1])
  289. ArrayPushString(g_extra_sniper2_realname, linedata)
  290. continue;
  291. }
  292. strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
  293. trim(key)
  294. trim(value)
  295. if (equal(key, "NAME"))
  296. ArrayPushString(g_extra_sniper2_name, value)
  297. else if (equal(key, "COST"))
  298. ArrayPushCell(g_extra_sniper2_cost, str_to_num(value))
  299. }
  300. if (file) fclose(file)
  301. }
  302. if (file_exists(path3))
  303. {
  304. file = fopen(path3, "rt")
  305. while (file && !feof(file))
  306. {
  307. fgets(file, linedata, charsmax(linedata))
  308. replace(linedata, charsmax(linedata), "^n", "")
  309. if (!linedata[0] || linedata[0] == ';') continue;
  310. if (linedata[0] == '[')
  311. {
  312. linedata[strlen(linedata) - 1] = 0
  313. copy(linedata, charsmax(linedata), linedata[1])
  314. ArrayPushString(g_extra_rifle2_realname, linedata)
  315. continue;
  316. }
  317. strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
  318. trim(key)
  319. trim(value)
  320. if (equal(key, "NAME"))
  321. ArrayPushString(g_extra_rifle2_name, value)
  322. else if (equal(key, "COST"))
  323. ArrayPushCell(g_extra_rifle2_cost, str_to_num(value))
  324. }
  325. if (file) fclose(file)
  326. }
  327. if (file_exists(path4))
  328. {
  329. file = fopen(path4, "rt")
  330. while (file && !feof(file))
  331. {
  332. fgets(file, linedata, charsmax(linedata))
  333. replace(linedata, charsmax(linedata), "^n", "")
  334. if (!linedata[0] || linedata[0] == ';') continue;
  335. if (linedata[0] == '[')
  336. {
  337. linedata[strlen(linedata) - 1] = 0
  338. copy(linedata, charsmax(linedata), linedata[1])
  339. ArrayPushString(g_extra_smg2_realname, linedata)
  340. continue;
  341. }
  342. strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
  343. trim(key)
  344. trim(value)
  345. if (equal(key, "NAME"))
  346. ArrayPushString(g_extra_smg2_name, value)
  347. else if (equal(key, "COST"))
  348. ArrayPushCell(g_extra_smg2_cost, str_to_num(value))
  349. }
  350. if (file) fclose(file)
  351. }
  352. if (file_exists(path5))
  353. {
  354. file = fopen(path5, "rt")
  355. while (file && !feof(file))
  356. {
  357. fgets(file, linedata, charsmax(linedata))
  358. replace(linedata, charsmax(linedata), "^n", "")
  359. if (!linedata[0] || linedata[0] == ';') continue;
  360. if (linedata[0] == '[')
  361. {
  362. linedata[strlen(linedata) - 1] = 0
  363. copy(linedata, charsmax(linedata), linedata[1])
  364. ArrayPushString(g_extra_shotgun2_realname, linedata)
  365. continue;
  366. }
  367. strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
  368. trim(key)
  369. trim(value)
  370. if (equal(key, "NAME"))
  371. ArrayPushString(g_extra_shotgun2_name, value)
  372. else if (equal(key, "COST"))
  373. ArrayPushCell(g_extra_shotgun2_cost, str_to_num(value))
  374. }
  375. if (file) fclose(file)
  376. }
  377. if (file_exists(path6))
  378. {
  379. file = fopen(path6, "rt")
  380. while (file && !feof(file))
  381. {
  382. fgets(file, linedata, charsmax(linedata))
  383. replace(linedata, charsmax(linedata), "^n", "")
  384. if (!linedata[0] || linedata[0] == ';') continue;
  385.  
  386. if (linedata[0] == '[')
  387. {
  388. linedata[strlen(linedata) - 1] = 0
  389. copy(linedata, charsmax(linedata), linedata[1])
  390.  
  391. ArrayPushString(g_extra_gun2_realname, linedata)
  392. continue;
  393. }
  394. strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
  395. trim(key)
  396. trim(value)
  397.  
  398. if (equal(key, "NAME"))
  399. ArrayPushString(g_extra_gun2_name, value)
  400. else if (equal(key, "COST"))
  401. ArrayPushCell(g_extra_gun2_cost, str_to_num(value))
  402. }
  403. if (file) fclose(file)
  404. }
  405. }
  406.  
  407. save_customization()
  408. {
  409. new i,buffer[512]
  410.  
  411. new path1[64], path2[64], path3[64], path4[64] , path5[64], path6[64]
  412. get_configsdir(path1, charsmax(path1))
  413. get_configsdir(path2, charsmax(path2))
  414. get_configsdir(path3, charsmax(path3))
  415. get_configsdir(path4, charsmax(path4))
  416. get_configsdir(path5, charsmax(path5))
  417. get_configsdir(path6, charsmax(path6))
  418. format(path1, charsmax(path1), "%s/xws/%s", path1, LAUNCHERS_FILE)
  419. format(path2, charsmax(path2), "%s/xws/%s", path2, SNIPERS_FILE)
  420. format(path3, charsmax(path3), "%s/xws/%s", path3, RIFLES_FILE)
  421. format(path4, charsmax(path4), "%s/xws/%s", path4, SMGS_FILE)
  422. format(path5, charsmax(path5), "%s/xws/%s", path5, SHOTGUNS_FILE)
  423. format(path6, charsmax(path6), "%s/xws/%s", path6, GUNS_FILE)
  424. new file
  425.  
  426. new size
  427. file = fopen(path1, "at")
  428. size = ArraySize(g_launchername)
  429. for (i = LAUNCHERS_CUSTOM_STARTID; i < size; i++)
  430. {
  431. if (ArrayGetCell(g_extra_launcher_new, i))
  432. {
  433. ArrayGetString(g_launchername, i, buffer, charsmax(buffer))
  434. format(buffer, charsmax(buffer), "^n[%s]", buffer)
  435. fputs(file, buffer)
  436.  
  437. ArrayGetString(g_launchername, i, buffer, charsmax(buffer))
  438. format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
  439. fputs(file, buffer)
  440.  
  441. formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_launchercost, i))
  442. fputs(file, buffer)
  443. }
  444. }
  445. fclose(file)
  446. ArrayDestroy(g_launcher_realname)
  447. ArrayDestroy(g_launcher2name)
  448. ArrayDestroy(g_launcher2cost)
  449. ArrayDestroy(g_extra_launcher_new)
  450.  
  451. file = fopen(path2, "at")
  452. size = ArraySize(g_extra_sniper_name)
  453.  
  454. for (i = SNIPERS_CUSTOM_STARTID; i < size; i++)
  455. {
  456. if (ArrayGetCell(g_extra_sniper_new, i))
  457. {
  458. ArrayGetString(g_extra_sniper_name, i, buffer, charsmax(buffer))
  459. format(buffer, charsmax(buffer), "^n[%s]", buffer)
  460. fputs(file, buffer)
  461.  
  462. ArrayGetString(g_extra_sniper_name, i, buffer, charsmax(buffer))
  463. format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
  464. fputs(file, buffer)
  465.  
  466. formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_sniper_cost, i))
  467. fputs(file, buffer)
  468. }
  469. }
  470. fclose(file)
  471. ArrayDestroy(g_extra_sniper2_realname)
  472. ArrayDestroy(g_extra_sniper2_name)
  473. ArrayDestroy(g_extra_sniper2_cost)
  474. ArrayDestroy(g_extra_sniper_new)
  475.  
  476. file = fopen(path3, "at")
  477. size = ArraySize(g_extra_rifle_name)
  478.  
  479. for (i = RIFLES_CUSTOM_STARTID; i < size; i++)
  480. {
  481. if (ArrayGetCell(g_extra_rifle_new, i))
  482. {
  483. ArrayGetString(g_extra_rifle_name, i, buffer, charsmax(buffer))
  484. format(buffer, charsmax(buffer), "^n[%s]", buffer)
  485. fputs(file, buffer)
  486.  
  487. ArrayGetString(g_extra_rifle_name, i, buffer, charsmax(buffer))
  488. format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
  489. fputs(file, buffer)
  490.  
  491. formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_rifle_cost, i))
  492. fputs(file, buffer)
  493. }
  494. }
  495. fclose(file)
  496. ArrayDestroy(g_extra_rifle2_realname)
  497. ArrayDestroy(g_extra_rifle2_name)
  498. ArrayDestroy(g_extra_rifle2_cost)
  499. ArrayDestroy(g_extra_rifle_new)
  500.  
  501. file = fopen(path4, "at")
  502. size = ArraySize(g_extra_smg_name)
  503.  
  504. for (i = SMGS_CUSTOM_STARTID; i < size; i++)
  505. {
  506. if (ArrayGetCell(g_extra_smg_new, i))
  507. {
  508. ArrayGetString(g_extra_smg_name, i, buffer, charsmax(buffer))
  509. format(buffer, charsmax(buffer), "^n[%s]", buffer)
  510. fputs(file, buffer)
  511.  
  512. ArrayGetString(g_extra_smg_name, i, buffer, charsmax(buffer))
  513. format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
  514. fputs(file, buffer)
  515.  
  516. formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_smg_cost, i))
  517. fputs(file, buffer)
  518. }
  519. }
  520. fclose(file)
  521. ArrayDestroy(g_extra_smg2_realname)
  522. ArrayDestroy(g_extra_smg2_name)
  523. ArrayDestroy(g_extra_smg2_cost)
  524. ArrayDestroy(g_extra_smg_new)
  525.  
  526. file = fopen(path5, "at")
  527. size = ArraySize(g_extra_shotgun_name)
  528.  
  529. for (i = SHOTGUNS_CUSTOM_STARTID; i < size; i++)
  530. {
  531. if (ArrayGetCell(g_extra_shotgun_new, i))
  532. {
  533. ArrayGetString(g_extra_shotgun_name, i, buffer, charsmax(buffer))
  534. format(buffer, charsmax(buffer), "^n[%s]", buffer)
  535. fputs(file, buffer)
  536.  
  537. ArrayGetString(g_extra_shotgun_name, i, buffer, charsmax(buffer))
  538. format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
  539. fputs(file, buffer)
  540.  
  541. formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_shotgun_cost, i))
  542. fputs(file, buffer)
  543. }
  544. }
  545. fclose(file)
  546. ArrayDestroy(g_extra_shotgun2_realname)
  547. ArrayDestroy(g_extra_shotgun2_name)
  548. ArrayDestroy(g_extra_shotgun2_cost)
  549. ArrayDestroy(g_extra_shotgun_new)
  550.  
  551. file = fopen(path6, "at")
  552. size = ArraySize(g_extra_gun_name)
  553.  
  554. for (i = GUNS_CUSTOM_STARTID; i < size; i++)
  555. {
  556. if (ArrayGetCell(g_extra_gun_new, i))
  557. {
  558. ArrayGetString(g_extra_gun_name, i, buffer, charsmax(buffer))
  559. format(buffer, charsmax(buffer), "^n[%s]", buffer)
  560. fputs(file, buffer)
  561.  
  562. ArrayGetString(g_extra_gun_name, i, buffer, charsmax(buffer))
  563. format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
  564. fputs(file, buffer)
  565.  
  566. formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_gun_cost, i))
  567. fputs(file, buffer)
  568. }
  569. }
  570. fclose(file)
  571. ArrayDestroy(g_extra_gun2_realname)
  572. ArrayDestroy(g_extra_gun2_name)
  573. ArrayDestroy(g_extra_gun2_cost)
  574. ArrayDestroy(g_extra_gun_new)
  575. }
  576.  
  577. public show_menu_guns(id)
  578. {
  579. static menuid, menu[128], item, buffer[32]
  580.  
  581. formatex(menu, charsmax(menu), "Izaberi extra item:")
  582. menuid = menu_create(menu, "menu_guns_H")
  583.  
  584. for (item = 0; item < g_extra_gun_i; item++)
  585. {
  586. switch (item)
  587. {
  588. default:
  589. {
  590. if (item >= EXTRA_GUNS_STARTID && item <= GUNS_CUSTOM_STARTID-1) continue;
  591. ArrayGetString(g_extra_gun_name, item, buffer, charsmax(buffer))
  592. }
  593. }
  594. formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_gun_cost, item))
  595. buffer[0] = item
  596. buffer[1] = 0
  597. menu_additem(menuid, menu, buffer)
  598. }
  599. if (menu_items(menuid) <= 0)
  600. {
  601. client_print(id, print_chat, "NEMA,STA GLEDAS??")
  602. menu_destroy(menuid)
  603. return;
  604. }
  605. formatex(menu, charsmax(menu), "Nazad")
  606. menu_setprop(menuid, MPROP_BACKNAME, menu)
  607. formatex(menu, charsmax(menu), "Napred")
  608. menu_setprop(menuid, MPROP_NEXTNAME, menu)
  609. formatex(menu, charsmax(menu), "Exit")
  610. menu_setprop(menuid, MPROP_EXITNAME, menu)
  611.  
  612. menu_display(id, menuid)
  613. }
  614.  
  615. public menu_guns_H(id, menuid, item)
  616. {
  617. if (item == MENU_EXIT)
  618. {
  619. menu_destroy(menuid)
  620. return PLUGIN_HANDLED;
  621. }
  622. if (!is_user_alive(id))
  623. {
  624. client_print(id,print_chat, "You are dead!")
  625. menu_destroy(menuid)
  626. return PLUGIN_HANDLED;
  627. }
  628.  
  629. static buffer[2], dummy, itemid
  630. menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
  631. itemid = buffer[0]
  632.  
  633. buy_extra_gun(id, itemid)
  634. menu_destroy(menuid)
  635. return PLUGIN_HANDLED;
  636. }
  637.  
  638. public show_menu_shotguns(id)
  639. {
  640. static menuid, menu[128], item, buffer[32]
  641.  
  642. formatex(menu, charsmax(menu), "Izaberi extra item:")
  643. menuid = menu_create(menu, "menu_shotguns_H")
  644.  
  645. for (item = 0; item < g_extra_shotgun_i; item++)
  646. {
  647. switch (item)
  648. {
  649. default:
  650. {
  651. if (item >= EXTRA_SHOTGUNS_STARTID && item <= SHOTGUNS_CUSTOM_STARTID-1) continue;
  652. ArrayGetString(g_extra_shotgun_name, item, buffer, charsmax(buffer))
  653. }
  654. }
  655. formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_shotgun_cost, item))
  656. buffer[0] = item
  657. buffer[1] = 0
  658. menu_additem(menuid, menu, buffer)
  659. }
  660. if (menu_items(menuid) <= 0)
  661. {
  662. client_print(id, print_chat, "NEMA,STA GLEDAS??")
  663. menu_destroy(menuid)
  664. return;
  665. }
  666. formatex(menu, charsmax(menu), "Nazad")
  667. menu_setprop(menuid, MPROP_BACKNAME, menu)
  668. formatex(menu, charsmax(menu), "Napred")
  669. menu_setprop(menuid, MPROP_NEXTNAME, menu)
  670. formatex(menu, charsmax(menu), "Exit")
  671. menu_setprop(menuid, MPROP_EXITNAME, menu)
  672.  
  673. menu_display(id, menuid)
  674. }
  675.  
  676. public menu_shotguns_H(id, menuid, item)
  677. {
  678. if (item == MENU_EXIT)
  679. {
  680. menu_destroy(menuid)
  681. return PLUGIN_HANDLED;
  682. }
  683. if (!is_user_alive(id))
  684. {
  685. client_print(id,print_chat, "You are dead!")
  686. menu_destroy(menuid)
  687. return PLUGIN_HANDLED;
  688. }
  689. static buffer[2], dummy, itemid
  690. menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
  691. itemid = buffer[0]
  692.  
  693. buy_extra_shotgun(id, itemid)
  694. menu_destroy(menuid)
  695. return PLUGIN_HANDLED;
  696. }
  697.  
  698. public show_extra_smgs(id)
  699. {
  700. static menuid, menu[128], item, buffer[32]
  701. formatex(menu, charsmax(menu), "Izaberi extra item:")
  702. menuid = menu_create(menu, "menu_smgs_H")
  703.  
  704. // Item List
  705. for (item = 0; item < g_extra_smg_i; item++)
  706. {
  707. switch (item)
  708. {
  709. default:
  710. {
  711. if (item >= EXTRA_SMG_STARTID && item <= SMGS_CUSTOM_STARTID-1) continue;
  712. ArrayGetString(g_extra_smg_name, item, buffer, charsmax(buffer))
  713. }
  714. }
  715. formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_smg_cost, item))
  716. buffer[0] = item
  717. buffer[1] = 0
  718. menu_additem(menuid, menu, buffer)
  719. }
  720. if (menu_items(menuid) <= 0)
  721. {
  722. client_print(id, print_chat, "NEMA,STA GLEDAS??")
  723. menu_destroy(menuid)
  724. return;
  725. }
  726. formatex(menu, charsmax(menu), "Nazad")
  727. menu_setprop(menuid, MPROP_BACKNAME, menu)
  728. formatex(menu, charsmax(menu), "Napred")
  729. menu_setprop(menuid, MPROP_NEXTNAME, menu)
  730. formatex(menu, charsmax(menu), "Exit")
  731. menu_setprop(menuid, MPROP_EXITNAME, menu)
  732.  
  733. menu_display(id, menuid)
  734. }
  735.  
  736. public menu_smgs_H(id, menuid, item)
  737. {
  738. if (item == MENU_EXIT)
  739. {
  740. menu_destroy(menuid)
  741. return PLUGIN_HANDLED;
  742. }
  743. if (!is_user_alive(id))
  744. {
  745. client_print(id,print_chat, "You are dead!")
  746. menu_destroy(menuid)
  747. return PLUGIN_HANDLED;
  748. }
  749. static buffer[2], dummy, itemid
  750. menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
  751. itemid = buffer[0]
  752.  
  753. buy_extra_smg(id, itemid)
  754. menu_destroy(menuid)
  755. return PLUGIN_HANDLED;
  756. }
  757.  
  758. public show_extra_rifles(id)
  759. {
  760. static menuid, menu[128], item, buffer[32]
  761.  
  762. formatex(menu, charsmax(menu), "Izaberi extra item:")
  763. menuid = menu_create(menu, "menu_rifles_H")
  764.  
  765. for (item = 0; item < g_extraitem_i; item++)
  766. {
  767. switch (item)
  768. {
  769. default:
  770. {
  771. if (item >= EXTRA_RIFLES_STARTID && item <= RIFLES_CUSTOM_STARTID-1) continue;
  772. ArrayGetString(g_extra_rifle_name, item, buffer, charsmax(buffer))
  773. }
  774. }
  775. formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_rifle_cost, item))
  776. buffer[0] = item
  777. buffer[1] = 0
  778. menu_additem(menuid, menu, buffer)
  779. }
  780. if (menu_items(menuid) <= 0)
  781. {
  782. client_print(id, print_chat, "NEMA,STA GLEDAS??")
  783. menu_destroy(menuid)
  784. return;
  785. }
  786. formatex(menu, charsmax(menu), "Nazad")
  787. menu_setprop(menuid, MPROP_BACKNAME, menu)
  788. formatex(menu, charsmax(menu), "Napred")
  789. menu_setprop(menuid, MPROP_NEXTNAME, menu)
  790. formatex(menu, charsmax(menu), "Exit")
  791. menu_setprop(menuid, MPROP_EXITNAME, menu)
  792.  
  793. menu_display(id, menuid)
  794. }
  795.  
  796. public menu_rifles_H(id, menuid, item)
  797. {
  798. if (item == MENU_EXIT)
  799. {
  800. menu_destroy(menuid)
  801. return PLUGIN_HANDLED;
  802. }
  803. if (!is_user_alive(id))
  804. {
  805. client_print(id,print_chat, "You are dead!")
  806. menu_destroy(menuid)
  807. return PLUGIN_HANDLED;
  808. }
  809. static buffer[2], dummy, itemid
  810. menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
  811. itemid = buffer[0]
  812.  
  813. buy_extra_rifle(id, itemid)
  814. menu_destroy(menuid)
  815. return PLUGIN_HANDLED;
  816. }
  817.  
  818. public show_extra_snipers(id)
  819. {
  820. static menuid, menu[128], item, buffer[32]
  821.  
  822. formatex(menu, charsmax(menu), "Izaberi extra item:")
  823. menuid = menu_create(menu, "snipers_menu_H")
  824.  
  825. // Item List
  826. for (item = 0; item < g_snipers_i; item++)
  827. {
  828. switch (item)
  829. {
  830. default:
  831. {
  832. if (item >= EXTRA_SNIPERS_STARTID && item <= SNIPERS_CUSTOM_STARTID-1) continue;
  833. ArrayGetString(g_extra_sniper_name, item, buffer, charsmax(buffer))
  834. }
  835. }
  836. formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_sniper_cost, item))
  837. buffer[0] = item
  838. buffer[1] = 0
  839. menu_additem(menuid, menu, buffer)
  840. }
  841. if (menu_items(menuid) <= 0)
  842. {
  843. client_print(id, print_chat, "No items loaded!")
  844. menu_destroy(menuid)
  845. return;
  846. }
  847. formatex(menu, charsmax(menu), "Nazad")
  848. menu_setprop(menuid, MPROP_BACKNAME, menu)
  849. formatex(menu, charsmax(menu), "Napred")
  850. menu_setprop(menuid, MPROP_NEXTNAME, menu)
  851. formatex(menu, charsmax(menu), "Exit")
  852. menu_setprop(menuid, MPROP_EXITNAME, menu)
  853.  
  854. menu_display(id, menuid)
  855. }
  856.  
  857. public snipers_menu_H(id, menuid, item)
  858. {
  859. if (item == MENU_EXIT)
  860. {
  861. menu_destroy(menuid)
  862. return PLUGIN_HANDLED;
  863. }
  864. if (!is_user_alive(id))
  865. {
  866. client_print(id,print_chat, "You are dead!")
  867. menu_destroy(menuid)
  868. return PLUGIN_HANDLED;
  869. }
  870. static buffer[2], dummy, itemid
  871. menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
  872. itemid = buffer[0]
  873.  
  874. buy_extra_sniper(id, itemid)
  875. menu_destroy(menuid)
  876. return PLUGIN_HANDLED;
  877. }
  878.  
  879. public show_extra_launchers(id)
  880. {
  881. static menuid, menu[128], item, buffer[32]
  882.  
  883. formatex(menu, charsmax(menu), "Izaberi extra item:")
  884. menuid = menu_create(menu, "extra_launchers_handle")
  885.  
  886. for (item = 0; item < g_launchers_i; item++)
  887. {
  888. switch (item)
  889. {
  890. default:
  891. {
  892. if (item >= EXTRA_LAUNCHERS_STARTID && item <= LAUNCHERS_CUSTOM_STARTID-1) continue;
  893. ArrayGetString(g_launchername, item, buffer, charsmax(buffer))
  894. }
  895. }
  896. formatex(menu, charsmax(menu), "%s \y%d$", buffer, ArrayGetCell(g_launchercost, item))
  897. buffer[0] = item
  898. buffer[1] = 0
  899. menu_additem(menuid, menu, buffer)
  900. }
  901. if (menu_items(menuid) <= 0)
  902. {
  903. client_print(id, print_chat, "No extra items loaded!")
  904. menu_destroy(menuid)
  905. return;
  906. }
  907. formatex(menu, charsmax(menu), "Nazad")
  908. menu_setprop(menuid, MPROP_BACKNAME, menu)
  909. formatex(menu, charsmax(menu), "Napred")
  910. menu_setprop(menuid, MPROP_NEXTNAME, menu)
  911. formatex(menu, charsmax(menu), "Exit")
  912. menu_setprop(menuid, MPROP_EXITNAME, menu)
  913.  
  914. menu_display(id, menuid)
  915. }
  916.  
  917. public extra_launchers_handle(id, menuid, item)
  918. {
  919. if (item == MENU_EXIT)
  920. {
  921. menu_destroy(menuid)
  922. return PLUGIN_HANDLED;
  923. }
  924. if (!is_user_alive(id))
  925. {
  926. client_print(id,print_chat, "You are dead!")
  927. menu_destroy(menuid)
  928. return PLUGIN_HANDLED;
  929. }
  930. static buffer[2], dummy, itemid
  931. menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
  932. itemid = buffer[0]
  933.  
  934. buy_extra_launcher(id, itemid)
  935. menu_destroy(menuid)
  936. return PLUGIN_HANDLED;
  937. }
  938.  
  939. buy_extra_gun(id, itemid, bool:ignorecost = false)
  940. {
  941. if ((itemid >= EXTRA_GUNS_STARTID && itemid <= GUNS_CUSTOM_STARTID-1))
  942. {
  943. client_print(id,print_chat, "Nema!")
  944. return;
  945. }
  946. if (!ignorecost)
  947. {
  948. if (GetUserCash(id)< ArrayGetCell(g_extra_gun_cost, itemid))
  949. {
  950. client_print(id, print_chat, "Fali ti batice mozga!")
  951. return;
  952. }
  953. SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_gun_cost, itemid))
  954. }
  955. switch (itemid)
  956. {
  957. default:
  958. {
  959. if (itemid >= EXTRA_GUNS_STARTID && itemid <= GUNS_CUSTOM_STARTID-1)
  960. {
  961. static weaponid, wname[32]
  962. ArrayGetString(g_extra_gun_items, itemid - EXTRA_GUNS_STARTID, wname, charsmax(wname))
  963. weaponid = cs_weapon_name_to_id(wname)
  964.  
  965. if (MAXBPAMMO[weaponid] > 2)
  966. {
  967. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  968. drop_weapons(id, 1)
  969. else
  970. drop_weapons(id, 2)
  971.  
  972. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  973. }
  974. else if (user_has_weapon(id, weaponid))
  975. {
  976. cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
  977. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
  978. write_byte(AMMOID[weaponid])
  979. write_byte(1)
  980. message_end()
  981.  
  982. return;
  983. }
  984. fm_give_item(id, wname)
  985. }
  986. else
  987. {
  988. ExecuteForward(g_gun_selected, g_fwDummyResult, id, itemid);
  989.  
  990. if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
  991. SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_gun_cost, itemid))
  992. }
  993. }
  994. }
  995. }
  996.  
  997. buy_extra_shotgun(id, itemid, bool:ignorecost = false)
  998. {
  999. if ((itemid >= EXTRA_SHOTGUNS_STARTID && itemid <= SHOTGUNS_CUSTOM_STARTID-1))
  1000. {
  1001. client_print(id,print_chat, "Nema!")
  1002. return;
  1003. }
  1004.  
  1005. if (!ignorecost)
  1006. {
  1007. if (GetUserCash(id)< ArrayGetCell(g_extra_shotgun_cost, itemid))
  1008. {
  1009. client_print(id, print_chat, "Fali ti batice mozga!")
  1010. return;
  1011. }
  1012. SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_shotgun_cost, itemid))
  1013. }
  1014. switch (itemid)
  1015. {
  1016. default:
  1017. {
  1018. if (itemid >= EXTRA_SHOTGUNS_STARTID && itemid <= SHOTGUNS_CUSTOM_STARTID-1)
  1019. {
  1020. static weaponid, wname[32]
  1021. ArrayGetString(g_extra_shotgun_items, itemid - EXTRA_SHOTGUNS_STARTID, wname, charsmax(wname))
  1022. weaponid = cs_weapon_name_to_id(wname)
  1023.  
  1024. if (MAXBPAMMO[weaponid] > 2)
  1025. {
  1026. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  1027. drop_weapons(id, 1)
  1028. else
  1029. drop_weapons(id, 2)
  1030.  
  1031. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  1032. }
  1033. else if (user_has_weapon(id, weaponid))
  1034. {
  1035. cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
  1036. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
  1037. write_byte(AMMOID[weaponid])
  1038. write_byte(1)
  1039. message_end()
  1040.  
  1041. return;
  1042. }
  1043. fm_give_item(id, wname)
  1044. }
  1045. else
  1046. {
  1047. ExecuteForward(g_shotgun_selected, g_fwDummyResult, id, itemid);
  1048. if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
  1049. SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_shotgun_cost, itemid))
  1050. }
  1051. }
  1052. }
  1053. }
  1054.  
  1055. buy_extra_smg(id, itemid, bool:ignorecost = false)
  1056. {
  1057. if ((itemid >= EXTRA_SMG_STARTID && itemid <= SMGS_CUSTOM_STARTID-1))
  1058. {
  1059. client_print(id,print_chat, "Nema!")
  1060. return;
  1061. }
  1062. if (!ignorecost)
  1063. {
  1064. if (GetUserCash(id)< ArrayGetCell(g_extra_smg_cost, itemid))
  1065. {
  1066. client_print(id, print_chat, "Fali ti batice mozga!")
  1067. return;
  1068. }
  1069. SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_smg_cost, itemid))
  1070. }
  1071. switch (itemid)
  1072. {
  1073. default:
  1074. {
  1075. if (itemid >= EXTRA_SMG_STARTID && itemid <= SMGS_CUSTOM_STARTID-1)
  1076. {
  1077. static weaponid, wname[32]
  1078. ArrayGetString(g_extra_smg_items, itemid - EXTRA_SMG_STARTID, wname, charsmax(wname))
  1079. weaponid = cs_weapon_name_to_id(wname)
  1080. if (MAXBPAMMO[weaponid] > 2)
  1081. {
  1082. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  1083. drop_weapons(id, 1)
  1084. else
  1085. drop_weapons(id, 2)
  1086.  
  1087. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  1088. }
  1089. else if (user_has_weapon(id, weaponid))
  1090. {
  1091. cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
  1092. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
  1093. write_byte(AMMOID[weaponid])
  1094. write_byte(1)
  1095. message_end()
  1096.  
  1097. return;
  1098. }
  1099. fm_give_item(id, wname)
  1100. }
  1101. else
  1102. {
  1103. ExecuteForward(g_smg_selected, g_fwDummyResult, id, itemid);
  1104. if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
  1105. SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_smg_cost, itemid))
  1106. }
  1107. }
  1108. }
  1109. }
  1110.  
  1111. buy_extra_rifle(id, itemid, bool:ignorecost = false)
  1112. {
  1113. if ((itemid >= EXTRA_RIFLES_STARTID && itemid <= RIFLES_CUSTOM_STARTID-1))
  1114. {
  1115. client_print(id,print_chat, "Nema!")
  1116. return;
  1117. }
  1118. if (!ignorecost)
  1119. {
  1120. if (GetUserCash(id)< ArrayGetCell(g_extra_rifle_cost, itemid))
  1121. {
  1122. client_print(id, print_chat, "Fali ti batice mozga!")
  1123. return;
  1124. }
  1125. SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_rifle_cost, itemid))
  1126. }
  1127. switch (itemid)
  1128. {
  1129. default:
  1130. {
  1131. if (itemid >= EXTRA_RIFLES_STARTID && itemid <= RIFLES_CUSTOM_STARTID-1)
  1132. {
  1133. static weaponid, wname[32]
  1134. ArrayGetString(g_extra_rifle_items, itemid - EXTRA_RIFLES_STARTID, wname, charsmax(wname))
  1135. weaponid = cs_weapon_name_to_id(wname)
  1136.  
  1137. if (MAXBPAMMO[weaponid] > 2)
  1138. {
  1139. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  1140. drop_weapons(id, 1)
  1141. else
  1142. drop_weapons(id, 2)
  1143.  
  1144. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  1145. }
  1146. else if (user_has_weapon(id, weaponid))
  1147. {
  1148. cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
  1149. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
  1150. write_byte(AMMOID[weaponid])
  1151. write_byte(1)
  1152. message_end()
  1153.  
  1154. return;
  1155. }
  1156. fm_give_item(id, wname)
  1157. }
  1158. else
  1159. {
  1160. ExecuteForward(g_rifle_selected, g_fwDummyResult, id, itemid);
  1161.  
  1162. if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
  1163. SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_rifle_cost, itemid))
  1164. }
  1165. }
  1166. }
  1167. }
  1168.  
  1169. buy_extra_sniper(id, itemid, bool:ignorecost = false)
  1170. {
  1171. if ((itemid >= EXTRA_SNIPERS_STARTID && itemid <= SNIPERS_CUSTOM_STARTID-1))
  1172. {
  1173. client_print(id,print_chat, "Nema!")
  1174. return;
  1175. }
  1176. if (!ignorecost)
  1177. {
  1178. if (GetUserCash(id)< ArrayGetCell(g_extra_sniper_cost, itemid))
  1179. {
  1180. client_print(id, print_chat, "Fali ti batice mozga!")
  1181. return;
  1182. }
  1183. SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_sniper_cost, itemid))
  1184. }
  1185. switch (itemid)
  1186. {
  1187. default:
  1188. {
  1189. if (itemid >= EXTRA_SNIPERS_STARTID && itemid <= SNIPERS_CUSTOM_STARTID-1)
  1190. {
  1191. static weaponid, wname[32]
  1192. ArrayGetString(g_extra_sniper_items, itemid - EXTRA_SNIPERS_STARTID, wname, charsmax(wname))
  1193. weaponid = cs_weapon_name_to_id(wname)
  1194.  
  1195. if (MAXBPAMMO[weaponid] > 2)
  1196. {
  1197. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  1198. drop_weapons(id, 1)
  1199. else
  1200. drop_weapons(id, 2)
  1201.  
  1202. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  1203. }
  1204. else if (user_has_weapon(id, weaponid))
  1205. {
  1206. cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
  1207. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
  1208. write_byte(AMMOID[weaponid])
  1209. write_byte(1)
  1210. message_end()
  1211.  
  1212. return;
  1213. }
  1214. fm_give_item(id, wname)
  1215. }
  1216. else
  1217. {
  1218. ExecuteForward(g_sniper_selected, g_fwDummyResult, id, itemid);
  1219. if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
  1220. SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_sniper_cost, itemid))
  1221. }
  1222. }
  1223. }
  1224. }
  1225.  
  1226. buy_extra_launcher(id, itemid, bool:ignorecost = false)
  1227. {
  1228. if ((itemid >= EXTRA_LAUNCHERS_STARTID && itemid <= LAUNCHERS_CUSTOM_STARTID-1))
  1229. {
  1230. client_print(id,print_chat, "No items loaded!!")
  1231. return;
  1232. }
  1233. if (!ignorecost)
  1234. {
  1235. if (GetUserCash(id)< ArrayGetCell(g_launchercost, itemid))
  1236. {
  1237. client_print(id, print_chat, "Not enought money!")
  1238. return;
  1239. }
  1240. SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_launchercost, itemid))
  1241. }
  1242. switch (itemid)
  1243. {
  1244. default:
  1245. {
  1246. if (itemid >= EXTRA_LAUNCHERS_STARTID && itemid <= LAUNCHERS_CUSTOM_STARTID-1)
  1247. {
  1248. static weaponid, wname[32]
  1249. ArrayGetString(g_extra_launcher_items, itemid - EXTRA_LAUNCHERS_STARTID, wname, charsmax(wname))
  1250. weaponid = cs_weapon_name_to_id(wname)
  1251.  
  1252. if (MAXBPAMMO[weaponid] > 2)
  1253. {
  1254. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  1255. drop_weapons(id, 1)
  1256. else
  1257. drop_weapons(id, 2)
  1258.  
  1259. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  1260. }
  1261. else if (user_has_weapon(id, weaponid))
  1262. {
  1263. cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
  1264.  
  1265. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
  1266. write_byte(AMMOID[weaponid])
  1267. write_byte(1)
  1268. message_end()
  1269.  
  1270. return;
  1271. }
  1272. fm_give_item(id, wname)
  1273. }
  1274. else
  1275. {
  1276. ExecuteForward(g_launcher_selected, g_fwDummyResult, id, itemid);
  1277.  
  1278. if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
  1279. SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_launchercost, itemid))
  1280. }
  1281. }
  1282. }
  1283. }
  1284.  
  1285. public native_force_give_gun(id, itemid, bool:ignorecost)
  1286. {
  1287. if (itemid < 0 || itemid >= g_extra_gun_i)
  1288. return 0;
  1289.  
  1290. buy_extra_gun(id, itemid, ignorecost = true)
  1291. return 1;
  1292. }
  1293.  
  1294. public native_force_give_shotgun(id, itemid, bool:ignorecost)
  1295. {
  1296. if (itemid < 0 || itemid >= g_extra_shotgun_i)
  1297. return 0;
  1298.  
  1299. buy_extra_shotgun(id, itemid, ignorecost = true)
  1300. return 1;
  1301. }
  1302.  
  1303. public native_force_give_smg(id, itemid, bool:ignorecost)
  1304. {
  1305. if (itemid < 0 || itemid >= g_extra_smg_i)
  1306. return 0;
  1307.  
  1308. buy_extra_smg(id, itemid, ignorecost = true)
  1309. return 1;
  1310. }
  1311.  
  1312. public native_force_give_rifle(id, itemid, bool:ignorecost)
  1313. {
  1314. if (itemid < 0 || itemid >= g_extraitem_i)
  1315. return 0;
  1316.  
  1317. buy_extra_rifle(id, itemid, ignorecost = true)
  1318. return 1;
  1319. }
  1320.  
  1321. public native_force_give_sniper(id, itemid, bool:ignorecost)
  1322. {
  1323. if (itemid < 0 || itemid >= g_snipers_i)
  1324. return 0;
  1325.  
  1326. buy_extra_sniper(id, itemid, ignorecost = true)
  1327. return 1;
  1328. }
  1329.  
  1330. public native_force_give_launcher(id, itemid, bool:ignorecost)
  1331. {
  1332. if (itemid < 0 || itemid >= g_launchers_i)
  1333. return 0;
  1334.  
  1335. buy_extra_launcher(id, itemid, ignorecost = true)
  1336. return 1;
  1337. }
  1338.  
  1339. public native_get_gun_id(const name[])
  1340. {
  1341. param_convert(1)
  1342.  
  1343. static i, item_name[32]
  1344. for (i = 0; i < g_extra_gun_i; i++)
  1345. {
  1346. ArrayGetString(g_extra_gun_name, i, item_name, charsmax(item_name))
  1347.  
  1348. if (equali(name, item_name))
  1349. return i;
  1350. }
  1351.  
  1352. return -1;
  1353. }
  1354.  
  1355. public native_get_shotgun_id(const name[])
  1356. {
  1357. param_convert(1)
  1358.  
  1359. static i, item_name[32]
  1360. for (i = 0; i < g_extra_shotgun_i; i++)
  1361. {
  1362. ArrayGetString(g_extra_shotgun_name, i, item_name, charsmax(item_name))
  1363.  
  1364. if (equali(name, item_name))
  1365. return i;
  1366. }
  1367.  
  1368. return -1;
  1369. }
  1370.  
  1371. public native_get_smg_id(const name[])
  1372. {
  1373. param_convert(1)
  1374.  
  1375. static i, item_name[32]
  1376. for (i = 0; i < g_extra_smg_i; i++)
  1377. {
  1378. ArrayGetString(g_extra_smg_name, i, item_name, charsmax(item_name))
  1379.  
  1380. if (equali(name, item_name))
  1381. return i;
  1382. }
  1383.  
  1384. return -1;
  1385. }
  1386.  
  1387. public native_get_rifle_id(const name[])
  1388. {
  1389. param_convert(1)
  1390.  
  1391. static i, item_name[32]
  1392. for (i = 0; i < g_extraitem_i; i++)
  1393. {
  1394. ArrayGetString(g_extra_rifle_name, i, item_name, charsmax(item_name))
  1395.  
  1396. if (equali(name, item_name))
  1397. return i;
  1398. }
  1399.  
  1400. return -1;
  1401. }
  1402.  
  1403. public native_get_sniper_id(const name[])
  1404. {
  1405. param_convert(1)
  1406.  
  1407. static i, item_name[32]
  1408. for (i = 0; i < g_snipers_i; i++)
  1409. {
  1410. ArrayGetString(g_extra_sniper_name, i, item_name, charsmax(item_name))
  1411.  
  1412. if (equali(name, item_name))
  1413. return i;
  1414. }
  1415.  
  1416. return -1;
  1417. }
  1418.  
  1419. public native_get_launcher_id(const name[])
  1420. {
  1421. param_convert(1)
  1422.  
  1423. static i, item_name[32]
  1424. for (i = 0; i < g_launchers_i; i++)
  1425. {
  1426. ArrayGetString(g_launchername, i, item_name, charsmax(item_name))
  1427.  
  1428. if (equali(name, item_name))
  1429. return i;
  1430. }
  1431.  
  1432. return -1;
  1433. }
  1434.  
  1435. public native_register_gun(const name[], cost)
  1436. {
  1437. if (!g_arrays_created)
  1438. return -1;
  1439.  
  1440. param_convert(1)
  1441.  
  1442. ArrayPushString(g_extra_gun_name, name)
  1443. ArrayPushCell(g_extra_gun_cost, cost)
  1444.  
  1445. ArrayPushCell(g_extra_gun_new, 1)
  1446.  
  1447. new i, buffer[32], size = ArraySize(g_extra_gun2_realname)
  1448. for (i = 0; i < size; i++)
  1449. {
  1450. ArrayGetString(g_extra_gun2_realname, i, buffer, charsmax(buffer))
  1451.  
  1452. if (!equal(name, buffer))
  1453. continue;
  1454.  
  1455. ArraySetCell(g_extra_gun_new, g_extra_gun_i, 0)
  1456.  
  1457. ArrayGetString(g_extra_gun2_name, i, buffer, charsmax(buffer))
  1458. ArraySetString(g_extra_gun_name, g_extra_gun_i, buffer)
  1459.  
  1460. buffer[0] = ArrayGetCell(g_extra_gun2_cost, i)
  1461. ArraySetCell(g_extra_gun_cost, g_extra_gun_i, buffer[0])
  1462. }
  1463. g_extra_gun_i++
  1464.  
  1465. return g_extra_gun_i-1;
  1466. }
  1467.  
  1468. public native_register_shotgun(const name[], cost)
  1469. {
  1470. if (!g_arrays_created)
  1471. return -1;
  1472.  
  1473. param_convert(1)
  1474.  
  1475. ArrayPushString(g_extra_shotgun_name, name)
  1476. ArrayPushCell(g_extra_shotgun_cost, cost)
  1477.  
  1478. ArrayPushCell(g_extra_shotgun_new, 1)
  1479.  
  1480. new i, buffer[32], size = ArraySize(g_extra_shotgun2_realname)
  1481. for (i = 0; i < size; i++)
  1482. {
  1483. ArrayGetString(g_extra_shotgun2_realname, i, buffer, charsmax(buffer))
  1484.  
  1485. if (!equal(name, buffer))
  1486. continue;
  1487.  
  1488. ArraySetCell(g_extra_shotgun_new, g_extra_shotgun_i, 0)
  1489.  
  1490. ArrayGetString(g_extra_shotgun2_name, i, buffer, charsmax(buffer))
  1491. ArraySetString(g_extra_shotgun_name, g_extra_shotgun_i, buffer)
  1492.  
  1493. buffer[0] = ArrayGetCell(g_extra_shotgun2_cost, i)
  1494. ArraySetCell(g_extra_shotgun_cost, g_extra_shotgun_i, buffer[0])
  1495. }
  1496. g_extra_shotgun_i++
  1497.  
  1498. return g_extra_shotgun_i-1;
  1499. }
  1500.  
  1501. public native_register_smg(const name[], cost)
  1502. {
  1503. if (!g_arrays_created)
  1504. return -1;
  1505.  
  1506. param_convert(1)
  1507.  
  1508. ArrayPushString(g_extra_smg_name, name)
  1509. ArrayPushCell(g_extra_smg_cost, cost)
  1510.  
  1511. ArrayPushCell(g_extra_smg_new, 1)
  1512.  
  1513. new i, buffer[32], size = ArraySize(g_extra_smg2_realname)
  1514. for (i = 0; i < size; i++)
  1515. {
  1516. ArrayGetString(g_extra_smg2_realname, i, buffer, charsmax(buffer))
  1517.  
  1518. if (!equal(name, buffer))
  1519. continue;
  1520.  
  1521. ArraySetCell(g_extra_smg_new, g_extra_smg_i, 0)
  1522.  
  1523. ArrayGetString(g_extra_smg2_name, i, buffer, charsmax(buffer))
  1524. ArraySetString(g_extra_smg_name, g_extra_smg_i, buffer)
  1525.  
  1526. buffer[0] = ArrayGetCell(g_extra_smg2_cost, i)
  1527. ArraySetCell(g_extra_smg_cost, g_extra_smg_i, buffer[0])
  1528. }
  1529. g_extra_smg_i++
  1530. return g_extra_smg_i-1;
  1531. }
  1532.  
  1533. public native_register_rifle(const name[], cost)
  1534. {
  1535. if (!g_arrays_created)
  1536. return -1;
  1537.  
  1538. param_convert(1)
  1539.  
  1540. ArrayPushString(g_extra_rifle_name, name)
  1541. ArrayPushCell(g_extra_rifle_cost, cost)
  1542.  
  1543. ArrayPushCell(g_extra_rifle_new, 1)
  1544.  
  1545. new i, buffer[32], size = ArraySize(g_extra_rifle2_realname)
  1546. for (i = 0; i < size; i++)
  1547. {
  1548. ArrayGetString(g_extra_rifle2_realname, i, buffer, charsmax(buffer))
  1549.  
  1550. if (!equal(name, buffer))
  1551. continue;
  1552.  
  1553. ArraySetCell(g_extra_rifle_new, g_extraitem_i, 0)
  1554.  
  1555. ArrayGetString(g_extra_rifle2_name, i, buffer, charsmax(buffer))
  1556. ArraySetString(g_extra_rifle_name, g_extraitem_i, buffer)
  1557.  
  1558. buffer[0] = ArrayGetCell(g_extra_rifle2_cost, i)
  1559. ArraySetCell(g_extra_rifle_cost, g_extraitem_i, buffer[0])
  1560. }
  1561. g_extraitem_i++
  1562.  
  1563. return g_extraitem_i-1;
  1564. }
  1565.  
  1566. public native_register_sniper(const name[], cost)
  1567. {
  1568. if (!g_arrays_created)
  1569. return -1;
  1570.  
  1571. param_convert(1)
  1572.  
  1573. ArrayPushString(g_extra_sniper_name, name)
  1574. ArrayPushCell(g_extra_sniper_cost, cost)
  1575.  
  1576. ArrayPushCell(g_extra_sniper_new, 1)
  1577.  
  1578. new i, buffer[32], size = ArraySize(g_extra_sniper2_realname)
  1579. for (i = 0; i < size; i++)
  1580. {
  1581. ArrayGetString(g_extra_sniper2_realname, i, buffer, charsmax(buffer))
  1582.  
  1583. if (!equal(name, buffer))
  1584. continue;
  1585.  
  1586. ArraySetCell(g_extra_sniper_new, g_snipers_i, 0)
  1587.  
  1588. ArrayGetString(g_extra_sniper2_name, i, buffer, charsmax(buffer))
  1589. ArraySetString(g_extra_sniper_name, g_snipers_i, buffer)
  1590.  
  1591. buffer[0] = ArrayGetCell(g_extra_sniper2_cost, i)
  1592. ArraySetCell(g_extra_sniper_cost, g_snipers_i, buffer[0])
  1593. }
  1594. g_snipers_i++
  1595.  
  1596. return g_snipers_i-1;
  1597. }
  1598.  
  1599. public native_register_launcher(const name[], cost)
  1600. {
  1601. if (!g_arrays_created)
  1602. return -1;
  1603.  
  1604. param_convert(1)
  1605.  
  1606. ArrayPushString(g_launchername, name)
  1607. ArrayPushCell(g_launchercost, cost)
  1608.  
  1609. ArrayPushCell(g_extra_launcher_new, 1)
  1610.  
  1611. new i, buffer[32], size = ArraySize(g_launcher_realname)
  1612. for (i = 0; i < size; i++)
  1613. {
  1614. ArrayGetString(g_launcher_realname, i, buffer, charsmax(buffer))
  1615.  
  1616. if (!equal(name, buffer))
  1617. continue;
  1618.  
  1619. ArraySetCell(g_extra_launcher_new, g_launchers_i, 0)
  1620.  
  1621. ArrayGetString(g_launcher2name, i, buffer, charsmax(buffer))
  1622. ArraySetString(g_launchername, g_launchers_i, buffer)
  1623.  
  1624. buffer[0] = ArrayGetCell(g_launcher2cost, i)
  1625. ArraySetCell(g_launchercost, g_launchers_i, buffer[0])
  1626. }
  1627.  
  1628. g_launchers_i++
  1629.  
  1630. return g_launchers_i-1;
  1631. }
  1632.  
  1633. stock GetUserCash(id)
  1634. {
  1635. if (!is_user_connected(id))
  1636. {
  1637. log_error(AMX_ERR_NATIVE, "Invalid player (%d)", id)
  1638. return -1;
  1639. }
  1640.  
  1641. return cs_get_user_money(id)
  1642. }
  1643.  
  1644. stock SetUserCash(id, cash)
  1645. {
  1646. cs_set_user_money(id, cash)
  1647. }
  1648.  
  1649. stock fm_find_ent_by_owner(entity, const classname[], owner)
  1650. {
  1651. while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) { /* keep looping */ }
  1652. return entity;
  1653. }
  1654.  
  1655. stock fm_give_item(id, const item[])
  1656. {
  1657. static ent
  1658. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
  1659. if (!pev_valid(ent)) return;
  1660.  
  1661. static Float:originF[3]
  1662. pev(id, pev_origin, originF)
  1663. set_pev(ent, pev_origin, originF)
  1664. set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
  1665. dllfunc(DLLFunc_Spawn, ent)
  1666.  
  1667. static save
  1668. save = pev(ent, pev_solid)
  1669. dllfunc(DLLFunc_Touch, ent, id)
  1670. if (pev(ent, pev_solid) != save)
  1671. return;
  1672.  
  1673. engfunc(EngFunc_RemoveEntity, ent)
  1674. }
  1675.  
  1676. stock cs_weapon_name_to_id(const weapon[])
  1677. {
  1678. static i
  1679. for (i = 0; i < sizeof WEAPONENTNAMES; i++)
  1680. {
  1681. if (equal(weapon, WEAPONENTNAMES[i]))
  1682. return i;
  1683. }
  1684.  
  1685. return 0;
  1686. }
  1687.  
  1688. stock drop_weapons(id, dropwhat)
  1689. {
  1690. static weapons[32], num, i, weaponid
  1691. num = 0
  1692. get_user_weapons(id, weapons, num)
  1693. for (i = 0; i < num; i++)
  1694. {
  1695. weaponid = weapons[i]
  1696.  
  1697. if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
  1698. {
  1699. static wname[32], weapon_ent
  1700. get_weaponname(weaponid, wname, charsmax(wname))
  1701. weapon_ent = fm_find_ent_by_owner(-1, wname, id)
  1702. set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))
  1703. engclient_cmd(id, "drop", wname)
  1704. cs_set_user_bpammo(id, weaponid, 0)
  1705. }
  1706. }
  1707. }
Advertisement
Add Comment
Please, Sign In to add comment