Raised This Month: $60 Target: $400
 15% 

[REQ] Vipmenu Help


Post New Thread Closed Thread   
 
Thread Tools Display Modes
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-03-2013 , 05:57   Re: [REQ] Vipmenu Help
#21

Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
 
#define ACCESSFLAG_MAX_LENGTH 2
 
// Settings file
new bool:has_used[33]   
 
// Access flags
new g_access_vip[ACCESSFLAG_MAX_LENGTH] = "t"
 
public plugin_init()
{
       register_plugin("[HNS] VIP", "1.0", "FY E1")
 
       register_clcmd( "say /vipmenu", "VIPMenu");
       register_clcmd( "say_team /vipmenu", "VIPMenu");
 
       register_logevent("event_new_round", 2, "1=Round_Start")       
}
 
public VIPMenu( id ) 
{ 
    if(!has_used[id]) 
    {          
        new vip_menu = menu_create( "Vipmenu:", "menu_handler" ); 
        menu_additem( vip_menu, "Health", "1", 0 ); 
        menu_additem( vip_menu, "Weapon", "2", 0 ); 
        menu_additem( vip_menu, "Granade", "3", 0); 
 
        menu_setprop( vip_menu, MPROP_EXIT, MEXIT_ALL ); 
        menu_display( id, vip_menu, 0 ); 
    }
} 
 
public menu_handler( id, item, menu ) 
{ 
    if( item == MENU_EXIT )
    {
    	menu_destroy( menu );
	return PLUGIN_HANDLED;
    }
    
    switch( item ) 
    { 
        case 1: 
        { 
            if (!(get_user_flags(id) & read_flags(g_access_vip)))
                return PLUGIN_CONTINUE;
 
            set_user_health( id, 150 );
        } 
        case 2: 
        { 
            if (!(get_user_flags(id) & read_flags(g_access_vip)))
                return PLUGIN_CONTINUE;
 
            give_item( id, "weapon_usp" )
        } 
        case 3: 
        { 
            if (!(get_user_flags(id) & read_flags(g_access_vip)))
                return PLUGIN_CONTINUE;
 
            give_item( id, "weapon_hegrenade" )
            give_item( id, "weapon_flashbang" )
            give_item( id, "weapon_smokegrenade" )
        }
    }
    return PLUGIN_HANDLED;
}    
 
public event_new_round( ) 
{
	for( new i = 1; i <= get_maxplayers( ); i++ )	
		has_used[ i ] = false;
}
TheDS1337 is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-03-2013 , 07:31   Re: [REQ] Vipmenu Help
#22

Quote:
Originally Posted by DeagLe.Studio View Post
Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>

#define ACCESSFLAG_MAX_LENGTH 2

// Settings file
new bool:has_used[33] 

// Access flags
new g_access_vip[ACCESSFLAG_MAX_LENGTH] = "t"

public plugin_init()
{
register_plugin("[HNS] VIP", "1.0", "FY E1")

register_clcmd( "say /vipmenu", "VIPMenu");
register_clcmd( "say_team /vipmenu", "VIPMenu");

register_logevent("event_new_round", 2, "1=Round_Start") 
}

public VIPMenu( id ) 
{ 
if(!has_used[id]) 
{ 
new vip_menu = menu_create( "Vipmenu:", "menu_handler" ); 
menu_additem( vip_menu, "Health", "1", 0 ); 
menu_additem( vip_menu, "Weapon", "2", 0 ); 
menu_additem( vip_menu, "Granade", "3", 0); 

menu_setprop( vip_menu, MPROP_EXIT, MEXIT_ALL ); 
menu_display( id, vip_menu, 0 ); 
}
} 

public menu_handler( id, item, menu ) 
{ 
if( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}

switch( item ) 
{ 
case 1: 
{ 
if (!(get_user_flags(id) & read_flags(g_access_vip)))
return PLUGIN_CONTINUE;

set_user_health( id, 150 );
} 
case 2: 
{ 
if (!(get_user_flags(id) & read_flags(g_access_vip)))
return PLUGIN_CONTINUE;

give_item( id, "weapon_usp" )
} 
case 3: 
{ 
if (!(get_user_flags(id) & read_flags(g_access_vip)))
return PLUGIN_CONTINUE;

give_item( id, "weapon_hegrenade" )
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_smokegrenade" )
}
}
return PLUGIN_HANDLED;
} 

public event_new_round( ) 
{
for( new i = 1; i <= get_maxplayers( ); i++ ) 
has_used[ i ] = false;
}
0 error compiler and cannot open /vipmenu


Last edited by YamiKaitou; 06-03-2013 at 14:37.
Kellan123 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-03-2013 , 08:14   Re: [REQ] Vipmenu Help
#23

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

#define VIP_ACCESS ( 1 << 20 ) // flag "t"

new bool:g_IsUsedMenu[ 33 ];

new const g_MenuInfo[ ][ ] =
{
	"0",
	"1",
	"2"
};

new const g_MenuItems[ ][ ] = 
{
	"Health", // 0
	"Weapon", // 1
	"Grenade" // 2
};

public plugin_init( )
{
	register_clcmd( "say vipmenu", "ClientCommand_VIPMenu" );
	register_clcmd( "say /vipmenu", "ClientCommand_VIPMenu" );
	register_clcmd( "say_team vipmenu", "ClientCommand_VIPMenu" );
	register_clcmd( "say_team /vipmenu", "ClientCommand_VIPMenu" );	
}

public ClientCommand_VIPMenu( Client )
{
	if( g_IsUsedMenu[ Client ] || !( get_user_flags( Client ) & VIP_ACCESS ) )
		return 1;
		
	Menu_VIP( Client );
	return 0;
}

public Menu_VIP( Client )
{
	static MenuIndex;
	MenuIndex = menu_create( "V.I.P Menu", "MenuHandler_VIP" );
	
	for( new ItemIndex = 0; ItemIndex < sizeof( g_MenuItems ); ItemIndex++ )	
		menu_additem( MenuIndex, g_MenuItems[ ItemIndex ], g_MenuInfo[ ItemIndex ] );	
	
	menu_setprop( MenuIndex, MPROP_EXITNAME, "Close Menu" );
	menu_display( Client, MenuIndex );
}

public MenuHandler_VIP( Client, ItemIndex, MenuIndex )
{
	if( ItemIndex == MENU_EXIT )
	{
		menu_destroy( MenuIndex );
		return 1;
	}
	
	static Info[ 2 ], Dummy, Item;
	menu_item_getinfo( MenuIndex, ItemIndex, Dummy, Info, charsmax( Info ), _, _, Dummy );
	Item = Info[ 0 ];	
	switch( Item )
	{
		case 0:		
			set_user_health( Client, 150 );		
		case 1:
			give_item( Client, "weapon_usp" );
		case 3:
		{
			give_item( Client, "weapon_hegrenade" );
			give_item( Client, "weapon_flashbang" );
			give_item( Client, "weapon_smokegrenade" );
		}
	}
	
	g_IsUsedMenu[ Client ] = true;
	return 1;
}
Here new one, test it

Last edited by TheDS1337; 06-03-2013 at 08:16.
TheDS1337 is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-03-2013 , 08:54   Re: [REQ] Vipmenu Help
#24

Quote:
Originally Posted by DeagLe.Studio View Post
Code:
#include < amxmodx >
#include < amxmisc >
#include < fun >

#define VIP_ACCESS ( 1 << 20 ) // flag "t"

new bool:g_IsUsedMenu[ 33 ];

new const g_MenuInfo[ ][ ] =
{
"0",
"1",
"2"
};

new const g_MenuItems[ ][ ] = 
{
"Health", // 0
"Weapon", // 1
"Grenade" // 2
};

public plugin_init( )
{
register_clcmd( "say vipmenu", "ClientCommand_VIPMenu" );
register_clcmd( "say /vipmenu", "ClientCommand_VIPMenu" );
register_clcmd( "say_team vipmenu", "ClientCommand_VIPMenu" );
register_clcmd( "say_team /vipmenu", "ClientCommand_VIPMenu" ); 
}

public ClientCommand_VIPMenu( Client )
{
if( g_IsUsedMenu[ Client ] || !( get_user_flags( Client ) & VIP_ACCESS ) )
return 1;

Menu_VIP( Client );
return 0;
}

public Menu_VIP( Client )
{
static MenuIndex;
MenuIndex = menu_create( "V.I.P Menu", "MenuHandler_VIP" );

for( new ItemIndex = 0; ItemIndex < sizeof( g_MenuItems ); ItemIndex++ ) 
menu_additem( MenuIndex, g_MenuItems[ ItemIndex ], g_MenuInfo[ ItemIndex ] ); 

menu_setprop( MenuIndex, MPROP_EXITNAME, "Close Menu" );
menu_display( Client, MenuIndex );
}

public MenuHandler_VIP( Client, ItemIndex, MenuIndex )
{
if( ItemIndex == MENU_EXIT )
{
menu_destroy( MenuIndex );
return 1;
}

static Info[ 2 ], Dummy, Item;
menu_item_getinfo( MenuIndex, ItemIndex, Dummy, Info, charsmax( Info ), _, _, Dummy );
Item = Info[ 0 ]; 
switch( Item )
{
case 0: 
set_user_health( Client, 150 ); 
case 1:
give_item( Client, "weapon_usp" );
case 3:
{
give_item( Client, "weapon_hegrenade" );
give_item( Client, "weapon_flashbang" );
give_item( Client, "weapon_smokegrenade" );
}
}

g_IsUsedMenu[ Client ] = true;
return 1;
}
Here new one, test it
L 06/03/2013 - 15:53:25: Invalid menu id 2(1)
L 06/03/2013 - 15:53:25: [AMXX] Displaying debug trace (plugin "hns_vip.amxx")
L 06/03/2013 - 15:53:25: [AMXX] Run time error 10: native error (native "menu_item_getinfo")
L 06/03/2013 - 15:53:25: [AMXX] [0] hns_vip.sma::MenuHandler_VIP (line 61)

Last edited by YamiKaitou; 06-03-2013 at 14:37.
Kellan123 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-03-2013 , 08:58   Re: [REQ] Vipmenu Help
#25

@ Kellan123 are you genuine? I've provided you with the best solution posted so far and your saying "bad code" yet you have no coding experience. *sigh*
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-03-2013 , 09:02   Re: [REQ] Vipmenu Help
#26

Quote:
Originally Posted by hornet View Post
@ Kellan123 are you genuine? I've provided you with the best solution posted so far and your saying "bad code" yet you have no coding experience. *sigh*
He is right, use he's plugin
TheDS1337 is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-03-2013 , 09:09   Re: [REQ] Vipmenu Help
#27

Quote:
Originally Posted by hornet View Post
@ Kellan123 are you genuine? I've provided you with the best solution posted so far and your saying "bad code" yet you have no coding experience. *sigh*
No.
Kellan123 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-03-2013 , 09:14   Re: [REQ] Vipmenu Help
#28

Code:
#include <amxmodx>
#include <fun>

// Settings var
new bool:has_used[33]   

// Access flags
#define ADMIN_VIP   ADMIN_LEVEL_H

public plugin_init()
{
    register_plugin("[HNS] VIP", "1.0", "hotnet")
    
    register_clcmd( "say /vipmenu", "VIPMenu");
    register_clcmd( "say_team /vipmenu", "VIPMenu");
    
    register_logevent("event_new_round", 2, "1=Round_Start");  
}

public VIPMenu( id ) 
{
    if( !has_used[ id ] && get_user_flags( id ) & ADMIN_VIP ) 
    {
        new iMenu = menu_create( "Vipmenu:", "menu_handler" );     
        menu_additem( iMenu, "Health" ); 
        menu_additem( iMenu, "Weapon" ); 
        menu_additem( iMenu, "Grenade" );  

        menu_display( id, iMenu ); 
    }
} 

public menu_handler( id, menu, item ) 
{ 
    if( item != MENU_EXIT ) 
    {
        
        switch( item ) 
        { 
            case 0: 
            { 
                set_user_health( id, 150 );
            }
            
            case 1: 
            { 
                give_item( id, "weapon_usp" )
            } 
            
            case 2: 
            { 
                give_item( id, "weapon_hegrenade" )
                give_item( id, "weapon_flashbang" )
                give_item( id, "weapon_smokegrenade" )
            }
        } 
        
        has_used[id] = true; 
    }
}
    
public event_new_round() 
    arrayset( has_used, false, sizeof has_used );
This is just to understand that's the same !
TheDS1337 is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-03-2013 , 09:16   Re: [REQ] Vipmenu Help
#29

Quote:
Originally Posted by DeagLe.Studio View Post
Code:
#include <amxmodx>
#include <fun>

// Settings var
new bool:has_used[33] 

// Access flags
#define ADMIN_VIP ADMIN_LEVEL_H

public plugin_init()
{
register_plugin("[HNS] VIP", "1.0", "hotnet")

register_clcmd( "say /vipmenu", "VIPMenu");
register_clcmd( "say_team /vipmenu", "VIPMenu");

register_logevent("event_new_round", 2, "1=Round_Start"); 
}

public VIPMenu( id ) 
{
if( !has_used[ id ] && get_user_flags( id ) & ADMIN_VIP ) 
{
new iMenu = menu_create( "Vipmenu:", "menu_handler" ); 
menu_additem( iMenu, "Health" ); 
menu_additem( iMenu, "Weapon" ); 
menu_additem( iMenu, "Grenade" ); 

menu_display( id, iMenu ); 
}
} 

public menu_handler( id, menu, item ) 
{ 
if( item != MENU_EXIT ) 
{

switch( item ) 
{ 
case 0: 
{ 
set_user_health( id, 150 );
}

case 1: 
{ 
give_item( id, "weapon_usp" )
} 

case 2: 
{ 
give_item( id, "weapon_hegrenade" )
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_smokegrenade" )
}
} 

has_used[id] = true; 
}
}

public event_new_round() 
arrayset( has_used, false, sizeof has_used );
This is just to understand that's the same !
#define ADMIN_VIP ADMIN_LEVEL_H

if( !has_used[ id ] && get_user_flags( id ) & ADMIN_VIP )

nextround does not open vipmenu

Last edited by YamiKaitou; 06-03-2013 at 14:38.
Kellan123 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-03-2013 , 09:23   Re: [REQ] Vipmenu Help
#30

Code:
#include <amxmodx>
#include <fun>
 
#define ACCESSFLAG_MAX_LENGTH 2
 
// Settings file
new bool:has_used[33]   
 
// Access flags
new g_access_vip[ACCESSFLAG_MAX_LENGTH] = "t"

public plugin_init()
{
    register_plugin("[HNS] VIP", "1.0", "hotnet")
    
    register_clcmd( "say /vipmenu", "VIPMenu");
    register_clcmd( "say_team /vipmenu", "VIPMenu");
    
    register_logevent("event_new_round", 2, "1=Round_Start");  
}

public VIPMenu( id ) 
{
    if( !has_used[ id ] && ( get_user_flags( id ) & read_flags( g_access_vip ) ) ) 
    {
        new iMenu = menu_create( "Vipmenu:", "menu_handler" );     
        menu_additem( iMenu, "Health" ); 
        menu_additem( iMenu, "Weapon" ); 
        menu_additem( iMenu, "Grenade" );  

        menu_display( id, iMenu ); 
    }
} 

public menu_handler( id, menu, item ) 
{ 
    if( item != MENU_EXIT ) 
    {
        
        switch( item ) 
        { 
            case 0: 
            { 
                set_user_health( id, 150 );
            }
            
            case 1: 
            { 
                give_item( id, "weapon_usp" )
            } 
            
            case 2: 
            { 
                give_item( id, "weapon_hegrenade" )
                give_item( id, "weapon_flashbang" )
                give_item( id, "weapon_smokegrenade" )
            }
        } 
        
        has_used[id] = true; 
    }
}
    
public event_new_round() 
    arrayset( has_used, false, sizeof has_used );
Last Post -,-"
TheDS1337 is offline
Closed Thread


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 04:27.


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