Raised This Month: $51 Target: $400
 12% 

[EDIT] Menu For CT only + CallBack feature


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 07-22-2014 , 17:01   [EDIT] Menu For CT only + CallBack feature
Reply With Quote #1

Hello Every one !
i want help from you guys to edit this menu for me to make it works only with CT team and add to the first code Callback feature so the menu will be always on screen for CT players
Code:
PHP Code:
/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <hamsandwich>

public plugin_init() 

    
register_plugin("JailBreak Guards Menu""1.0""HUMAN"); 
    
register_clcmd("say /menu""ShowMenu"_"");
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)


public 
ShowMenu(id


    new 
menu menu_create("\rJailbreak Guards Menu!""ModsMenu_Handler"); 

    
menu_additem(menu"\yChoose Your \rGuard Class"""0); // case 0 
    
menu_additem(menu"\yBe \rThe Simon"""0); // case 1 
    
menu_additem(menu"\yOpen Jail Doors"""0); // case 2 
    
menu_additem(menu"\yDays Menu"""0); // case 3 
    
menu_additem(menu"\yCountdown Menu"""0); // case 4 
    
menu_additem(menu"\yGlow Menu"""0); // case 5
    
menu_additem(menu"\yFreeDay Menu"""0); // case 6
    
menu_additem(menu"\yBall Menu"""0); // case 7
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL); 
    
menu_setprop(menuMPROP_BACKNAME"\wBack"); 
    
menu_setprop(menuMPROP_NEXTNAME"\wNext"); 
    
menu_setprop(menuMPROP_EXITNAME"\wExit"); 
    
menu_setprop(menuMPROP_NOCOLORS1); 

    
menu_display(idmenu0); 

    return 
PLUGIN_HANDLED


public 
ModsMenu_Handler(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"say /class"); 
        case 
1client_cmd(id"say /simon"); 
        case 
2client_cmd(id"say /open"); 
        case 
3client_cmd(id"say /daysmenu"); 
        case 
4client_cmd(id"say /cd"); 
        case 
5client_cmd(id"say /glow");
        case 
6client_cmd(id"say /fd");
        case 
7client_cmd(id"say /ball");

    } 

    
menu_destroy(menu); 

    return 
PLUGIN_HANDLED
}
public 
fwHamPlayerSpawnPost(id)
{
    
ShowMenu(id)

Help Please
Thanks for your attention
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه

Last edited by 5aloOod; 07-22-2014 at 17:30.
5aloOod is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 07-22-2014 , 17:55   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #2

try this NOT TESTED
PHP Code:
/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <hamsandwich>
#include <cstrike>
public plugin_init() 

    
register_plugin("JailBreak Guards Menu""1.0""HUMAN"); 
    
register_clcmd("say /menu""ShowMenu")
    


public 
ShowMenu(id
{
    if(
cs_get_user_team(id) != CS_TEAM_CT)
    {
        return 
PLUGIN_HANDLED;
    }
     
    new 
menu menu_create("\rJailbreak Guards Menu!""ModsMenu_Handler"); 
    
    
menu_additem(menu"\yChoose Your \rGuard Class"""0); // case 0 
    
menu_additem(menu"\yBe \rThe Simon"""0); // case 1 
    
menu_additem(menu"\yOpen Jail Doors"""0); // case 2 
    
menu_additem(menu"\yDays Menu"""0); // case 3 
    
menu_additem(menu"\yCountdown Menu"""0); // case 4 
    
menu_additem(menu"\yGlow Menu"""0); // case 5
    
menu_additem(menu"\yFreeDay Menu"""0); // case 6
    
menu_additem(menu"\yBall Menu"""0); // case 7
        
        
    
menu_display(idmenu0); 
    return 
PLUGIN_HANDLED
    
    


public 
ModsMenu_Handler(idmenuitem

    if(
item == MENU_EXIT
    { 
        
menu_destroy(menu); 
        return 
PLUGIN_HANDLED
    } 
    

    switch(
item
    { 
        case 
0client_cmd(id"say /class"); 
        case 
1client_cmd(id"say /simon"); 
        case 
2client_cmd(id"say /open"); 
        case 
3client_cmd(id"say /daysmenu"); 
        case 
4client_cmd(id"say /cd"); 
        case 
5client_cmd(id"say /glow");
        case 
6client_cmd(id"say /fd");
        case 
7client_cmd(id"say /ball");

    } 

    
menu_destroy(menu); 

    return 
PLUGIN_HANDLED

GinNNy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-22-2014 , 18:06   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #3

And what should this callback feature be? I mean, I didn't got the idea... What do you mean by "always on the screen"?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 07-22-2014 , 19:01   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #4

Thanks ginny for your help. Works great

Quote:
Originally Posted by Flick3rR View Post
And what should this callback feature be? I mean, I didn't got the idea... What do you mean by "always on the screen"?
Like when player choose "Days Menu" so another menu will popup, then when the other menu closed i want to this menu come back automatically. so it will be always on
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 07-22-2014 , 20:21   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #5

So after some testing to detect menu close / exit, didn't workout well..
so anyway, this is the best I can give

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

#define PLUGIN "Jailbreak guard system"
#define VERSION "1.0.1"
#define AUTHOR "Xalus"

#define ITEMS_Guardmenu 8

enum _:enumGuardmenu
{
    
guardItem[32],
    
guardSay[20]
}

new const 
g_arrayGuardMenu[ITEMS_Guardmenu][enumGuardmenu] =
{
    {
"\yChoose Your \rGuard Class""/class"},
    {
"\yBe \rThe Simon""/simon"},
    {
"\yOpen Jail Doors""/open"},
    {
"\yDays Menu""/daysmenu"},
    {
"\yCountdown Menu""/cd"},
    {
"\yGlow Menu""/glow"},
    {
"\yFreeDay Menu""/fd"},
    {
"\yBall Menu""/ball"}
}

new 
g_intGuardmenu

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Register: Ham
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn_Post"1)
    
    
// Register: Menu
    
static strTemp[100]
    if(!
strTemp[0])
    {
        
formatex(strTempcharsmax(strTemp), "\rJailbreak Guards Menu!^n\dVersion: %s"VERSION)
    }
    
g_intGuardmenu menu_create(strTemp"Handler_Menu_Guard")
    
    for(new 
0ITEMS_Guardmenui++)
    {
        
menu_additem(g_intGuardmenug_arrayGuardMenu[i][guardItem])
    }
    
menu_setprop(g_intGuardmenuMPROP_EXITMEXIT_NEVER)
}
// Public: Ham
public Ham_PlayerSpawn_Post(id)
{
    if(
is_user_alive(id))
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
menu_display(idg_intGuardmenu)
        }
        else 
        {
            
// Cancel for possible teamchangers?
            
menu_cancel(id)
        }
    }
}

// Public: Menu's
public Handler_Menu_Guard(idmenuitem)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(
item != MENU_EXIT)
        {
            
client_cmd(id"say %s"g_arrayGuardMenu[item][guardSay])
            
            
menu_display(idg_intGuardmenu)
        }
        else if(!
task_exists(id 25174))
        {
            
set_task(1.0"Task_Menu_Guard"id 25174, .flags="b")
        }
    }
}

public 
Task_Menu_Guard(id)
{
    
id -= 25174
    
if(is_user_alive(id)
    && 
cs_get_user_team(id) == CS_TEAM_CT)
    {
        new 
intInfo[3]
        
player_menu_info(idintInfo[0], intInfo[1], intInfo[2]);
        
        if(
intInfo[1] == g_intGuardmenu)
        {
            
remove_task(id 25174)
        }
        else if(
intInfo[1] < && intInfo[0] < 1)
        {
            
menu_display(idg_intGuardmenu)
            
remove_task(id 25174)
        }
        return
    }
    
remove_task(id 25174)

__________________
Retired.

Last edited by Xalus; 07-23-2014 at 06:10.
Xalus is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 07-23-2014 , 01:42   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #6

Thanks Xalus for your help. Tested and worked great
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 07-23-2014 , 03:45   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #7

only one thing the plugin blocks some other menus like default amxmodx menu
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه

Last edited by 5aloOod; 07-23-2014 at 05:47.
5aloOod is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 07-23-2014 , 06:08   Re: [EDIT] Menu For CT only + CallBack feature
Reply With Quote #8

Quote:
Originally Posted by 5aloOod View Post
only one thing the plugin blocks some other menus like default amxmodx menu
Updated post.
__________________
Retired.
Xalus 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 08:16.


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