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

Request plugin code for menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KING of Gold
Member
Join Date: Dec 2017
Old 01-17-2018 , 11:50   Request plugin code for menu
Reply With Quote #1

Hello, I wanted a code that could open my menu to terrorist only:

This is my menu code:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Weapons Menu Vip Trr"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define ADMINLEVEL  ADMIN_LEVEL_H

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /vmenuT""ShowMenu"ADMINLEVEL"Weapons Menu Vip Trr")
    
    
RegisterHam(Ham_Spawn"player""ShowMenu"1)
}

// menu
public ShowMenu(idlvlcid)
{
    if(!
cmd_access(idlvlcid0))
        return 
PLUGIN_HANDLED;

    new 
menu menu_create("\yWeapons Menu \w(\rVIP\w)""WeaponsMenu");

    
menu_additem(menu"Ak47 \yAnd \wDeagle"""0); // case 0
    
menu_additem(menu"M4A1 \yAnd \wDeagle"""0); // case 1
    
menu_additem(menu"Awp \yAnd \wDeagle"""0); // case 2

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}
// Menu
public WeaponsMenu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0client_cmd(id"weapon_ak47;weapon_deagle");
        case 
1client_cmd(id"weapon_m4a1;weapon_deagle");
        case 
2client_cmd(id"weapon_awp;weapon_deagle");
    }

    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;

__________________
Cs KING of Gold
AlferD
KING of Gold is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-17-2018 , 12:03   Re: Request plugin code for menu
Reply With Quote #2

Cool?
__________________
edon1337 is offline
KING of Gold
Member
Join Date: Dec 2017
Old 01-17-2018 , 12:50   Re: Request plugin code for menu
Reply With Quote #3

fixed.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Weapons Menu Vip Trr"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define ADMINLEVEL  ADMIN_LEVEL_H

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /vmenuT""ShowMenu"ADMINLEVEL"Weapons Menu Vip Trr")
    
    
RegisterHam(Ham_Spawn"player""ShowMenu"1)
}

// menu
public ShowMenu(idlvlcid)
{
    if(!
cmd_access(idlvlcid0))
        return 
PLUGIN_HANDLED;

    new 
menu menu_create("\yWeapons Menu \w(\rVIP\w)""WeaponsMenu");
 if(
cs_get_user_team(id) & CS_TEAM_T) {
    
menu_additem(menu"Ak47 \yAnd \wDeagle"""0); // case 0
    
menu_additem(menu"M4A1 \yAnd \wDeagle"""0); // case 1
    
menu_additem(menu"Awp \yAnd \wDeagle"""0); // case 2
 
}
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}
// Menu
public WeaponsMenu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0client_cmd(id"weapon_ak47;weapon_deagle");
        case 
1client_cmd(id"weapon_m4a1;weapon_deagle");
        case 
2client_cmd(id"weapon_awp;weapon_deagle");
    }

    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;

Can a terrorist open a menu with the B button and the terrorist will open a different menu with the B button?
__________________
Cs KING of Gold
AlferD

Last edited by KING of Gold; 01-17-2018 at 12:50.
KING of Gold is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-17-2018 , 13:33   Re: Request plugin code for menu
Reply With Quote #4

Yes.
Hook "buy", check the team, show the desired menu.
__________________
My English is A0
E1_531G is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-17-2018 , 13:55   Re: Request plugin code for menu
Reply With Quote #5

You must check for client's team right after cmd_access.
If user's team is not equal to T, then returning HANDLE on true stat.
__________________
Relaxing is offline
KING of Gold
Member
Join Date: Dec 2017
Old 01-18-2018 , 10:44   Re: Request plugin code for menu
Reply With Quote #6

???
__________________
Cs KING of Gold
AlferD
KING of Gold is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 01-18-2018 , 12:05   Re: Request plugin code for menu
Reply With Quote #7

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Weapons Menu Vip Trr"
#define VERSION "1.0"
#define AUTHOR "AlferD"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /vmenu", "ShowMenu")
    register_clcmd("client_buy_open", "ShowMenu")
}

public ShowMenu(id)
{
    if(!is_user_alive(id))
        return PLUGIN_HANDLED
    new flags = get_user_flags(id)
    if(!(flags & ADMIN_LEVEL_H))
    {
        client_print(id,print_chat,"You have no access to this command")
        return PLUGIN_HANDLED
    }

    new menu = menu_create("\yWeapons Menu \w(\rVIP\w)", "WeaponsMenu");
    if(get_user_team(id) == 1)
    {
    menu_additem(menu, "Ak47 \yAnd \wDeagle", "", 0); // case 0
    menu_additem(menu, "M4A1 \yAnd \wDeagle", "", 0); // case 1
    menu_additem(menu, "Awp \yAnd \wDeagle", "", 0); // case 2
    }
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, menu, 0);

    return PLUGIN_HANDLED;
}
// Menu
public WeaponsMenu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_cancel(id);
        return PLUGIN_HANDLED;
    }
    switch(item)
    {
        case 0:
        {
            strip_user_weapons(id)
            give_item(id, "weapon_ak47")
            cs_set_user_bpammo(id,CSW_AK47,90)
            give_item(id, "weapon_deagle")
            cs_set_user_bpammo(id,CSW_DEAGLE,35)
            give_item(id, "weapon_knife")
        }
        case 1:
        {
            strip_user_weapons(id)
            give_item(id, "weapon_m4a1");
            cs_set_user_bpammo(id,CSW_M4A1,90)
            give_item(id, "weapon_deagle")
            cs_set_user_bpammo(id,CSW_DEAGLE,35)
            give_item(id, "weapon_knife")
        }            
        case 2:
        {
            strip_user_weapons(id)
            give_item(id, "weapon_awp")
            cs_set_user_bpammo(id, CSW_AWP, 30);
            give_item(id, "weapon_deagle")
            cs_set_user_bpammo(id,CSW_DEAGLE,35)
            give_item(id, "weapon_knife")

        }
    }

    menu_destroy(menu);

    return PLUGIN_HANDLED;
}

Last edited by raizo11; 01-18-2018 at 13:14.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-18-2018 , 12:42   Re: Request plugin code for menu
Reply With Quote #8

Quote:
Originally Posted by raizo11 View Post
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Weapons Menu Vip Trr"
#define VERSION "1.0"
#define AUTHOR "AlferD"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /vmenu", "ShowMenu")
    register_clcmd("client_buy_open", "ShowMenu")
}

public ShowMenu(id)
{
    if(!is_user_connected(id))
        return PLUGIN_HANDLED
    new flags = get_user_flags(id)
    if(!(flags & ADMIN_LEVEL_H))
    {
        client_print(id,print_chat,"You have no access to this command")
        return PLUGIN_HANDLED
    }

    new menu = menu_create("\yWeapons Menu \w(\rVIP\w)", "WeaponsMenu");
    if(get_user_team(id) == 1)
    {
    menu_additem(menu, "Ak47 \yAnd \wDeagle", "", 0); // case 0
    menu_additem(menu, "M4A1 \yAnd \wDeagle", "", 0); // case 1
    menu_additem(menu, "Awp \yAnd \wDeagle", "", 0); // case 2
    }
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, menu, 0);

    return PLUGIN_HANDLED;
}
// Menu
public WeaponsMenu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_cancel(id);
        return PLUGIN_HANDLED;
    }
    switch(item)
    {
        case 0:
        {
            strip_user_weapons(id)
            give_item(id, "weapon_ak47")
            cs_set_user_bpammo(id,CSW_AK47,90)
            give_item(id, "weapon_deagle")
            cs_set_user_bpammo(id,CSW_DEAGLE,35)
            give_item(id, "weapon_knife")
        }
        case 1:
        {
            strip_user_weapons(id)
            give_item(id, "weapon_m4a1");
            cs_set_user_bpammo(id,CSW_M4A1,90)
            give_item(id, "weapon_deagle")
            cs_set_user_bpammo(id,CSW_DEAGLE,35)
            give_item(id, "weapon_knife")
        }            
        case 2:
        {
            strip_user_weapons(id)
            give_item(id, "weapon_awp")
            cs_set_user_bpammo(id, CSW_AWP, 30);
            give_item(id, "weapon_deagle")
            cs_set_user_bpammo(id,CSW_DEAGLE,35)
            give_item(id, "weapon_knife")

        }
    }

    menu_destroy(menu);

    return PLUGIN_HANDLED;
}
Read my previous post.
Also use is_user_alive rather than checking if he's on connected.
__________________
Relaxing is offline
Reply



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


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