Raised This Month: $ Target: $400
 0% 

[Help]Can some one tell me


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Agent475
Junior Member
Join Date: Apr 2013
Old 07-23-2013 , 11:35   [Help]Can some one tell me
Reply With Quote #1

PHP Code:
#if defined _xws_included
  #endinput
#endif
#define _xws_included
 
native xws_register_gun(const item_name[], item_cost)
native xws_register_shotgun(const item_name[], item_cost)
native xws_register_smg(const item_name[], item_cost)
native xws_register_rifle(const item_name[], item_cost)
native xws_register_sniper(const item_name[], item_cost)
native xws_register_launcher(const item_name[], item_cost)
 
native xws_get_gun_id(const name[])
native xws_get_shotgun_id(const name[])
native xws_get_gmg_id(const name[])
native xws_get_rifle_id(const name[])
native xws_get_sniper_id(const name[])
native xws_get_launcher_id(const name[])
 
native xws_give_gun(iditemidignorecost false)
native xws_give_shotgun(iditemidignorecost false)
native xws_give_smg(iditemidignorecost false)
native xws_give_rifle(iditemidignorecost false)
native xws_give_sniper(iditemidignorecost false)
native xws_give_launcher(iditemidignorecost false)
 
native xws_guns_menu(id)
native xws_shotguns_menu(id)
native xws_smgs_menu(id)
native xws_rifles_menu(id)
native xws_snipers_menu(id)
native xws_launchers_menu(id)
 
forward xws_launcher_selected(iditemid)
forward xws_sniper_selected(iditemid)
forward xws_rifle_selected(iditemid)
forward xws_smg_selected(iditemid)
forward xws_shotgun_selected(iditemid)
forward xws_gun_selected(iditemid
this and this
PHP Code:
#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_selectedg_sniper_selectedg_rifle_selectedg_smg_selectedg_shotgun_selectedg_gun_selected
new g_fwDummyResult
const I_PLUGIN_HANDLED 97
const PEV_ADDITIONAL_AMMO pev_iuser1
 
new const EXTRA_LAUNCHERS_STARTID 0EXTRA_SNIPERS_STARTID 0EXTRA_RIFLES_STARTID 0,
        
EXTRA_SMG_STARTID 0EXTRA_SHOTGUNS_STARTID 0EXTRA_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_ig_snipers_ig_extraitem_ig_extra_smg_ig_extra_shotgun_ig_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[] = { -152, -1901321100901120100100909090100120,
                        
301202003290120902359090, -1100 }
 
new const 
AMMOID[] = { -19, -121251464131076444610,
                        
11035410211842, -1}
                       
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_CONTINUEFP_CELLFP_CELL)
        
g_sniper_selected CreateMultiForward("xws_sniper_selected"ET_CONTINUEFP_CELLFP_CELL)
        
g_rifle_selected CreateMultiForward("xws_rifle_selected"ET_CONTINUEFP_CELLFP_CELL)
        
g_smg_selected CreateMultiForward("xws_smg_selected"ET_CONTINUEFP_CELLFP_CELL)
        
g_shotgun_selected CreateMultiForward("xws_shotgun_selected"ET_CONTINUEFP_CELLFP_CELL)
        
g_gun_selected CreateMultiForward("xws_gun_selected"ET_CONTINUEFP_CELLFP_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(menuMPROP_EXITNAME"Izadji")
       
        
menu_display(idmenu)
       
        return 
PLUGIN_CONTINUE
}
 
public 
MainMenu_H(idmenuitem)
{
        if(
item == MENU_EXIT)
        {
                
menu_destroy(menu)
                return 
PLUGIN_CONTINUE
        
}
        switch(
item)
        {
                case 
0show_menu_guns(id);
                case 
1show_menu_shotguns(id);
                case 
2show_extra_smgs(id);
                case 
3show_extra_rifles(id);
                case 
4show_extra_snipers(id);
                case 
5show_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(321)
        
g_extra_launcher_items ArrayCreate(321)
        
g_launchername ArrayCreate(321)
        
g_launchercost ArrayCreate(11)
        
g_launcher_realname ArrayCreate(321)
        
g_launcher2name ArrayCreate(321)
        
g_launcher2cost ArrayCreate(11)
        
g_extra_launcher_new ArrayCreate(11)
       
        
g_extra_sniper_names ArrayCreate(321)
        
g_extra_sniper_items ArrayCreate(321)
        
g_extra_sniper_name ArrayCreate(321)
        
g_extra_sniper_cost ArrayCreate(11)
        
g_extra_sniper2_realname ArrayCreate(321)
        
g_extra_sniper2_name ArrayCreate(321)
        
g_extra_sniper2_cost ArrayCreate(11)
        
g_extra_sniper_new ArrayCreate(11)
       
        
g_extra_rifle_names ArrayCreate(321)
        
g_extra_rifle_items ArrayCreate(321)
        
g_extra_rifle_name ArrayCreate(321)
        
g_extra_rifle_cost ArrayCreate(11)
        
g_extra_rifle2_realname ArrayCreate(321)
        
g_extra_rifle2_name ArrayCreate(321)
        
g_extra_rifle2_cost ArrayCreate(11)
        
g_extra_rifle_new ArrayCreate(11)
       
        
g_extra_smg_names ArrayCreate(321)
        
g_extra_smg_items ArrayCreate(321)
        
g_extra_smg_name ArrayCreate(321)
        
g_extra_smg_cost ArrayCreate(11)
        
g_extra_smg2_realname ArrayCreate(321)
        
g_extra_smg2_name ArrayCreate(321)
        
g_extra_smg2_cost ArrayCreate(11)
        
g_extra_smg_new ArrayCreate(11)
       
        
g_extra_shotgun_names ArrayCreate(321)
        
g_extra_shotgun_items ArrayCreate(321)
        
g_extra_shotgun_name ArrayCreate(321)
        
g_extra_shotgun_cost ArrayCreate(11)
        
g_extra_shotgun2_realname ArrayCreate(321)
        
g_extra_shotgun2_name ArrayCreate(321)
        
g_extra_shotgun2_cost ArrayCreate(11)
        
g_extra_shotgun_new ArrayCreate(11)
       
        
g_extra_gun_names ArrayCreate(321)
        
g_extra_gun_items ArrayCreate(321)
        
g_extra_gun_name ArrayCreate(321)
        
g_extra_gun_cost ArrayCreate(11)
        
g_extra_gun2_realname ArrayCreate(321)
        
g_extra_gun2_name ArrayCreate(321)
        
g_extra_gun2_cost ArrayCreate(11)
        
g_extra_gun_new ArrayCreate(11)
       
        
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(path1charsmax(path1))
        
get_configsdir(path2charsmax(path2))
        
get_configsdir(path3charsmax(path3))
        
get_configsdir(path4charsmax(path4))
        
get_configsdir(path5charsmax(path5))
        
get_configsdir(path6charsmax(path6))
        
format(path1charsmax(path1), "%s/xws/%s"path1LAUNCHERS_FILE)
        
format(path2charsmax(path2), "%s/xws/%s"path2SNIPERS_FILE)
        
format(path3charsmax(path3), "%s/xws/%s"path3RIFLES_FILE)
        
format(path4charsmax(path4), "%s/xws/%s"path4SMGS_FILE)
        
format(path5charsmax(path5), "%s/xws/%s"path5SHOTGUNS_FILE)
        
format(path6charsmax(path6), "%s/xws/%s"path6GUNS_FILE)
       
        new 
file
        
new linedata[1024], key[64], value[960]
       
        if (
file_exists(path1))
        {
                
file fopen(path1"rt")
       
                while (
file && !feof(file))
                {
                        
fgets(filelinedatacharsmax(linedata))
                        
replace(linedatacharsmax(linedata), "^n""")
                        if (!
linedata[0] || linedata[0] == ';') continue;
                       
                        if (
linedata[0] == '[')
                        {
                                
linedata[strlen(linedata) - 1] = 0
                                copy
(linedatacharsmax(linedata), linedata[1])
                                
ArrayPushString(g_launcher_realnamelinedata)
                                continue;
                        }
                        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
                        
trim(key)
                        
trim(value)
                       
                        if (
equal(key"NAME"))
                                
ArrayPushString(g_launcher2namevalue)
                        else if (
equal(key"COST"))
                                
ArrayPushCell(g_launcher2coststr_to_num(value))
                }
                if (
filefclose(file)
        }
        if (
file_exists(path2))
        {
                
file fopen(path2"rt")
                while (
file && !feof(file))
                {
                        
fgets(filelinedatacharsmax(linedata))
                        
replace(linedatacharsmax(linedata), "^n""")
                        if (!
linedata[0] || linedata[0] == ';') continue;
                        if (
linedata[0] == '[')
                        {
                                
linedata[strlen(linedata) - 1] = 0
                                copy
(linedatacharsmax(linedata), linedata[1])
                                
ArrayPushString(g_extra_sniper2_realnamelinedata)
                                continue;
                        }
                        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
                        
trim(key)
                        
trim(value)
                        if (
equal(key"NAME"))
                                
ArrayPushString(g_extra_sniper2_namevalue)
                        else if (
equal(key"COST"))
                                
ArrayPushCell(g_extra_sniper2_coststr_to_num(value))
                }
                if (
filefclose(file)
        }
        if (
file_exists(path3))
        {
                
file fopen(path3"rt")
                while (
file && !feof(file))
                {
                        
fgets(filelinedatacharsmax(linedata))
                        
replace(linedatacharsmax(linedata), "^n""")
                        if (!
linedata[0] || linedata[0] == ';') continue;
                        if (
linedata[0] == '[')
                        {
                                
linedata[strlen(linedata) - 1] = 0
                                copy
(linedatacharsmax(linedata), linedata[1])
                                
ArrayPushString(g_extra_rifle2_realnamelinedata)
                                continue;
                        }
                        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
                        
trim(key)
                        
trim(value)
                        if (
equal(key"NAME"))
                                
ArrayPushString(g_extra_rifle2_namevalue)
                        else if (
equal(key"COST"))
                                
ArrayPushCell(g_extra_rifle2_coststr_to_num(value))
                }
                if (
filefclose(file)
        }
        if (
file_exists(path4))
        {
                
file fopen(path4"rt")
                while (
file && !feof(file))
                {
                        
fgets(filelinedatacharsmax(linedata))
                        
replace(linedatacharsmax(linedata), "^n""")
                        if (!
linedata[0] || linedata[0] == ';') continue;
                        if (
linedata[0] == '[')
                        {
                                
linedata[strlen(linedata) - 1] = 0
                                copy
(linedatacharsmax(linedata), linedata[1])
                                
ArrayPushString(g_extra_smg2_realnamelinedata)
                                continue;
                        }
                        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
                        
trim(key)
                        
trim(value)
                        if (
equal(key"NAME"))
                                
ArrayPushString(g_extra_smg2_namevalue)
                        else if (
equal(key"COST"))
                                
ArrayPushCell(g_extra_smg2_coststr_to_num(value))
                }
                if (
filefclose(file)
        }
        if (
file_exists(path5))
        {
                
file fopen(path5"rt")
                while (
file && !feof(file))
                {
                        
fgets(filelinedatacharsmax(linedata))
                        
replace(linedatacharsmax(linedata), "^n""")
                        if (!
linedata[0] || linedata[0] == ';') continue;
                        if (
linedata[0] == '[')
                        {
                                
linedata[strlen(linedata) - 1] = 0
                                copy
(linedatacharsmax(linedata), linedata[1])
                                
ArrayPushString(g_extra_shotgun2_realnamelinedata)
                                continue;
                        }
                        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
                        
trim(key)
                        
trim(value)
                        if (
equal(key"NAME"))
                                
ArrayPushString(g_extra_shotgun2_namevalue)
                        else if (
equal(key"COST"))
                                
ArrayPushCell(g_extra_shotgun2_coststr_to_num(value))
                }
                if (
filefclose(file)
        }
        if (
file_exists(path6))
        {
                
file fopen(path6"rt")
                while (
file && !feof(file))
                {
                        
fgets(filelinedatacharsmax(linedata))
                        
replace(linedatacharsmax(linedata), "^n""")
                        if (!
linedata[0] || linedata[0] == ';') continue;
                       
                        if (
linedata[0] == '[')
                        {
                                
linedata[strlen(linedata) - 1] = 0
                                copy
(linedatacharsmax(linedata), linedata[1])
                               
                                
ArrayPushString(g_extra_gun2_realnamelinedata)
                                continue;
                        }
                        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
                        
trim(key)
                        
trim(value)
                       
                        if (
equal(key"NAME"))
                                
ArrayPushString(g_extra_gun2_namevalue)
                        else if (
equal(key"COST"))
                                
ArrayPushCell(g_extra_gun2_coststr_to_num(value))
                }
                if (
filefclose(file)
        }
}
 
save_customization()
{
        new 
i,buffer[512]
       
        new 
path1[64], path2[64], path3[64], path4[64] , path5[64], path6[64]
        
get_configsdir(path1charsmax(path1))
        
get_configsdir(path2charsmax(path2))
        
get_configsdir(path3charsmax(path3))
        
get_configsdir(path4charsmax(path4))
        
get_configsdir(path5charsmax(path5))
        
get_configsdir(path6charsmax(path6))
        
format(path1charsmax(path1), "%s/xws/%s"path1LAUNCHERS_FILE)
        
format(path2charsmax(path2), "%s/xws/%s"path2SNIPERS_FILE)
        
format(path3charsmax(path3), "%s/xws/%s"path3RIFLES_FILE)
        
format(path4charsmax(path4), "%s/xws/%s"path4SMGS_FILE)
        
format(path5charsmax(path5), "%s/xws/%s"path5SHOTGUNS_FILE)
        
format(path6charsmax(path6), "%s/xws/%s"path6GUNS_FILE)
        new 
file
       
        
new size
        file 
fopen(path1"at")
        
size ArraySize(g_launchername)
        for (
LAUNCHERS_CUSTOM_STARTIDsizei++)
        {
                if (
ArrayGetCell(g_extra_launcher_newi))
                {
                        
ArrayGetString(g_launchernameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^n[%s]"buffer)
                        
fputs(filebuffer)
                       
                        
ArrayGetString(g_launchernameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
                        
fputs(filebuffer)
                       
                        
formatex(buffercharsmax(buffer), "^nCOST = %d"ArrayGetCell(g_launchercosti))
                        
fputs(filebuffer)
                }
        }
        
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 (
SNIPERS_CUSTOM_STARTIDsizei++)
        {
                if (
ArrayGetCell(g_extra_sniper_newi))
                {
                        
ArrayGetString(g_extra_sniper_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^n[%s]"buffer)
                        
fputs(filebuffer)
                       
                        
ArrayGetString(g_extra_sniper_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
                        
fputs(filebuffer)
                       
                        
formatex(buffercharsmax(buffer), "^nCOST = %d"ArrayGetCell(g_extra_sniper_costi))
                        
fputs(filebuffer)
                }
        }
        
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 (
RIFLES_CUSTOM_STARTIDsizei++)
        {
                if (
ArrayGetCell(g_extra_rifle_newi))
                {
                        
ArrayGetString(g_extra_rifle_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^n[%s]"buffer)
                        
fputs(filebuffer)
                       
                        
ArrayGetString(g_extra_rifle_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
                        
fputs(filebuffer)
                       
                        
formatex(buffercharsmax(buffer), "^nCOST = %d"ArrayGetCell(g_extra_rifle_costi))
                        
fputs(filebuffer)
                }
        }
        
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 (
SMGS_CUSTOM_STARTIDsizei++)
        {
                if (
ArrayGetCell(g_extra_smg_newi))
                {
                        
ArrayGetString(g_extra_smg_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^n[%s]"buffer)
                        
fputs(filebuffer)
                       
                        
ArrayGetString(g_extra_smg_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
                        
fputs(filebuffer)
                       
                        
formatex(buffercharsmax(buffer), "^nCOST = %d"ArrayGetCell(g_extra_smg_costi))
                        
fputs(filebuffer)
                }
        }
        
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 (
SHOTGUNS_CUSTOM_STARTIDsizei++)
        {
                if (
ArrayGetCell(g_extra_shotgun_newi))
                {
                        
ArrayGetString(g_extra_shotgun_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^n[%s]"buffer)
                        
fputs(filebuffer)
                       
                        
ArrayGetString(g_extra_shotgun_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
                        
fputs(filebuffer)
                       
                        
formatex(buffercharsmax(buffer), "^nCOST = %d"ArrayGetCell(g_extra_shotgun_costi))
                        
fputs(filebuffer)
                }
        }
        
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 (
GUNS_CUSTOM_STARTIDsizei++)
        {
                if (
ArrayGetCell(g_extra_gun_newi))
                {
                        
ArrayGetString(g_extra_gun_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^n[%s]"buffer)
                        
fputs(filebuffer)
                       
                        
ArrayGetString(g_extra_gun_nameibuffercharsmax(buffer))
                        
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
                        
fputs(filebuffer)
                       
                        
formatex(buffercharsmax(buffer), "^nCOST = %d"ArrayGetCell(g_extra_gun_costi))
                        
fputs(filebuffer)
                }
        }
        
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 
menuidmenu[128], itembuffer[32]
       
        
formatex(menucharsmax(menu), "Izaberi extra item:")
        
menuid menu_create(menu"menu_guns_H")
       
        for (
item 0item g_extra_gun_iitem++)
        {
                switch (
item)
                {
                        default:
                        {
                                if (
item >= EXTRA_GUNS_STARTID && item <= GUNS_CUSTOM_STARTID-1) continue;
                                
ArrayGetString(g_extra_gun_nameitembuffercharsmax(buffer))
                        }
                }
                
formatex(menucharsmax(menu), "%s \y%d CP"bufferArrayGetCell(g_extra_gun_costitem))
                
buffer[0] = item
                buffer
[1] = 0
                menu_additem
(menuidmenubuffer)
        }
        if (
menu_items(menuid) <= 0)
        {
                
client_print(idprint_chat"NEMA,STA GLEDAS??")
                
menu_destroy(menuid)
                return;
        }
        
formatex(menucharsmax(menu), "Nazad")
        
menu_setprop(menuidMPROP_BACKNAMEmenu)
        
formatex(menucharsmax(menu), "Napred")
        
menu_setprop(menuidMPROP_NEXTNAMEmenu)
        
formatex(menucharsmax(menu), "Exit")
        
menu_setprop(menuidMPROP_EXITNAMEmenu)
       
        
menu_display(idmenuid)
}
 
public 
menu_guns_H(idmenuiditem)
{
        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], dummyitemid
        menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
        
itemid buffer[0]
       
        
buy_extra_gun(iditemid)
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
}
 
public 
show_menu_shotguns(id)
{
        static 
menuidmenu[128], itembuffer[32]
       
        
formatex(menucharsmax(menu), "Izaberi extra item:")
        
menuid menu_create(menu"menu_shotguns_H")
       
        for (
item 0item g_extra_shotgun_iitem++)
        {
                switch (
item)
                {
                        default:
                        {
                                if (
item >= EXTRA_SHOTGUNS_STARTID && item <= SHOTGUNS_CUSTOM_STARTID-1) continue;
                                
ArrayGetString(g_extra_shotgun_nameitembuffercharsmax(buffer))
                        }
                }
                
formatex(menucharsmax(menu), "%s \y%d CP"bufferArrayGetCell(g_extra_shotgun_costitem))
                
buffer[0] = item
                buffer
[1] = 0
                menu_additem
(menuidmenubuffer)
        }
        if (
menu_items(menuid) <= 0)
        {
                
client_print(idprint_chat"NEMA,STA GLEDAS??")
                
menu_destroy(menuid)
                return;
        }
        
formatex(menucharsmax(menu), "Nazad")
        
menu_setprop(menuidMPROP_BACKNAMEmenu)
        
formatex(menucharsmax(menu), "Napred")
        
menu_setprop(menuidMPROP_NEXTNAMEmenu)
        
formatex(menucharsmax(menu), "Exit")
        
menu_setprop(menuidMPROP_EXITNAMEmenu)
       
        
menu_display(idmenuid)
}
 
public 
menu_shotguns_H(idmenuiditem)
{
        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], dummyitemid
        menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
        
itemid buffer[0]
       
        
buy_extra_shotgun(iditemid)
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
}
 
public 
show_extra_smgs(id)
{
        static 
menuidmenu[128], itembuffer[32]
        
formatex(menucharsmax(menu), "Izaberi extra item:")
        
menuid menu_create(menu"menu_smgs_H")
       
        
// Item List
        
for (item 0item g_extra_smg_iitem++)
        {
                switch (
item)
                {
                        default:
                        {
                                if (
item >= EXTRA_SMG_STARTID && item <= SMGS_CUSTOM_STARTID-1) continue;
                                
ArrayGetString(g_extra_smg_nameitembuffercharsmax(buffer))
                        }
                }
                
formatex(menucharsmax(menu), "%s \y%d CP"bufferArrayGetCell(g_extra_smg_costitem))
                
buffer[0] = item
                buffer
[1] = 0
                menu_additem
(menuidmenubuffer)
        }
        if (
menu_items(menuid) <= 0)
        {
                
client_print(idprint_chat"NEMA,STA GLEDAS??")
                
menu_destroy(menuid)
                return;
        }
        
formatex(menucharsmax(menu), "Nazad")
        
menu_setprop(menuidMPROP_BACKNAMEmenu)
        
formatex(menucharsmax(menu), "Napred")
        
menu_setprop(menuidMPROP_NEXTNAMEmenu)
        
formatex(menucharsmax(menu), "Exit")
        
menu_setprop(menuidMPROP_EXITNAMEmenu)
       
        
menu_display(idmenuid)
}
 
public 
menu_smgs_H(idmenuiditem)
{
        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], dummyitemid
        menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
        
itemid buffer[0]
       
        
buy_extra_smg(iditemid)
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
}
 
public 
show_extra_rifles(id)
{
        static 
menuidmenu[128], itembuffer[32]
       
        
formatex(menucharsmax(menu), "Izaberi extra item:")
        
menuid menu_create(menu"menu_rifles_H")
       
        for (
item 0item g_extraitem_iitem++)
        {
                switch (
item)
                {
                        default:
                        {
                                if (
item >= EXTRA_RIFLES_STARTID && item <= RIFLES_CUSTOM_STARTID-1) continue;
                                
ArrayGetString(g_extra_rifle_nameitembuffercharsmax(buffer))
                        }
                }
                
formatex(menucharsmax(menu), "%s \y%d CP"bufferArrayGetCell(g_extra_rifle_costitem))
                
buffer[0] = item
                buffer
[1] = 0
                menu_additem
(menuidmenubuffer)
        }
        if (
menu_items(menuid) <= 0)
        {
                
client_print(idprint_chat"NEMA,STA GLEDAS??")
                
menu_destroy(menuid)
                return;
        }
        
formatex(menucharsmax(menu), "Nazad")
        
menu_setprop(menuidMPROP_BACKNAMEmenu)
        
formatex(menucharsmax(menu), "Napred")
        
menu_setprop(menuidMPROP_NEXTNAMEmenu)
        
formatex(menucharsmax(menu), "Exit")
        
menu_setprop(menuidMPROP_EXITNAMEmenu)
       
        
menu_display(idmenuid)
}
 
public 
menu_rifles_H(idmenuiditem)
{
        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], dummyitemid
        menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
        
itemid buffer[0]
       
        
buy_extra_rifle(iditemid)
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
}
 
public 
show_extra_snipers(id)
{
        static 
menuidmenu[128], itembuffer[32]
       
        
formatex(menucharsmax(menu), "Izaberi extra item:")
        
menuid menu_create(menu"snipers_menu_H")
       
        
// Item List
        
for (item 0item g_snipers_iitem++)
        {
                switch (
item)
                {
                        default:
                        {
                                if (
item >= EXTRA_SNIPERS_STARTID && item <= SNIPERS_CUSTOM_STARTID-1) continue;
                                
ArrayGetString(g_extra_sniper_nameitembuffercharsmax(buffer))
                        }
                }
                
formatex(menucharsmax(menu), "%s \y%d CP"bufferArrayGetCell(g_extra_sniper_costitem))
                
buffer[0] = item
                buffer
[1] = 0
                menu_additem
(menuidmenubuffer)
        }
        if (
menu_items(menuid) <= 0)
        {
                
client_print(idprint_chat"No items loaded!")
                
menu_destroy(menuid)
                return;
        }
        
formatex(menucharsmax(menu), "Nazad")
        
menu_setprop(menuidMPROP_BACKNAMEmenu)
        
formatex(menucharsmax(menu), "Napred")
        
menu_setprop(menuidMPROP_NEXTNAMEmenu)
        
formatex(menucharsmax(menu), "Exit")
        
menu_setprop(menuidMPROP_EXITNAMEmenu)
       
        
menu_display(idmenuid)
}
 
public 
snipers_menu_H(idmenuiditem)
{
        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], dummyitemid
        menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
        
itemid buffer[0]
       
        
buy_extra_sniper(iditemid)
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
}
 
public 
show_extra_launchers(id)
{
        static 
menuidmenu[128], itembuffer[32]
       
        
formatex(menucharsmax(menu), "Izaberi extra item:")
        
menuid menu_create(menu"extra_launchers_handle")
       
        for (
item 0item g_launchers_iitem++)
        {
                switch (
item)
                {
                        default:
                        {
                                if (
item >= EXTRA_LAUNCHERS_STARTID && item <= LAUNCHERS_CUSTOM_STARTID-1) continue;
                                
ArrayGetString(g_launchernameitembuffercharsmax(buffer))
                        }
                }
                
formatex(menucharsmax(menu), "%s \y%d$"bufferArrayGetCell(g_launchercostitem))
                
buffer[0] = item
                buffer
[1] = 0
                menu_additem
(menuidmenubuffer)
        }
        if (
menu_items(menuid) <= 0)
        {
                
client_print(idprint_chat"No extra items loaded!")
                
menu_destroy(menuid)
                return;
        }
        
formatex(menucharsmax(menu), "Nazad")
        
menu_setprop(menuidMPROP_BACKNAMEmenu)
        
formatex(menucharsmax(menu), "Napred")
        
menu_setprop(menuidMPROP_NEXTNAMEmenu)
        
formatex(menucharsmax(menu), "Exit")
        
menu_setprop(menuidMPROP_EXITNAMEmenu)
       
        
menu_display(idmenuid)
}
 
public 
extra_launchers_handle(idmenuiditem)
{
        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], dummyitemid
        menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
        
itemid buffer[0]
       
        
buy_extra_launcher(iditemid)
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
}
 
buy_extra_gun(iditemidbool: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_costitemid))
                {
                        
client_print(idprint_chat"Fali ti batice mozga!")
                        return;
                }
                
SetUserCash(idGetUserCash(id) - ArrayGetCell(g_extra_gun_costitemid))
        }
        switch (
itemid)
        {
                default:
                {
                        if (
itemid >= EXTRA_GUNS_STARTID && itemid <= GUNS_CUSTOM_STARTID-1)
                        {
                                static 
weaponidwname[32]
                                
ArrayGetString(g_extra_gun_itemsitemid EXTRA_GUNS_STARTIDwnamecharsmax(wname))
                                
weaponid cs_weapon_name_to_id(wname)
                               
                                if (
MAXBPAMMO[weaponid] > 2)
                                {
                                        if ((
1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
                                                
drop_weapons(id1)
                                        else
                                                
drop_weapons(id2)
                                       
                                        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
                                }
                                else if (
user_has_weapon(idweaponid))
                                {
                                        
cs_set_user_bpammo(idweaponidcs_get_user_bpammo(idweaponid) + 1)
                                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
                                        
write_byte(AMMOID[weaponid])
                                        
write_byte(1)
                                        
message_end()
                                       
                                        return;
                                }
                                
fm_give_item(idwname)
                        }
                        else
                        {
                                
ExecuteForward(g_gun_selectedg_fwDummyResultiditemid);
                               
                                if (
g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
                                        
SetUserCash(idGetUserCash(id) + ArrayGetCell(g_extra_gun_costitemid))
                        }
                }
        }
}
 
buy_extra_shotgun(iditemidbool: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_costitemid))
                {
                        
client_print(idprint_chat"Fali ti batice mozga!")
                        return;
                }
                
SetUserCash(idGetUserCash(id) - ArrayGetCell(g_extra_shotgun_costitemid))
        }
        switch (
itemid)
        {
                default:
                {
                        if (
itemid >= EXTRA_SHOTGUNS_STARTID && itemid <= SHOTGUNS_CUSTOM_STARTID-1)
                        {
                                static 
weaponidwname[32]
                                
ArrayGetString(g_extra_shotgun_itemsitemid EXTRA_SHOTGUNS_STARTIDwnamecharsmax(wname))
                                
weaponid cs_weapon_name_to_id(wname)
                               
                                if (
MAXBPAMMO[weaponid] > 2)
                                {
                                        if ((
1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
                                                
drop_weapons(id1)
                                        else
                                                
drop_weapons(id2)
                                       
                                        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
                                }
                                else if (
user_has_weapon(idweaponid))
                                {
                                        
cs_set_user_bpammo(idweaponidcs_get_user_bpammo(idweaponid) + 1)
                                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
                                        
write_byte(AMMOID[weaponid])
                                        
write_byte(1)
                                        
message_end()
                                       
                                        return;
                                }
                                
fm_give_item(idwname)
                        }
                        else
                        {
                                
ExecuteForward(g_shotgun_selectedg_fwDummyResultiditemid);
                                if (
g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
                                        
SetUserCash(idGetUserCash(id) + ArrayGetCell(g_extra_shotgun_costitemid))
                        }
                }
        }
}
 
buy_extra_smg(iditemidbool: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_costitemid))
                {
                        
client_print(idprint_chat"Fali ti batice mozga!")
                        return;
                }
                
SetUserCash(idGetUserCash(id) - ArrayGetCell(g_extra_smg_costitemid))
        }
        switch (
itemid)
        {
                default:
                {
                        if (
itemid >= EXTRA_SMG_STARTID && itemid <= SMGS_CUSTOM_STARTID-1)
                        {
                                static 
weaponidwname[32]
                                
ArrayGetString(g_extra_smg_itemsitemid EXTRA_SMG_STARTIDwnamecharsmax(wname))
                                
weaponid cs_weapon_name_to_id(wname)
                                if (
MAXBPAMMO[weaponid] > 2)
                                {
                                        if ((
1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
                                                
drop_weapons(id1)
                                        else
                                                
drop_weapons(id2)
                                       
                                        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
                                }
                                else if (
user_has_weapon(idweaponid))
                                {
                                        
cs_set_user_bpammo(idweaponidcs_get_user_bpammo(idweaponid) + 1)
                                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
                                        
write_byte(AMMOID[weaponid])
                                        
write_byte(1)
                                        
message_end()
                                       
                                        return;
                                }
                                
fm_give_item(idwname)
                        }
                        else
                        {
                                
ExecuteForward(g_smg_selectedg_fwDummyResultiditemid);
                                if (
g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
                                        
SetUserCash(idGetUserCash(id) + ArrayGetCell(g_extra_smg_costitemid))
                        }
                }
        }
}
 
buy_extra_rifle(iditemidbool: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_costitemid))
                {
                        
client_print(idprint_chat"Fali ti batice mozga!")
                        return;
                }
                
SetUserCash(idGetUserCash(id) - ArrayGetCell(g_extra_rifle_costitemid))
        }
        switch (
itemid)
        {
                default:
                {
                        if (
itemid >= EXTRA_RIFLES_STARTID && itemid <= RIFLES_CUSTOM_STARTID-1)
                        {
                                static 
weaponidwname[32]
                                
ArrayGetString(g_extra_rifle_itemsitemid EXTRA_RIFLES_STARTIDwnamecharsmax(wname))
                                
weaponid cs_weapon_name_to_id(wname)
                               
                                if (
MAXBPAMMO[weaponid] > 2)
                                {
                                        if ((
1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
                                                
drop_weapons(id1)
                                        else
                                                
drop_weapons(id2)
                                       
                                        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
                                }
                                else if (
user_has_weapon(idweaponid))
                                {
                                        
cs_set_user_bpammo(idweaponidcs_get_user_bpammo(idweaponid) + 1)
                                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
                                        
write_byte(AMMOID[weaponid])
                                        
write_byte(1)
                                        
message_end()
                                       
                                        return;
                                }
                                
fm_give_item(idwname)
                        }
                        else
                        {
                                
ExecuteForward(g_rifle_selectedg_fwDummyResultiditemid);
 
                                if (
g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
                                        
SetUserCash(idGetUserCash(id) + ArrayGetCell(g_extra_rifle_costitemid))
                        }
                }
        }
}
 
buy_extra_sniper(iditemidbool: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_costitemid))
                {
                        
client_print(idprint_chat"Fali ti batice mozga!")
                        return;
                }
                
SetUserCash(idGetUserCash(id) - ArrayGetCell(g_extra_sniper_costitemid))
        }
        switch (
itemid)
        {
                default:
                {
                        if (
itemid >= EXTRA_SNIPERS_STARTID && itemid <= SNIPERS_CUSTOM_STARTID-1)
                        {
                                static 
weaponidwname[32]
                                
ArrayGetString(g_extra_sniper_itemsitemid EXTRA_SNIPERS_STARTIDwnamecharsmax(wname))
                                
weaponid cs_weapon_name_to_id(wname)
                               
                                if (
MAXBPAMMO[weaponid] > 2)
                                {
                                        if ((
1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
                                                
drop_weapons(id1)
                                        else
                                                
drop_weapons(id2)
                                       
                                        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
                                }
                                else if (
user_has_weapon(idweaponid))
                                {
                                        
cs_set_user_bpammo(idweaponidcs_get_user_bpammo(idweaponid) + 1)
                                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
                                        
write_byte(AMMOID[weaponid])
                                        
write_byte(1)
                                        
message_end()
                                       
                                        return;
                                }
                                
fm_give_item(idwname)
                        }
                        else
                        {
                                
ExecuteForward(g_sniper_selectedg_fwDummyResultiditemid);
                                if (
g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
                                        
SetUserCash(idGetUserCash(id) + ArrayGetCell(g_extra_sniper_costitemid))
                        }
                }
        }
}
 
buy_extra_launcher(iditemidbool: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_launchercostitemid))
                {
                        
client_print(idprint_chat"Not enought money!")
                        return;
                }
                
SetUserCash(idGetUserCash(id) - ArrayGetCell(g_launchercostitemid))
        }
        switch (
itemid)
        {
                default:
                {
                        if (
itemid >= EXTRA_LAUNCHERS_STARTID && itemid <= LAUNCHERS_CUSTOM_STARTID-1)
                        {
                                static 
weaponidwname[32]
                                
ArrayGetString(g_extra_launcher_itemsitemid EXTRA_LAUNCHERS_STARTIDwnamecharsmax(wname))
                                
weaponid cs_weapon_name_to_id(wname)
                               
                                if (
MAXBPAMMO[weaponid] > 2)
                                {
                                        if ((
1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
                                                
drop_weapons(id1)
                                        else
                                                
drop_weapons(id2)
                                       
                                        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
                                }
                                else if (
user_has_weapon(idweaponid))
                                {
                                        
cs_set_user_bpammo(idweaponidcs_get_user_bpammo(idweaponid) + 1)
                                       
                                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
                                        
write_byte(AMMOID[weaponid])
                                        
write_byte(1)
                                        
message_end()
                                       
                                        return;
                                }
                                
fm_give_item(idwname)
                        }
                        else
                        {
                                
ExecuteForward(g_launcher_selectedg_fwDummyResultiditemid);
                               
                                if (
g_fwDummyResult >= I_PLUGIN_HANDLED && !ignorecost)
                                        
SetUserCash(idGetUserCash(id) + ArrayGetCell(g_launchercostitemid))
                        }
                }
        }
}
 
public 
native_force_give_gun(iditemidbool:ignorecost)
{
        if (
itemid || itemid >= g_extra_gun_i)
                return 
0;
       
        
buy_extra_gun(iditemidignorecost true)
        return 
1;
}
 
public 
native_force_give_shotgun(iditemidbool:ignorecost)
{
        if (
itemid || itemid >= g_extra_shotgun_i)
                return 
0;
       
        
buy_extra_shotgun(iditemidignorecost true)
        return 
1;
}
 
public 
native_force_give_smg(iditemidbool:ignorecost)
{
        if (
itemid || itemid >= g_extra_smg_i)
                return 
0;
       
        
buy_extra_smg(iditemidignorecost true)
        return 
1;
}
 
public 
native_force_give_rifle(iditemidbool:ignorecost)
{
        if (
itemid || itemid >= g_extraitem_i)
                return 
0;
       
        
buy_extra_rifle(iditemidignorecost true)
        return 
1;
}
 
public 
native_force_give_sniper(iditemidbool:ignorecost)
{
        if (
itemid || itemid >= g_snipers_i)
                return 
0;
       
        
buy_extra_sniper(iditemidignorecost true)
        return 
1;
}
 
public 
native_force_give_launcher(iditemidbool:ignorecost)
{
        if (
itemid || itemid >= g_launchers_i)
                return 
0;
       
        
buy_extra_launcher(iditemidignorecost true)
        return 
1;
}
 
public 
native_get_gun_id(const name[])
{
        
param_convert(1)
       
        static 
iitem_name[32]
        for (
0g_extra_gun_ii++)
        {
                
ArrayGetString(g_extra_gun_nameiitem_namecharsmax(item_name))
               
                if (
equali(nameitem_name))
                        return 
i;
        }
       
        return -
1;
}
 
public 
native_get_shotgun_id(const name[])
{
        
param_convert(1)
       
        static 
iitem_name[32]
        for (
0g_extra_shotgun_ii++)
        {
                
ArrayGetString(g_extra_shotgun_nameiitem_namecharsmax(item_name))
               
                if (
equali(nameitem_name))
                        return 
i;
        }
       
        return -
1;
}
 
public 
native_get_smg_id(const name[])
{
        
param_convert(1)
       
        static 
iitem_name[32]
        for (
0g_extra_smg_ii++)
        {
                
ArrayGetString(g_extra_smg_nameiitem_namecharsmax(item_name))
               
                if (
equali(nameitem_name))
                        return 
i;
        }
       
        return -
1;
}
 
public 
native_get_rifle_id(const name[])
{
        
param_convert(1)
       
        static 
iitem_name[32]
        for (
0g_extraitem_ii++)
        {
                
ArrayGetString(g_extra_rifle_nameiitem_namecharsmax(item_name))
               
                if (
equali(nameitem_name))
                        return 
i;
        }
       
        return -
1;
}
 
public 
native_get_sniper_id(const name[])
{
        
param_convert(1)
       
        static 
iitem_name[32]
        for (
0g_snipers_ii++)
        {
                
ArrayGetString(g_extra_sniper_nameiitem_namecharsmax(item_name))
               
                if (
equali(nameitem_name))
                        return 
i;
        }
       
        return -
1;
}
 
public 
native_get_launcher_id(const name[])
{
        
param_convert(1)
       
        static 
iitem_name[32]
        for (
0g_launchers_ii++)
        {
                
ArrayGetString(g_launchernameiitem_namecharsmax(item_name))
               
                if (
equali(nameitem_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_namename)
        
ArrayPushCell(g_extra_gun_costcost)
       
        
ArrayPushCell(g_extra_gun_new1)
       
        new 
ibuffer[32], size ArraySize(g_extra_gun2_realname)
        for (
0sizei++)
        {
                
ArrayGetString(g_extra_gun2_realnameibuffercharsmax(buffer))
               
                if (!
equal(namebuffer))
                        continue;
               
                
ArraySetCell(g_extra_gun_newg_extra_gun_i0)
               
                
ArrayGetString(g_extra_gun2_nameibuffercharsmax(buffer))
                
ArraySetString(g_extra_gun_nameg_extra_gun_ibuffer)
               
                
buffer[0] = ArrayGetCell(g_extra_gun2_costi)
                
ArraySetCell(g_extra_gun_costg_extra_gun_ibuffer[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_namename)
        
ArrayPushCell(g_extra_shotgun_costcost)
       
        
ArrayPushCell(g_extra_shotgun_new1)
       
        new 
ibuffer[32], size ArraySize(g_extra_shotgun2_realname)
        for (
0sizei++)
        {
                
ArrayGetString(g_extra_shotgun2_realnameibuffercharsmax(buffer))
               
                if (!
equal(namebuffer))
                        continue;
               
                
ArraySetCell(g_extra_shotgun_newg_extra_shotgun_i0)
               
                
ArrayGetString(g_extra_shotgun2_nameibuffercharsmax(buffer))
                
ArraySetString(g_extra_shotgun_nameg_extra_shotgun_ibuffer)
               
                
buffer[0] = ArrayGetCell(g_extra_shotgun2_costi)
                
ArraySetCell(g_extra_shotgun_costg_extra_shotgun_ibuffer[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_namename)
        
ArrayPushCell(g_extra_smg_costcost)
       
        
ArrayPushCell(g_extra_smg_new1)
       
        new 
ibuffer[32], size ArraySize(g_extra_smg2_realname)
        for (
0sizei++)
        {
                
ArrayGetString(g_extra_smg2_realnameibuffercharsmax(buffer))
               
                if (!
equal(namebuffer))
                        continue;
               
                
ArraySetCell(g_extra_smg_newg_extra_smg_i0)
               
                
ArrayGetString(g_extra_smg2_nameibuffercharsmax(buffer))
                
ArraySetString(g_extra_smg_nameg_extra_smg_ibuffer)
               
                
buffer[0] = ArrayGetCell(g_extra_smg2_costi)
                
ArraySetCell(g_extra_smg_costg_extra_smg_ibuffer[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_namename)
        
ArrayPushCell(g_extra_rifle_costcost)
       
        
ArrayPushCell(g_extra_rifle_new1)
       
        new 
ibuffer[32], size ArraySize(g_extra_rifle2_realname)
        for (
0sizei++)
        {
                
ArrayGetString(g_extra_rifle2_realnameibuffercharsmax(buffer))
               
                if (!
equal(namebuffer))
                        continue;
               
                
ArraySetCell(g_extra_rifle_newg_extraitem_i0)
               
                
ArrayGetString(g_extra_rifle2_nameibuffercharsmax(buffer))
                
ArraySetString(g_extra_rifle_nameg_extraitem_ibuffer)
               
                
buffer[0] = ArrayGetCell(g_extra_rifle2_costi)
                
ArraySetCell(g_extra_rifle_costg_extraitem_ibuffer[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_namename)
        
ArrayPushCell(g_extra_sniper_costcost)
       
        
ArrayPushCell(g_extra_sniper_new1)
       
        new 
ibuffer[32], size ArraySize(g_extra_sniper2_realname)
        for (
0sizei++)
        {
                
ArrayGetString(g_extra_sniper2_realnameibuffercharsmax(buffer))
               
                if (!
equal(namebuffer))
                        continue;
               
                
ArraySetCell(g_extra_sniper_newg_snipers_i0)
               
                
ArrayGetString(g_extra_sniper2_nameibuffercharsmax(buffer))
                
ArraySetString(g_extra_sniper_nameg_snipers_ibuffer)
               
                
buffer[0] = ArrayGetCell(g_extra_sniper2_costi)
                
ArraySetCell(g_extra_sniper_costg_snipers_ibuffer[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_launchernamename)
        
ArrayPushCell(g_launchercostcost)
       
        
ArrayPushCell(g_extra_launcher_new1)
       
        new 
ibuffer[32], size ArraySize(g_launcher_realname)
        for (
0sizei++)
        {
                
ArrayGetString(g_launcher_realnameibuffercharsmax(buffer))
               
                if (!
equal(namebuffer))
                        continue;
               
                
ArraySetCell(g_extra_launcher_newg_launchers_i0)
       
                
ArrayGetString(g_launcher2nameibuffercharsmax(buffer))
                
ArraySetString(g_launchernameg_launchers_ibuffer)
               
                
buffer[0] = ArrayGetCell(g_launcher2costi)
                
ArraySetCell(g_launchercostg_launchers_ibuffer[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(idcash)
{
        
cs_set_user_money(idcash)
}
 
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
        while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) { /* keep looping */ }
        return 
entity;
}
 
stock fm_give_item(id, const item[])
{
        static 
ent
        ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem))
        if (!
pev_valid(ent)) return;
       
        static 
Float:originF[3]
        
pev(idpev_originoriginF)
        
set_pev(entpev_originoriginF)
        
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
        
dllfunc(DLLFunc_Spawnent)
       
        static 
save
        save 
pev(entpev_solid)
        
dllfunc(DLLFunc_Touchentid)
        if (
pev(entpev_solid) != save)
                return;
       
        
engfunc(EngFunc_RemoveEntityent)
}
 
stock cs_weapon_name_to_id(const weapon[])
{
        static 
i
        
for (0sizeof WEAPONENTNAMESi++)
        {
                if (
equal(weaponWEAPONENTNAMES[i]))
                        return 
i;
        }
       
        return 
0;
}
 
stock drop_weapons(iddropwhat)
{
        static 
weapons[32], numiweaponid
        num 
0
        get_user_weapons
(idweaponsnum)
        for (
0numi++)
        {
                
weaponid weapons[i]
               
                if ((
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
                {
                        static 
wname[32], weapon_ent
                        get_weaponname
(weaponidwnamecharsmax(wname))
                        
weapon_ent fm_find_ent_by_owner(-1wnameid)
                        
set_pev(weapon_entPEV_ADDITIONAL_AMMOcs_get_user_bpammo(idweaponid))
                        
engclient_cmd(id"drop"wname)
                        
cs_set_user_bpammo(idweaponid0)
                }
        }

1.Do Can someone explain to me the code
Agent475 is offline
Send a message via Skype™ to Agent475
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode