Raised This Month: $32 Target: $400
 8% 

Solved Vip Gun Menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GaBy96
Member
Join Date: Oct 2012
Location: Spain
Old 09-29-2020 , 12:38   Vip Gun Menu
Reply With Quote #1

PHP Code:
/* VSWeapons v1.3 

Description:
    Weapons: M4A1, AK47, AWP, Galil, Famas, Desert Eagle and grenades.
Cvars:
    vs_amount_opening_weapons_menu - quantity of times of opening of the menu for one life.
    Note: 0 - not limited.
    vs_available_round - since round will be available for the menu.
    Note: 0 - not limited.
Default access flag:
    VIP_FLAG_Z.
Type:
    Selectable.
Commands:
    vip_weapons - weapons menu.
*/

#include <amxmodx>
#include <VIPSystem>
#include <hamsandwich>
#include <fakemeta>

#define ACCESS_FLAG VIP_FLAG_A

new curItem;

new 
round 0;

new 
weapons[18] = {CSW_SCOUTCSW_XM1014CSW_MAC10CSW_AUGCSW_UMP45CSW_SG550CSW_GALILCSW_FAMASCSW_AWP
    
CSW_MP5NAVYCSW_M249CSW_M3CSW_M4A1CSW_TMPCSW_G3SG1CSW_SG552CSW_AK47CSW_P90
}

new 
pistols[6] = {CSW_P228CSW_ELITECSW_FIVESEVENCSW_GALILCSW_USPCSW_GLOCK18}

new 
cvarAmountOpeningWeaponsMenucvarAvailableRound;

new 
countOpeningMenu[32];

public 
plugin_init() 
{
    
register_plugin("VSWeapons""1.3""ZETA [M|E|N]");
    
    
cvarAmountOpeningWeaponsMenu register_cvar("vs_amount_opening_weapons_menu""1");
    
cvarAvailableRound register_cvar("vs_available_round""2");
    
    
register_clcmd("vip_weapons""CmdVipWeapons"ADMIN_ALL"Show Vip Weapons Menu");
    
    
register_event("HLTV""eventNewRound""a""1=0""2=0");
    
RegisterHam(Ham_Spawn"player""hamSpawn"1);
    
    
curItem VSRegisterItem("Weapons"ACCESS_FLAG);
}

public 
CmdVipWeapons(id)
{
    if (
VSGetVipFlag(idACCESS_FLAG))
    {
        new 
availableRound get_pcvar_num(cvarAvailableRound);
        
        if ((
availableRound != 0) && (round <= availableRound))
        {
            
client_print(idprint_chat"Weapons can be selected after %d rounds."availableRound);
            return 
PLUGIN_HANDLED;
        }
        
        new 
amountOpeningWeaponsMenu get_pcvar_num(cvarAmountOpeningWeaponsMenu);

        if ((
amountOpeningWeaponsMenu  != 0) && (countOpeningMenu[id] >= amountOpeningWeaponsMenu ))
        {
            
client_print(idprint_chat"The pistols menu can be opened %d times per round"amountOpeningWeaponsMenu);
            return 
PLUGIN_HANDLED;
        }
        
        
countOpeningMenu[id]++;
        
        
ShowWeaponsMenu(id);
    }
    
    return 
PLUGIN_HANDLED;
}

public 
VSItemSelected(iditemid)
{
    if ((
itemid == curItem))
    {
        new 
availableRound get_pcvar_num(cvarAvailableRound);
        
        if ((
availableRound != 0) && (round <= availableRound))
        {
            
client_print(idprint_chat"Weapons can be selected after %d rounds."availableRound);
            return 
PLUGIN_HANDLED;
        }
        
        new 
amountOpeningWeaponsMenu get_pcvar_num(cvarAmountOpeningWeaponsMenu);

        if ((
amountOpeningWeaponsMenu  != 0) && (countOpeningMenu[id] >= amountOpeningWeaponsMenu ))
        {
            
client_print(idprint_chat"The pistols menu can be opened %d times per round"amountOpeningWeaponsMenu);
            return 
PLUGIN_HANDLED;
        }
        
        
countOpeningMenu[id]++;
        
        
ShowWeaponsMenu(id);
    }
    
    return 
PLUGIN_HANDLED;
}

StripWeapons(id)
{
    for (new 
018i++)
    {
        if (
fm_strip_user_gun(idweapons[i]))
        {
            break;
        }
    }
}

public 
ShowWeaponsMenu(id)
{
    new 
menu menu_create("Weapons""WeaponsMenuHandler");
    
    
menu_additem(menu"Colt M4A1");
    
menu_additem(menu"AK47");
    
menu_additem(menu"AWP");
    
menu_additem(menu"Galil");
    
menu_additem(menu"Famas");
    
menu_additem(menu"Desert Eagle");
    
menu_additem(menu"Grenades");
    
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
WeaponsMenuHandler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    switch(
item)
    {
        case 
0:
        {
            
StripWeapons(id);
            
fm_give_item(id"weapon_m4a1");
            
ExecuteHam(Ham_GiveAmmoid90"556nato"90);
        }
        case 
1:
        {
            
StripWeapons(id);
            
fm_give_item(id"weapon_ak47");
            
ExecuteHam(Ham_GiveAmmoid90"762nato"90);
        }
        case 
2:
        {
            
StripWeapons(id);
            
fm_give_item(id"weapon_awp");
            
ExecuteHam(Ham_GiveAmmoid30"338magnum"30);
        }
        case 
3:
        {
            
StripWeapons(id);
            
fm_give_item(id"weapon_galil");
            
ExecuteHam(Ham_GiveAmmoid90"556nato"90);
        }
        case 
4:
        {
            
StripWeapons(id);
            
fm_give_item(id"weapon_famas");
            
ExecuteHam(Ham_GiveAmmoid90"556nato"90);
        }
        case 
5:
        {
            for (new 
06i++)
            {
                if (
fm_strip_user_gun(idpistols[i]))
                {
                    break;
                }
            }
            
            
fm_give_item(id"weapon_deagle");
            
ExecuteHam(Ham_GiveAmmoid35"50ae"35);
        }
        case 
6:
        {
            
fm_give_item(id"weapon_hegrenade");
            
fm_give_item(id"weapon_flashbang");
            
fm_give_item(id"weapon_flashbang");
            
fm_give_item(id"weapon_smokegrenade");
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
eventNewRound()
{
    
round++;
}

public 
hamSpawn(id)
{
    
countOpeningMenu[id] = 0;
}

stock fm_give_item(index, const item[]) 
{
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
        return 
0;
    
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem));
    if (!
pev_valid(ent))
        return 
0;

    new 
Float:origin[3];
    
pev(indexpev_originorigin);
    
set_pev(entpev_originorigin);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);

    new 
save pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentindex);
    if (
pev(entpev_solid) != save)
        return 
ent;

    
engfunc(EngFunc_RemoveEntityent);

    return -
1;
}

stock bool:fm_strip_user_gun(indexwid 0, const wname[] = "") {
    new 
ent_class[32];
    if (!
wid && wname[0])
        
copy(ent_classsizeof ent_class 1wname);
    else {
        new 
weapon widclipammo;
        if (!
weapon && !(weapon get_user_weapon(indexclipammo)))
            return 
false;
        
        
get_weaponname(weaponent_classsizeof ent_class 1);
    }

    new 
ent_weap fm_find_ent_by_owner(-1ent_classindex);
    if (!
ent_weap)
        return 
false;

    
engclient_cmd(index"drop"ent_class);

    new 
ent_box pev(ent_weappev_owner);
    if (!
ent_box || ent_box == index)
        return 
false;

    
dllfunc(DLLFunc_Thinkent_box);

    return 
true;
}

stock fm_find_ent_by_owner(index, const classname[], ownerjghgtype 0) {
    new 
strtype[11] = "classname"ent index;
    switch (
jghgtype) {
        case 
1strtype "target";
        case 
2strtype "targetname";
    }

    while ((
ent engfunc(EngFunc_FindEntityByStringentstrtypeclassname)) && pev(entpev_owner) != owner) {}

    return 
ent;


Hi can someone help me to make this menu appear automatically so I don't have to give /vm to be able to access them
__________________

We have over 400 skins on weapons and 5 types for hands!
Costumes for players!
New style for Top15 and stats!
Kill marks, molotov!
And many more are waiting for you to play!

Last edited by GaBy96; 10-01-2020 at 11:05.
GaBy96 is offline
Send a message via Skype™ to GaBy96
 



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:02.


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