Raised This Month: $183 Target: $400
 45% 

Solved Vip Gun Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GaBy96
Member
Join Date: Oct 2012
Location: Romania
Old 09-29-2020 , 13: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
__________________

Last edited by GaBy96; 10-01-2020 at 12:05.
GaBy96 is offline
Send a message via AIM to GaBy96 Send a message via Yahoo to GaBy96 Send a message via Skype™ to GaBy96
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-30-2020 , 21:21   Re: Vip Gun Menu
Reply With Quote #2

Edit One of those:
PHP Code:
public eventNewRound()
{
    new 
iPlayers[32], iPnum
    get_players
(iPlayersiPnum"ch");
    for(new 
iPlayer0iPnumi++)
    {
        
iPlayer iPlayers[i]
        
CmdVipWeapons(iPlayer)
    }
    
round++;

PHP Code:
public hamSpawn(id)
{
    if(
is_user_alive(id) && is_user_connected(id))
    {
        
CmdVipWeapons(id)
    }
    
countOpeningMenu[id] = 0;

__________________

Last edited by Supremache; 09-30-2020 at 21:22.
Supremache is offline
GaBy96
Member
Join Date: Oct 2012
Location: Romania
Old 10-01-2020 , 12:04   Re: Vip Gun Menu
Reply With Quote #3

Thanks
__________________
GaBy96 is offline
Send a message via AIM to GaBy96 Send a message via Yahoo to GaBy96 Send a message via Skype™ to GaBy96
sir_PaBlo
Member
Join Date: Sep 2020
Location: Urmia
Old 10-02-2020 , 04:51   Re: Vip Gun Menu
Reply With Quote #4

How can I add a VIP to this plugin?
sir_PaBlo is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 10-02-2020 , 06:43   Re: Vip Gun Menu
Reply With Quote #5

Quote:
Originally Posted by sir_PaBlo View Post
How can I add a VIP to this plugin?
Edit this line:
PHP Code:
#define ACCESS_FLAG VIP_FLAG_A 
__________________
Supremache is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-02-2020 , 10:08   Re: Vip Gun Menu
Reply With Quote #6

native is_user_alive(index);

Note

This will never return true if a client is not connected. If you need
to know whether a client is alive, an additional call to
is_user_connected() is unnecessary.

https://www.amxmodx.org/api/amxmodx/is_user_alive

PHP Code:
public hamSpawn(id)
{
    if(
is_user_alive(id) && is_user_connected(id))
    {
        
CmdVipWeapons(id)
    }
    
countOpeningMenu[id] = 0;



PHP Code:
public hamSpawn(id)
{
    if(
is_user_alive(id))
    {
        
CmdVipWeapons(id)
    }
    
countOpeningMenu[id] = 0;

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
iceeedr is online now
Send a message via Skype™ to iceeedr
GaBy96
Member
Join Date: Oct 2012
Location: Romania
Old 10-03-2020 , 04:48   Re: Vip Gun Menu
Reply With Quote #7

Quote:
Originally Posted by sir_PaBlo View Post
How can I add a VIP to this plugin?
This is the plugin for vip system
__________________
GaBy96 is offline
Send a message via AIM to GaBy96 Send a message via Yahoo to GaBy96 Send a message via Skype™ to GaBy96
Mohamed null
BANNED
Join Date: Sep 2020
Location: Algeria
Old 10-30-2020 , 10:10   Re: Vip Gun Menu
Reply With Quote #8

i vips online ADMIN_LEVEL_H
Click m
and saw
VIP MENU:
Models Menu
Knifes Menu
Glow Menu
Health Menu
Mohamed null is offline
Reply


Thread Tools
Display Modes

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 19:10.


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