Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #include <hamsandwich>
- #include <cstrike>
- #include <fakemeta>
- new const LAUNCHERS_FILE[] = "launchers.ini"
- new const SNIPERS_FILE[] = "snipers.ini"
- new const RIFLES_FILE[] = "rifles.ini"
- new const SMGS_FILE[] = "smgs.ini"
- new const SHOTGUNS_FILE[] = "shotguns.ini"
- new const GUNS_FILE[] = "guns.ini"
- new g_launcher_selected, g_sniper_selected, g_rifle_selected, g_smg_selected, g_shotgun_selected, g_gun_selected
- new g_fwDummyResult
- const I_PLUGIN_HANDLED = 97
- const PEV_ADDITIONAL_AMMO = pev_iuser1
- new const EXTRA_LAUNCHERS_STARTID = 0, EXTRA_SNIPERS_STARTID = 0, EXTRA_RIFLES_STARTID = 0,
- EXTRA_SMG_STARTID = 0, EXTRA_SHOTGUNS_STARTID = 0, EXTRA_GUNS_STARTID = 0
- new Array:g_launchername,Array:g_launchercost, Array:g_extra_sniper_name, Array:g_extra_sniper_cost,
- Array:g_extra_rifle_name, Array:g_extra_rifle_cost, Array:g_extra_smg_name, Array:g_extra_smg_cost,
- Array:g_extra_shotgun_name, Array:g_extra_shotgun_cost, Array:g_extra_gun_name, Array:g_extra_gun_cost
- new g_launchers_i, g_snipers_i, g_extraitem_i, g_extra_smg_i, g_extra_shotgun_i, g_extra_gun_i
- new bool:g_arrays_created
- new Array:g_launcher_realname, Array:g_launcher2name, Array:g_launcher2cost,
- Array:g_extra_launcher_new, Array:g_launcher_names, Array:g_extra_launcher_items,
- Array:g_extra_sniper2_realname, Array:g_extra_sniper2_name, Array:g_extra_sniper2_cost,
- Array:g_extra_sniper_new, Array:g_extra_sniper_names, Array:g_extra_sniper_items,
- Array:g_extra_rifle2_realname, Array:g_extra_rifle2_name, Array:g_extra_rifle2_cost,
- Array:g_extra_rifle_new, Array:g_extra_rifle_names, Array:g_extra_rifle_items,
- Array:g_extra_smg2_realname, Array:g_extra_smg2_name, Array:g_extra_smg2_cost,
- Array:g_extra_smg_new, Array:g_extra_smg_names, Array:g_extra_smg_items,
- Array:g_extra_shotgun2_realname, Array:g_extra_shotgun2_name, Array:g_extra_shotgun2_cost,
- Array:g_extra_shotgun_new, Array:g_extra_shotgun_names, Array:g_extra_shotgun_items,
- Array:g_extra_gun2_realname, Array:g_extra_gun2_name, Array:g_extra_gun2_cost,
- Array:g_extra_gun_new, Array:g_extra_gun_names, Array:g_extra_gun_items
- #define LAUNCHERS_CUSTOM_STARTID (EXTRA_LAUNCHERS_STARTID + ArraySize(g_launcher_names))
- #define SNIPERS_CUSTOM_STARTID (EXTRA_SNIPERS_STARTID + ArraySize(g_extra_sniper_names))
- #define RIFLES_CUSTOM_STARTID (EXTRA_RIFLES_STARTID + ArraySize(g_extra_rifle_names))
- #define SMGS_CUSTOM_STARTID (EXTRA_SMG_STARTID + ArraySize(g_extra_smg_names))
- #define SHOTGUNS_CUSTOM_STARTID (EXTRA_SHOTGUNS_STARTID + ArraySize(g_extra_shotgun_names))
- #define GUNS_CUSTOM_STARTID (EXTRA_GUNS_STARTID + ArraySize(g_extra_gun_names))
- new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
- 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
- new const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10,
- 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }
- new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
- "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
- "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
- new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
- "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
- "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
- "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
- "weapon_ak47", "weapon_knife", "weapon_p90" }
- 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)
- const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
- public plugin_init() {
- register_plugin("eXtreme Weapons System","1.0beta","MeRcyLeZZ | MegastorM")
- register_library("xws")
- register_clcmd("say /shop","CmdShopMenu")
- register_clcmd("say /menu","CmdShopMenu")
- register_clcmd("say /items","CmdShopMenu")
- g_launcher_selected = CreateMultiForward("xws_launcher_selected", ET_CONTINUE, FP_CELL, FP_CELL)
- g_sniper_selected = CreateMultiForward("xws_sniper_selected", ET_CONTINUE, FP_CELL, FP_CELL)
- g_rifle_selected = CreateMultiForward("xws_rifle_selected", ET_CONTINUE, FP_CELL, FP_CELL)
- g_smg_selected = CreateMultiForward("xws_smg_selected", ET_CONTINUE, FP_CELL, FP_CELL)
- g_shotgun_selected = CreateMultiForward("xws_shotgun_selected", ET_CONTINUE, FP_CELL, FP_CELL)
- g_gun_selected = CreateMultiForward("xws_gun_selected", ET_CONTINUE, FP_CELL, FP_CELL)
- // Add your code here...
- }
- public CmdShopMenu(id)
- {
- if(!is_user_alive(id))
- return PLUGIN_HANDLED
- new menu = menu_create("Select option:","MainMenu_H")
- menu_additem(menu,"Guns")
- menu_additem(menu,"Shotguns")
- menu_additem(menu,"SMGs")
- menu_additem(menu,"Rifles")
- menu_additem(menu,"Snipers")
- menu_additem(menu,"Launchers")
- menu_setprop(menu, MPROP_EXITNAME, "Izadji")
- menu_display(id, menu)
- return PLUGIN_CONTINUE
- }
- public MainMenu_H(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_CONTINUE
- }
- switch(item)
- {
- case 0: show_menu_guns(id);
- case 1: show_menu_shotguns(id);
- case 2: show_extra_smgs(id);
- case 3: show_extra_rifles(id);
- case 4: show_extra_snipers(id);
- case 5: show_extra_launchers(id);
- }
- return PLUGIN_CONTINUE
- }
- public plugin_natives()
- {
- register_native("xws_register_launcher", "native_register_launcher", 1)
- register_native("xws_give_launcher", "native_force_give_launcher", 1)
- register_native("xws_get_launcher_id", "native_get_launcher_id", 1)
- register_native("xws_launchers_menu", "show_extra_launchers", 1)
- register_native("xws_register_sniper", "native_register_sniper", 1)
- register_native("xws_give_sniper", "native_force_give_sniper", 1)
- register_native("xws_get_sniper_id", "native_get_sniper_id", 1)
- register_native("xws_snipers_menu", "show_extra_snipers", 1)
- register_native("xws_register_rifle", "native_register_rifle", 1)
- register_native("xws_give_rifle", "native_force_give_rifle", 1)
- register_native("xws_get_rifle_id", "native_get_rifle_id", 1)
- register_native("xws_rifles_menu", "show_extra_rifles", 1)
- register_native("xws_register_smg", "native_register_smg", 1)
- register_native("xws_give_smg", "native_force_give_smg", 1)
- register_native("xws_get_smg_id", "native_get_smg_id", 1)
- register_native("xws_smgs_menu", "show_extra_smgs", 1)
- register_native("xws_register_shotgun", "native_register_shotgun", 1)
- register_native("xws_give_shotgun", "native_force_give_shotgun", 1)
- register_native("xws_get_shotgun_id", "native_get_shotgun_id", 1)
- register_native("xws_shotguns_menu", "show_menu_shotguns", 1)
- register_native("xws_register_gun", "native_register_gun", 1)
- register_native("xws_give_gun", "native_force_give_gun", 1)
- register_native("xws_get_gun_id", "native_get_gun_id", 1)
- register_native("xws_guns_menu", "show_menu_guns", 1)
- }
- public plugin_precache()
- {
- g_launcher_names = ArrayCreate(32, 1)
- g_extra_launcher_items = ArrayCreate(32, 1)
- g_launchername = ArrayCreate(32, 1)
- g_launchercost = ArrayCreate(1, 1)
- g_launcher_realname = ArrayCreate(32, 1)
- g_launcher2name = ArrayCreate(32, 1)
- g_launcher2cost = ArrayCreate(1, 1)
- g_extra_launcher_new = ArrayCreate(1, 1)
- g_extra_sniper_names = ArrayCreate(32, 1)
- g_extra_sniper_items = ArrayCreate(32, 1)
- g_extra_sniper_name = ArrayCreate(32, 1)
- g_extra_sniper_cost = ArrayCreate(1, 1)
- g_extra_sniper2_realname = ArrayCreate(32, 1)
- g_extra_sniper2_name = ArrayCreate(32, 1)
- g_extra_sniper2_cost = ArrayCreate(1, 1)
- g_extra_sniper_new = ArrayCreate(1, 1)
- g_extra_rifle_names = ArrayCreate(32, 1)
- g_extra_rifle_items = ArrayCreate(32, 1)
- g_extra_rifle_name = ArrayCreate(32, 1)
- g_extra_rifle_cost = ArrayCreate(1, 1)
- g_extra_rifle2_realname = ArrayCreate(32, 1)
- g_extra_rifle2_name = ArrayCreate(32, 1)
- g_extra_rifle2_cost = ArrayCreate(1, 1)
- g_extra_rifle_new = ArrayCreate(1, 1)
- g_extra_smg_names = ArrayCreate(32, 1)
- g_extra_smg_items = ArrayCreate(32, 1)
- g_extra_smg_name = ArrayCreate(32, 1)
- g_extra_smg_cost = ArrayCreate(1, 1)
- g_extra_smg2_realname = ArrayCreate(32, 1)
- g_extra_smg2_name = ArrayCreate(32, 1)
- g_extra_smg2_cost = ArrayCreate(1, 1)
- g_extra_smg_new = ArrayCreate(1, 1)
- g_extra_shotgun_names = ArrayCreate(32, 1)
- g_extra_shotgun_items = ArrayCreate(32, 1)
- g_extra_shotgun_name = ArrayCreate(32, 1)
- g_extra_shotgun_cost = ArrayCreate(1, 1)
- g_extra_shotgun2_realname = ArrayCreate(32, 1)
- g_extra_shotgun2_name = ArrayCreate(32, 1)
- g_extra_shotgun2_cost = ArrayCreate(1, 1)
- g_extra_shotgun_new = ArrayCreate(1, 1)
- g_extra_gun_names = ArrayCreate(32, 1)
- g_extra_gun_items = ArrayCreate(32, 1)
- g_extra_gun_name = ArrayCreate(32, 1)
- g_extra_gun_cost = ArrayCreate(1, 1)
- g_extra_gun2_realname = ArrayCreate(32, 1)
- g_extra_gun2_name = ArrayCreate(32, 1)
- g_extra_gun2_cost = ArrayCreate(1, 1)
- g_extra_gun_new = ArrayCreate(1, 1)
- g_arrays_created = true
- load_customization()
- }
- public plugin_cfg()
- {
- g_arrays_created = false
- save_customization()
- }
- load_customization()
- {
- new path1[64], path2[64], path3[64], path4[64] , path5[64], path6[64]
- get_configsdir(path1, charsmax(path1))
- get_configsdir(path2, charsmax(path2))
- get_configsdir(path3, charsmax(path3))
- get_configsdir(path4, charsmax(path4))
- get_configsdir(path5, charsmax(path5))
- get_configsdir(path6, charsmax(path6))
- format(path1, charsmax(path1), "%s/xws/%s", path1, LAUNCHERS_FILE)
- format(path2, charsmax(path2), "%s/xws/%s", path2, SNIPERS_FILE)
- format(path3, charsmax(path3), "%s/xws/%s", path3, RIFLES_FILE)
- format(path4, charsmax(path4), "%s/xws/%s", path4, SMGS_FILE)
- format(path5, charsmax(path5), "%s/xws/%s", path5, SHOTGUNS_FILE)
- format(path6, charsmax(path6), "%s/xws/%s", path6, GUNS_FILE)
- new file
- new linedata[1024], key[64], value[960]
- if (file_exists(path1))
- {
- file = fopen(path1, "rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, charsmax(linedata))
- replace(linedata, charsmax(linedata), "^n", "")
- if (!linedata[0] || linedata[0] == ';') continue;
- if (linedata[0] == '[')
- {
- linedata[strlen(linedata) - 1] = 0
- copy(linedata, charsmax(linedata), linedata[1])
- ArrayPushString(g_launcher_realname, linedata)
- continue;
- }
- strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
- trim(key)
- trim(value)
- if (equal(key, "NAME"))
- ArrayPushString(g_launcher2name, value)
- else if (equal(key, "COST"))
- ArrayPushCell(g_launcher2cost, str_to_num(value))
- }
- if (file) fclose(file)
- }
- if (file_exists(path2))
- {
- file = fopen(path2, "rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, charsmax(linedata))
- replace(linedata, charsmax(linedata), "^n", "")
- if (!linedata[0] || linedata[0] == ';') continue;
- if (linedata[0] == '[')
- {
- linedata[strlen(linedata) - 1] = 0
- copy(linedata, charsmax(linedata), linedata[1])
- ArrayPushString(g_extra_sniper2_realname, linedata)
- continue;
- }
- strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
- trim(key)
- trim(value)
- if (equal(key, "NAME"))
- ArrayPushString(g_extra_sniper2_name, value)
- else if (equal(key, "COST"))
- ArrayPushCell(g_extra_sniper2_cost, str_to_num(value))
- }
- if (file) fclose(file)
- }
- if (file_exists(path3))
- {
- file = fopen(path3, "rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, charsmax(linedata))
- replace(linedata, charsmax(linedata), "^n", "")
- if (!linedata[0] || linedata[0] == ';') continue;
- if (linedata[0] == '[')
- {
- linedata[strlen(linedata) - 1] = 0
- copy(linedata, charsmax(linedata), linedata[1])
- ArrayPushString(g_extra_rifle2_realname, linedata)
- continue;
- }
- strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
- trim(key)
- trim(value)
- if (equal(key, "NAME"))
- ArrayPushString(g_extra_rifle2_name, value)
- else if (equal(key, "COST"))
- ArrayPushCell(g_extra_rifle2_cost, str_to_num(value))
- }
- if (file) fclose(file)
- }
- if (file_exists(path4))
- {
- file = fopen(path4, "rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, charsmax(linedata))
- replace(linedata, charsmax(linedata), "^n", "")
- if (!linedata[0] || linedata[0] == ';') continue;
- if (linedata[0] == '[')
- {
- linedata[strlen(linedata) - 1] = 0
- copy(linedata, charsmax(linedata), linedata[1])
- ArrayPushString(g_extra_smg2_realname, linedata)
- continue;
- }
- strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
- trim(key)
- trim(value)
- if (equal(key, "NAME"))
- ArrayPushString(g_extra_smg2_name, value)
- else if (equal(key, "COST"))
- ArrayPushCell(g_extra_smg2_cost, str_to_num(value))
- }
- if (file) fclose(file)
- }
- if (file_exists(path5))
- {
- file = fopen(path5, "rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, charsmax(linedata))
- replace(linedata, charsmax(linedata), "^n", "")
- if (!linedata[0] || linedata[0] == ';') continue;
- if (linedata[0] == '[')
- {
- linedata[strlen(linedata) - 1] = 0
- copy(linedata, charsmax(linedata), linedata[1])
- ArrayPushString(g_extra_shotgun2_realname, linedata)
- continue;
- }
- strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
- trim(key)
- trim(value)
- if (equal(key, "NAME"))
- ArrayPushString(g_extra_shotgun2_name, value)
- else if (equal(key, "COST"))
- ArrayPushCell(g_extra_shotgun2_cost, str_to_num(value))
- }
- if (file) fclose(file)
- }
- if (file_exists(path6))
- {
- file = fopen(path6, "rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, charsmax(linedata))
- replace(linedata, charsmax(linedata), "^n", "")
- if (!linedata[0] || linedata[0] == ';') continue;
- if (linedata[0] == '[')
- {
- linedata[strlen(linedata) - 1] = 0
- copy(linedata, charsmax(linedata), linedata[1])
- ArrayPushString(g_extra_gun2_realname, linedata)
- continue;
- }
- strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
- trim(key)
- trim(value)
- if (equal(key, "NAME"))
- ArrayPushString(g_extra_gun2_name, value)
- else if (equal(key, "COST"))
- ArrayPushCell(g_extra_gun2_cost, str_to_num(value))
- }
- if (file) fclose(file)
- }
- }
- save_customization()
- {
- new i,buffer[512]
- new path1[64], path2[64], path3[64], path4[64] , path5[64], path6[64]
- get_configsdir(path1, charsmax(path1))
- get_configsdir(path2, charsmax(path2))
- get_configsdir(path3, charsmax(path3))
- get_configsdir(path4, charsmax(path4))
- get_configsdir(path5, charsmax(path5))
- get_configsdir(path6, charsmax(path6))
- format(path1, charsmax(path1), "%s/xws/%s", path1, LAUNCHERS_FILE)
- format(path2, charsmax(path2), "%s/xws/%s", path2, SNIPERS_FILE)
- format(path3, charsmax(path3), "%s/xws/%s", path3, RIFLES_FILE)
- format(path4, charsmax(path4), "%s/xws/%s", path4, SMGS_FILE)
- format(path5, charsmax(path5), "%s/xws/%s", path5, SHOTGUNS_FILE)
- format(path6, charsmax(path6), "%s/xws/%s", path6, GUNS_FILE)
- new file
- new size
- file = fopen(path1, "at")
- size = ArraySize(g_launchername)
- for (i = LAUNCHERS_CUSTOM_STARTID; i < size; i++)
- {
- if (ArrayGetCell(g_extra_launcher_new, i))
- {
- ArrayGetString(g_launchername, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^n[%s]", buffer)
- fputs(file, buffer)
- ArrayGetString(g_launchername, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
- fputs(file, buffer)
- formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_launchercost, i))
- fputs(file, buffer)
- }
- }
- fclose(file)
- ArrayDestroy(g_launcher_realname)
- ArrayDestroy(g_launcher2name)
- ArrayDestroy(g_launcher2cost)
- ArrayDestroy(g_extra_launcher_new)
- file = fopen(path2, "at")
- size = ArraySize(g_extra_sniper_name)
- for (i = SNIPERS_CUSTOM_STARTID; i < size; i++)
- {
- if (ArrayGetCell(g_extra_sniper_new, i))
- {
- ArrayGetString(g_extra_sniper_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^n[%s]", buffer)
- fputs(file, buffer)
- ArrayGetString(g_extra_sniper_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
- fputs(file, buffer)
- formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_sniper_cost, i))
- fputs(file, buffer)
- }
- }
- fclose(file)
- ArrayDestroy(g_extra_sniper2_realname)
- ArrayDestroy(g_extra_sniper2_name)
- ArrayDestroy(g_extra_sniper2_cost)
- ArrayDestroy(g_extra_sniper_new)
- file = fopen(path3, "at")
- size = ArraySize(g_extra_rifle_name)
- for (i = RIFLES_CUSTOM_STARTID; i < size; i++)
- {
- if (ArrayGetCell(g_extra_rifle_new, i))
- {
- ArrayGetString(g_extra_rifle_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^n[%s]", buffer)
- fputs(file, buffer)
- ArrayGetString(g_extra_rifle_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
- fputs(file, buffer)
- formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_rifle_cost, i))
- fputs(file, buffer)
- }
- }
- fclose(file)
- ArrayDestroy(g_extra_rifle2_realname)
- ArrayDestroy(g_extra_rifle2_name)
- ArrayDestroy(g_extra_rifle2_cost)
- ArrayDestroy(g_extra_rifle_new)
- file = fopen(path4, "at")
- size = ArraySize(g_extra_smg_name)
- for (i = SMGS_CUSTOM_STARTID; i < size; i++)
- {
- if (ArrayGetCell(g_extra_smg_new, i))
- {
- ArrayGetString(g_extra_smg_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^n[%s]", buffer)
- fputs(file, buffer)
- ArrayGetString(g_extra_smg_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
- fputs(file, buffer)
- formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_smg_cost, i))
- fputs(file, buffer)
- }
- }
- fclose(file)
- ArrayDestroy(g_extra_smg2_realname)
- ArrayDestroy(g_extra_smg2_name)
- ArrayDestroy(g_extra_smg2_cost)
- ArrayDestroy(g_extra_smg_new)
- file = fopen(path5, "at")
- size = ArraySize(g_extra_shotgun_name)
- for (i = SHOTGUNS_CUSTOM_STARTID; i < size; i++)
- {
- if (ArrayGetCell(g_extra_shotgun_new, i))
- {
- ArrayGetString(g_extra_shotgun_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^n[%s]", buffer)
- fputs(file, buffer)
- ArrayGetString(g_extra_shotgun_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
- fputs(file, buffer)
- formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_shotgun_cost, i))
- fputs(file, buffer)
- }
- }
- fclose(file)
- ArrayDestroy(g_extra_shotgun2_realname)
- ArrayDestroy(g_extra_shotgun2_name)
- ArrayDestroy(g_extra_shotgun2_cost)
- ArrayDestroy(g_extra_shotgun_new)
- file = fopen(path6, "at")
- size = ArraySize(g_extra_gun_name)
- for (i = GUNS_CUSTOM_STARTID; i < size; i++)
- {
- if (ArrayGetCell(g_extra_gun_new, i))
- {
- ArrayGetString(g_extra_gun_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^n[%s]", buffer)
- fputs(file, buffer)
- ArrayGetString(g_extra_gun_name, i, buffer, charsmax(buffer))
- format(buffer, charsmax(buffer), "^nNAME = %s", buffer)
- fputs(file, buffer)
- formatex(buffer, charsmax(buffer), "^nCOST = %d", ArrayGetCell(g_extra_gun_cost, i))
- fputs(file, buffer)
- }
- }
- fclose(file)
- ArrayDestroy(g_extra_gun2_realname)
- ArrayDestroy(g_extra_gun2_name)
- ArrayDestroy(g_extra_gun2_cost)
- ArrayDestroy(g_extra_gun_new)
- }
- public show_menu_guns(id)
- {
- static menuid, menu[128], item, buffer[32]
- formatex(menu, charsmax(menu), "Izaberi extra item:")
- menuid = menu_create(menu, "menu_guns_H")
- for (item = 0; item < g_extra_gun_i; item++)
- {
- switch (item)
- {
- default:
- {
- if (item >= EXTRA_GUNS_STARTID && item <= GUNS_CUSTOM_STARTID-1) continue;
- ArrayGetString(g_extra_gun_name, item, buffer, charsmax(buffer))
- }
- }
- formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_gun_cost, item))
- buffer[0] = item
- buffer[1] = 0
- menu_additem(menuid, menu, buffer)
- }
- if (menu_items(menuid) <= 0)
- {
- client_print(id, print_chat, "NEMA,STA GLEDAS??")
- menu_destroy(menuid)
- return;
- }
- formatex(menu, charsmax(menu), "Nazad")
- menu_setprop(menuid, MPROP_BACKNAME, menu)
- formatex(menu, charsmax(menu), "Napred")
- menu_setprop(menuid, MPROP_NEXTNAME, menu)
- formatex(menu, charsmax(menu), "Exit")
- menu_setprop(menuid, MPROP_EXITNAME, menu)
- menu_display(id, menuid)
- }
- public menu_guns_H(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(id))
- {
- client_print(id,print_chat, "You are dead!")
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- static buffer[2], dummy, itemid
- menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
- itemid = buffer[0]
- buy_extra_gun(id, itemid)
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- public show_menu_shotguns(id)
- {
- static menuid, menu[128], item, buffer[32]
- formatex(menu, charsmax(menu), "Izaberi extra item:")
- menuid = menu_create(menu, "menu_shotguns_H")
- for (item = 0; item < g_extra_shotgun_i; item++)
- {
- switch (item)
- {
- default:
- {
- if (item >= EXTRA_SHOTGUNS_STARTID && item <= SHOTGUNS_CUSTOM_STARTID-1) continue;
- ArrayGetString(g_extra_shotgun_name, item, buffer, charsmax(buffer))
- }
- }
- formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_shotgun_cost, item))
- buffer[0] = item
- buffer[1] = 0
- menu_additem(menuid, menu, buffer)
- }
- if (menu_items(menuid) <= 0)
- {
- client_print(id, print_chat, "NEMA,STA GLEDAS??")
- menu_destroy(menuid)
- return;
- }
- formatex(menu, charsmax(menu), "Nazad")
- menu_setprop(menuid, MPROP_BACKNAME, menu)
- formatex(menu, charsmax(menu), "Napred")
- menu_setprop(menuid, MPROP_NEXTNAME, menu)
- formatex(menu, charsmax(menu), "Exit")
- menu_setprop(menuid, MPROP_EXITNAME, menu)
- menu_display(id, menuid)
- }
- public menu_shotguns_H(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(id))
- {
- client_print(id,print_chat, "You are dead!")
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- static buffer[2], dummy, itemid
- menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
- itemid = buffer[0]
- buy_extra_shotgun(id, itemid)
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- public show_extra_smgs(id)
- {
- static menuid, menu[128], item, buffer[32]
- formatex(menu, charsmax(menu), "Izaberi extra item:")
- menuid = menu_create(menu, "menu_smgs_H")
- // Item List
- for (item = 0; item < g_extra_smg_i; item++)
- {
- switch (item)
- {
- default:
- {
- if (item >= EXTRA_SMG_STARTID && item <= SMGS_CUSTOM_STARTID-1) continue;
- ArrayGetString(g_extra_smg_name, item, buffer, charsmax(buffer))
- }
- }
- formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_smg_cost, item))
- buffer[0] = item
- buffer[1] = 0
- menu_additem(menuid, menu, buffer)
- }
- if (menu_items(menuid) <= 0)
- {
- client_print(id, print_chat, "NEMA,STA GLEDAS??")
- menu_destroy(menuid)
- return;
- }
- formatex(menu, charsmax(menu), "Nazad")
- menu_setprop(menuid, MPROP_BACKNAME, menu)
- formatex(menu, charsmax(menu), "Napred")
- menu_setprop(menuid, MPROP_NEXTNAME, menu)
- formatex(menu, charsmax(menu), "Exit")
- menu_setprop(menuid, MPROP_EXITNAME, menu)
- menu_display(id, menuid)
- }
- public menu_smgs_H(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(id))
- {
- client_print(id,print_chat, "You are dead!")
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- static buffer[2], dummy, itemid
- menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
- itemid = buffer[0]
- buy_extra_smg(id, itemid)
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- public show_extra_rifles(id)
- {
- static menuid, menu[128], item, buffer[32]
- formatex(menu, charsmax(menu), "Izaberi extra item:")
- menuid = menu_create(menu, "menu_rifles_H")
- for (item = 0; item < g_extraitem_i; item++)
- {
- switch (item)
- {
- default:
- {
- if (item >= EXTRA_RIFLES_STARTID && item <= RIFLES_CUSTOM_STARTID-1) continue;
- ArrayGetString(g_extra_rifle_name, item, buffer, charsmax(buffer))
- }
- }
- formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_rifle_cost, item))
- buffer[0] = item
- buffer[1] = 0
- menu_additem(menuid, menu, buffer)
- }
- if (menu_items(menuid) <= 0)
- {
- client_print(id, print_chat, "NEMA,STA GLEDAS??")
- menu_destroy(menuid)
- return;
- }
- formatex(menu, charsmax(menu), "Nazad")
- menu_setprop(menuid, MPROP_BACKNAME, menu)
- formatex(menu, charsmax(menu), "Napred")
- menu_setprop(menuid, MPROP_NEXTNAME, menu)
- formatex(menu, charsmax(menu), "Exit")
- menu_setprop(menuid, MPROP_EXITNAME, menu)
- menu_display(id, menuid)
- }
- public menu_rifles_H(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(id))
- {
- client_print(id,print_chat, "You are dead!")
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- static buffer[2], dummy, itemid
- menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
- itemid = buffer[0]
- buy_extra_rifle(id, itemid)
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- public show_extra_snipers(id)
- {
- static menuid, menu[128], item, buffer[32]
- formatex(menu, charsmax(menu), "Izaberi extra item:")
- menuid = menu_create(menu, "snipers_menu_H")
- // Item List
- for (item = 0; item < g_snipers_i; item++)
- {
- switch (item)
- {
- default:
- {
- if (item >= EXTRA_SNIPERS_STARTID && item <= SNIPERS_CUSTOM_STARTID-1) continue;
- ArrayGetString(g_extra_sniper_name, item, buffer, charsmax(buffer))
- }
- }
- formatex(menu, charsmax(menu), "%s \y%d CP", buffer, ArrayGetCell(g_extra_sniper_cost, item))
- buffer[0] = item
- buffer[1] = 0
- menu_additem(menuid, menu, buffer)
- }
- if (menu_items(menuid) <= 0)
- {
- client_print(id, print_chat, "No items loaded!")
- menu_destroy(menuid)
- return;
- }
- formatex(menu, charsmax(menu), "Nazad")
- menu_setprop(menuid, MPROP_BACKNAME, menu)
- formatex(menu, charsmax(menu), "Napred")
- menu_setprop(menuid, MPROP_NEXTNAME, menu)
- formatex(menu, charsmax(menu), "Exit")
- menu_setprop(menuid, MPROP_EXITNAME, menu)
- menu_display(id, menuid)
- }
- public snipers_menu_H(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(id))
- {
- client_print(id,print_chat, "You are dead!")
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- static buffer[2], dummy, itemid
- menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
- itemid = buffer[0]
- buy_extra_sniper(id, itemid)
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- public show_extra_launchers(id)
- {
- static menuid, menu[128], item, buffer[32]
- formatex(menu, charsmax(menu), "Izaberi extra item:")
- menuid = menu_create(menu, "extra_launchers_handle")
- for (item = 0; item < g_launchers_i; item++)
- {
- switch (item)
- {
- default:
- {
- if (item >= EXTRA_LAUNCHERS_STARTID && item <= LAUNCHERS_CUSTOM_STARTID-1) continue;
- ArrayGetString(g_launchername, item, buffer, charsmax(buffer))
- }
- }
- formatex(menu, charsmax(menu), "%s \y%d$", buffer, ArrayGetCell(g_launchercost, item))
- buffer[0] = item
- buffer[1] = 0
- menu_additem(menuid, menu, buffer)
- }
- if (menu_items(menuid) <= 0)
- {
- client_print(id, print_chat, "No extra items loaded!")
- menu_destroy(menuid)
- return;
- }
- formatex(menu, charsmax(menu), "Nazad")
- menu_setprop(menuid, MPROP_BACKNAME, menu)
- formatex(menu, charsmax(menu), "Napred")
- menu_setprop(menuid, MPROP_NEXTNAME, menu)
- formatex(menu, charsmax(menu), "Exit")
- menu_setprop(menuid, MPROP_EXITNAME, menu)
- menu_display(id, menuid)
- }
- public extra_launchers_handle(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(id))
- {
- client_print(id,print_chat, "You are dead!")
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- static buffer[2], dummy, itemid
- menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
- itemid = buffer[0]
- buy_extra_launcher(id, itemid)
- menu_destroy(menuid)
- return PLUGIN_HANDLED;
- }
- buy_extra_gun(id, itemid, bool:ignorecost = false)
- {
- if ((itemid >= EXTRA_GUNS_STARTID && itemid <= GUNS_CUSTOM_STARTID-1))
- {
- client_print(id,print_chat, "Nema!")
- return;
- }
- if (!ignorecost)
- {
- if (GetUserCash(id)< ArrayGetCell(g_extra_gun_cost, itemid))
- {
- client_print(id, print_chat, "Fali ti batice mozga!")
- return;
- }
- SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_gun_cost, itemid))
- }
- switch (itemid)
- {
- default:
- {
- if (itemid >= EXTRA_GUNS_STARTID && itemid <= GUNS_CUSTOM_STARTID-1)
- {
- static weaponid, wname[32]
- ArrayGetString(g_extra_gun_items, itemid - EXTRA_GUNS_STARTID, wname, charsmax(wname))
- weaponid = cs_weapon_name_to_id(wname)
- if (MAXBPAMMO[weaponid] > 2)
- {
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
- }
- else if (user_has_weapon(id, weaponid))
- {
- cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
- write_byte(AMMOID[weaponid])
- write_byte(1)
- message_end()
- return;
- }
- fm_give_item(id, wname)
- }
- else
- {
- ExecuteForward(g_gun_selected, g_fwDummyResult, id, itemid);
- if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
- SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_gun_cost, itemid))
- }
- }
- }
- }
- buy_extra_shotgun(id, itemid, bool:ignorecost = false)
- {
- if ((itemid >= EXTRA_SHOTGUNS_STARTID && itemid <= SHOTGUNS_CUSTOM_STARTID-1))
- {
- client_print(id,print_chat, "Nema!")
- return;
- }
- if (!ignorecost)
- {
- if (GetUserCash(id)< ArrayGetCell(g_extra_shotgun_cost, itemid))
- {
- client_print(id, print_chat, "Fali ti batice mozga!")
- return;
- }
- SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_shotgun_cost, itemid))
- }
- switch (itemid)
- {
- default:
- {
- if (itemid >= EXTRA_SHOTGUNS_STARTID && itemid <= SHOTGUNS_CUSTOM_STARTID-1)
- {
- static weaponid, wname[32]
- ArrayGetString(g_extra_shotgun_items, itemid - EXTRA_SHOTGUNS_STARTID, wname, charsmax(wname))
- weaponid = cs_weapon_name_to_id(wname)
- if (MAXBPAMMO[weaponid] > 2)
- {
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
- }
- else if (user_has_weapon(id, weaponid))
- {
- cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
- write_byte(AMMOID[weaponid])
- write_byte(1)
- message_end()
- return;
- }
- fm_give_item(id, wname)
- }
- else
- {
- ExecuteForward(g_shotgun_selected, g_fwDummyResult, id, itemid);
- if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
- SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_shotgun_cost, itemid))
- }
- }
- }
- }
- buy_extra_smg(id, itemid, bool:ignorecost = false)
- {
- if ((itemid >= EXTRA_SMG_STARTID && itemid <= SMGS_CUSTOM_STARTID-1))
- {
- client_print(id,print_chat, "Nema!")
- return;
- }
- if (!ignorecost)
- {
- if (GetUserCash(id)< ArrayGetCell(g_extra_smg_cost, itemid))
- {
- client_print(id, print_chat, "Fali ti batice mozga!")
- return;
- }
- SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_smg_cost, itemid))
- }
- switch (itemid)
- {
- default:
- {
- if (itemid >= EXTRA_SMG_STARTID && itemid <= SMGS_CUSTOM_STARTID-1)
- {
- static weaponid, wname[32]
- ArrayGetString(g_extra_smg_items, itemid - EXTRA_SMG_STARTID, wname, charsmax(wname))
- weaponid = cs_weapon_name_to_id(wname)
- if (MAXBPAMMO[weaponid] > 2)
- {
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
- }
- else if (user_has_weapon(id, weaponid))
- {
- cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
- write_byte(AMMOID[weaponid])
- write_byte(1)
- message_end()
- return;
- }
- fm_give_item(id, wname)
- }
- else
- {
- ExecuteForward(g_smg_selected, g_fwDummyResult, id, itemid);
- if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
- SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_smg_cost, itemid))
- }
- }
- }
- }
- buy_extra_rifle(id, itemid, bool:ignorecost = false)
- {
- if ((itemid >= EXTRA_RIFLES_STARTID && itemid <= RIFLES_CUSTOM_STARTID-1))
- {
- client_print(id,print_chat, "Nema!")
- return;
- }
- if (!ignorecost)
- {
- if (GetUserCash(id)< ArrayGetCell(g_extra_rifle_cost, itemid))
- {
- client_print(id, print_chat, "Fali ti batice mozga!")
- return;
- }
- SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_rifle_cost, itemid))
- }
- switch (itemid)
- {
- default:
- {
- if (itemid >= EXTRA_RIFLES_STARTID && itemid <= RIFLES_CUSTOM_STARTID-1)
- {
- static weaponid, wname[32]
- ArrayGetString(g_extra_rifle_items, itemid - EXTRA_RIFLES_STARTID, wname, charsmax(wname))
- weaponid = cs_weapon_name_to_id(wname)
- if (MAXBPAMMO[weaponid] > 2)
- {
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
- }
- else if (user_has_weapon(id, weaponid))
- {
- cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
- write_byte(AMMOID[weaponid])
- write_byte(1)
- message_end()
- return;
- }
- fm_give_item(id, wname)
- }
- else
- {
- ExecuteForward(g_rifle_selected, g_fwDummyResult, id, itemid);
- if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
- SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_rifle_cost, itemid))
- }
- }
- }
- }
- buy_extra_sniper(id, itemid, bool:ignorecost = false)
- {
- if ((itemid >= EXTRA_SNIPERS_STARTID && itemid <= SNIPERS_CUSTOM_STARTID-1))
- {
- client_print(id,print_chat, "Nema!")
- return;
- }
- if (!ignorecost)
- {
- if (GetUserCash(id)< ArrayGetCell(g_extra_sniper_cost, itemid))
- {
- client_print(id, print_chat, "Fali ti batice mozga!")
- return;
- }
- SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_extra_sniper_cost, itemid))
- }
- switch (itemid)
- {
- default:
- {
- if (itemid >= EXTRA_SNIPERS_STARTID && itemid <= SNIPERS_CUSTOM_STARTID-1)
- {
- static weaponid, wname[32]
- ArrayGetString(g_extra_sniper_items, itemid - EXTRA_SNIPERS_STARTID, wname, charsmax(wname))
- weaponid = cs_weapon_name_to_id(wname)
- if (MAXBPAMMO[weaponid] > 2)
- {
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
- }
- else if (user_has_weapon(id, weaponid))
- {
- cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
- write_byte(AMMOID[weaponid])
- write_byte(1)
- message_end()
- return;
- }
- fm_give_item(id, wname)
- }
- else
- {
- ExecuteForward(g_sniper_selected, g_fwDummyResult, id, itemid);
- if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
- SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_extra_sniper_cost, itemid))
- }
- }
- }
- }
- buy_extra_launcher(id, itemid, bool:ignorecost = false)
- {
- if ((itemid >= EXTRA_LAUNCHERS_STARTID && itemid <= LAUNCHERS_CUSTOM_STARTID-1))
- {
- client_print(id,print_chat, "No items loaded!!")
- return;
- }
- if (!ignorecost)
- {
- if (GetUserCash(id)< ArrayGetCell(g_launchercost, itemid))
- {
- client_print(id, print_chat, "Not enought money!")
- return;
- }
- SetUserCash(id, GetUserCash(id) - ArrayGetCell(g_launchercost, itemid))
- }
- switch (itemid)
- {
- default:
- {
- if (itemid >= EXTRA_LAUNCHERS_STARTID && itemid <= LAUNCHERS_CUSTOM_STARTID-1)
- {
- static weaponid, wname[32]
- ArrayGetString(g_extra_launcher_items, itemid - EXTRA_LAUNCHERS_STARTID, wname, charsmax(wname))
- weaponid = cs_weapon_name_to_id(wname)
- if (MAXBPAMMO[weaponid] > 2)
- {
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
- }
- else if (user_has_weapon(id, weaponid))
- {
- cs_set_user_bpammo(id, weaponid, cs_get_user_bpammo(id, weaponid) + 1)
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
- write_byte(AMMOID[weaponid])
- write_byte(1)
- message_end()
- return;
- }
- fm_give_item(id, wname)
- }
- else
- {
- ExecuteForward(g_launcher_selected, g_fwDummyResult, id, itemid);
- if (g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
- SetUserCash(id, GetUserCash(id) + ArrayGetCell(g_launchercost, itemid))
- }
- }
- }
- }
- public native_force_give_gun(id, itemid, bool:ignorecost)
- {
- if (itemid < 0 || itemid >= g_extra_gun_i)
- return 0;
- buy_extra_gun(id, itemid, ignorecost = true)
- return 1;
- }
- public native_force_give_shotgun(id, itemid, bool:ignorecost)
- {
- if (itemid < 0 || itemid >= g_extra_shotgun_i)
- return 0;
- buy_extra_shotgun(id, itemid, ignorecost = true)
- return 1;
- }
- public native_force_give_smg(id, itemid, bool:ignorecost)
- {
- if (itemid < 0 || itemid >= g_extra_smg_i)
- return 0;
- buy_extra_smg(id, itemid, ignorecost = true)
- return 1;
- }
- public native_force_give_rifle(id, itemid, bool:ignorecost)
- {
- if (itemid < 0 || itemid >= g_extraitem_i)
- return 0;
- buy_extra_rifle(id, itemid, ignorecost = true)
- return 1;
- }
- public native_force_give_sniper(id, itemid, bool:ignorecost)
- {
- if (itemid < 0 || itemid >= g_snipers_i)
- return 0;
- buy_extra_sniper(id, itemid, ignorecost = true)
- return 1;
- }
- public native_force_give_launcher(id, itemid, bool:ignorecost)
- {
- if (itemid < 0 || itemid >= g_launchers_i)
- return 0;
- buy_extra_launcher(id, itemid, ignorecost = true)
- return 1;
- }
- public native_get_gun_id(const name[])
- {
- param_convert(1)
- static i, item_name[32]
- for (i = 0; i < g_extra_gun_i; i++)
- {
- ArrayGetString(g_extra_gun_name, i, item_name, charsmax(item_name))
- if (equali(name, item_name))
- return i;
- }
- return -1;
- }
- public native_get_shotgun_id(const name[])
- {
- param_convert(1)
- static i, item_name[32]
- for (i = 0; i < g_extra_shotgun_i; i++)
- {
- ArrayGetString(g_extra_shotgun_name, i, item_name, charsmax(item_name))
- if (equali(name, item_name))
- return i;
- }
- return -1;
- }
- public native_get_smg_id(const name[])
- {
- param_convert(1)
- static i, item_name[32]
- for (i = 0; i < g_extra_smg_i; i++)
- {
- ArrayGetString(g_extra_smg_name, i, item_name, charsmax(item_name))
- if (equali(name, item_name))
- return i;
- }
- return -1;
- }
- public native_get_rifle_id(const name[])
- {
- param_convert(1)
- static i, item_name[32]
- for (i = 0; i < g_extraitem_i; i++)
- {
- ArrayGetString(g_extra_rifle_name, i, item_name, charsmax(item_name))
- if (equali(name, item_name))
- return i;
- }
- return -1;
- }
- public native_get_sniper_id(const name[])
- {
- param_convert(1)
- static i, item_name[32]
- for (i = 0; i < g_snipers_i; i++)
- {
- ArrayGetString(g_extra_sniper_name, i, item_name, charsmax(item_name))
- if (equali(name, item_name))
- return i;
- }
- return -1;
- }
- public native_get_launcher_id(const name[])
- {
- param_convert(1)
- static i, item_name[32]
- for (i = 0; i < g_launchers_i; i++)
- {
- ArrayGetString(g_launchername, i, item_name, charsmax(item_name))
- if (equali(name, item_name))
- return i;
- }
- return -1;
- }
- public native_register_gun(const name[], cost)
- {
- if (!g_arrays_created)
- return -1;
- param_convert(1)
- ArrayPushString(g_extra_gun_name, name)
- ArrayPushCell(g_extra_gun_cost, cost)
- ArrayPushCell(g_extra_gun_new, 1)
- new i, buffer[32], size = ArraySize(g_extra_gun2_realname)
- for (i = 0; i < size; i++)
- {
- ArrayGetString(g_extra_gun2_realname, i, buffer, charsmax(buffer))
- if (!equal(name, buffer))
- continue;
- ArraySetCell(g_extra_gun_new, g_extra_gun_i, 0)
- ArrayGetString(g_extra_gun2_name, i, buffer, charsmax(buffer))
- ArraySetString(g_extra_gun_name, g_extra_gun_i, buffer)
- buffer[0] = ArrayGetCell(g_extra_gun2_cost, i)
- ArraySetCell(g_extra_gun_cost, g_extra_gun_i, buffer[0])
- }
- g_extra_gun_i++
- return g_extra_gun_i-1;
- }
- public native_register_shotgun(const name[], cost)
- {
- if (!g_arrays_created)
- return -1;
- param_convert(1)
- ArrayPushString(g_extra_shotgun_name, name)
- ArrayPushCell(g_extra_shotgun_cost, cost)
- ArrayPushCell(g_extra_shotgun_new, 1)
- new i, buffer[32], size = ArraySize(g_extra_shotgun2_realname)
- for (i = 0; i < size; i++)
- {
- ArrayGetString(g_extra_shotgun2_realname, i, buffer, charsmax(buffer))
- if (!equal(name, buffer))
- continue;
- ArraySetCell(g_extra_shotgun_new, g_extra_shotgun_i, 0)
- ArrayGetString(g_extra_shotgun2_name, i, buffer, charsmax(buffer))
- ArraySetString(g_extra_shotgun_name, g_extra_shotgun_i, buffer)
- buffer[0] = ArrayGetCell(g_extra_shotgun2_cost, i)
- ArraySetCell(g_extra_shotgun_cost, g_extra_shotgun_i, buffer[0])
- }
- g_extra_shotgun_i++
- return g_extra_shotgun_i-1;
- }
- public native_register_smg(const name[], cost)
- {
- if (!g_arrays_created)
- return -1;
- param_convert(1)
- ArrayPushString(g_extra_smg_name, name)
- ArrayPushCell(g_extra_smg_cost, cost)
- ArrayPushCell(g_extra_smg_new, 1)
- new i, buffer[32], size = ArraySize(g_extra_smg2_realname)
- for (i = 0; i < size; i++)
- {
- ArrayGetString(g_extra_smg2_realname, i, buffer, charsmax(buffer))
- if (!equal(name, buffer))
- continue;
- ArraySetCell(g_extra_smg_new, g_extra_smg_i, 0)
- ArrayGetString(g_extra_smg2_name, i, buffer, charsmax(buffer))
- ArraySetString(g_extra_smg_name, g_extra_smg_i, buffer)
- buffer[0] = ArrayGetCell(g_extra_smg2_cost, i)
- ArraySetCell(g_extra_smg_cost, g_extra_smg_i, buffer[0])
- }
- g_extra_smg_i++
- return g_extra_smg_i-1;
- }
- public native_register_rifle(const name[], cost)
- {
- if (!g_arrays_created)
- return -1;
- param_convert(1)
- ArrayPushString(g_extra_rifle_name, name)
- ArrayPushCell(g_extra_rifle_cost, cost)
- ArrayPushCell(g_extra_rifle_new, 1)
- new i, buffer[32], size = ArraySize(g_extra_rifle2_realname)
- for (i = 0; i < size; i++)
- {
- ArrayGetString(g_extra_rifle2_realname, i, buffer, charsmax(buffer))
- if (!equal(name, buffer))
- continue;
- ArraySetCell(g_extra_rifle_new, g_extraitem_i, 0)
- ArrayGetString(g_extra_rifle2_name, i, buffer, charsmax(buffer))
- ArraySetString(g_extra_rifle_name, g_extraitem_i, buffer)
- buffer[0] = ArrayGetCell(g_extra_rifle2_cost, i)
- ArraySetCell(g_extra_rifle_cost, g_extraitem_i, buffer[0])
- }
- g_extraitem_i++
- return g_extraitem_i-1;
- }
- public native_register_sniper(const name[], cost)
- {
- if (!g_arrays_created)
- return -1;
- param_convert(1)
- ArrayPushString(g_extra_sniper_name, name)
- ArrayPushCell(g_extra_sniper_cost, cost)
- ArrayPushCell(g_extra_sniper_new, 1)
- new i, buffer[32], size = ArraySize(g_extra_sniper2_realname)
- for (i = 0; i < size; i++)
- {
- ArrayGetString(g_extra_sniper2_realname, i, buffer, charsmax(buffer))
- if (!equal(name, buffer))
- continue;
- ArraySetCell(g_extra_sniper_new, g_snipers_i, 0)
- ArrayGetString(g_extra_sniper2_name, i, buffer, charsmax(buffer))
- ArraySetString(g_extra_sniper_name, g_snipers_i, buffer)
- buffer[0] = ArrayGetCell(g_extra_sniper2_cost, i)
- ArraySetCell(g_extra_sniper_cost, g_snipers_i, buffer[0])
- }
- g_snipers_i++
- return g_snipers_i-1;
- }
- public native_register_launcher(const name[], cost)
- {
- if (!g_arrays_created)
- return -1;
- param_convert(1)
- ArrayPushString(g_launchername, name)
- ArrayPushCell(g_launchercost, cost)
- ArrayPushCell(g_extra_launcher_new, 1)
- new i, buffer[32], size = ArraySize(g_launcher_realname)
- for (i = 0; i < size; i++)
- {
- ArrayGetString(g_launcher_realname, i, buffer, charsmax(buffer))
- if (!equal(name, buffer))
- continue;
- ArraySetCell(g_extra_launcher_new, g_launchers_i, 0)
- ArrayGetString(g_launcher2name, i, buffer, charsmax(buffer))
- ArraySetString(g_launchername, g_launchers_i, buffer)
- buffer[0] = ArrayGetCell(g_launcher2cost, i)
- ArraySetCell(g_launchercost, g_launchers_i, buffer[0])
- }
- g_launchers_i++
- return g_launchers_i-1;
- }
- stock GetUserCash(id)
- {
- if (!is_user_connected(id))
- {
- log_error(AMX_ERR_NATIVE, "Invalid player (%d)", id)
- return -1;
- }
- return cs_get_user_money(id)
- }
- stock SetUserCash(id, cash)
- {
- cs_set_user_money(id, cash)
- }
- stock fm_find_ent_by_owner(entity, const classname[], owner)
- {
- while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) { /* keep looping */ }
- return entity;
- }
- stock fm_give_item(id, const item[])
- {
- static ent
- ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
- if (!pev_valid(ent)) return;
- static Float:originF[3]
- pev(id, pev_origin, originF)
- set_pev(ent, pev_origin, originF)
- set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
- dllfunc(DLLFunc_Spawn, ent)
- static save
- save = pev(ent, pev_solid)
- dllfunc(DLLFunc_Touch, ent, id)
- if (pev(ent, pev_solid) != save)
- return;
- engfunc(EngFunc_RemoveEntity, ent)
- }
- stock cs_weapon_name_to_id(const weapon[])
- {
- static i
- for (i = 0; i < sizeof WEAPONENTNAMES; i++)
- {
- if (equal(weapon, WEAPONENTNAMES[i]))
- return i;
- }
- return 0;
- }
- stock drop_weapons(id, dropwhat)
- {
- static weapons[32], num, i, weaponid
- num = 0
- get_user_weapons(id, weapons, num)
- for (i = 0; i < num; i++)
- {
- weaponid = weapons[i]
- if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
- {
- static wname[32], weapon_ent
- get_weaponname(weaponid, wname, charsmax(wname))
- weapon_ent = fm_find_ent_by_owner(-1, wname, id)
- set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))
- engclient_cmd(id, "drop", wname)
- cs_set_user_bpammo(id, weaponid, 0)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment