Code:
#include < amxmodx >
#include < nvault >
new g_iSaving;
new bool: g_bIsVip[ 33 ];
public plugin_init( )
{
register_plugin( "Vip original" , "1.0" , "Aooka" );
register_concmd( "amx_addvip" , "CmdAddVip" , ADMIN_IMMUNITY , "<#userid>" );
register_concmd( "amx_removevip" , "CmdRemoveVip" , ADMIN_IMMUNITY , "<#userid>" );
register_clcmd( "say /vip" , "VipMenu" );
g_iSaving = nvault_open( "vip_file" );
new iMenu = menu_create( "Awesome Vip Menu" , "Handler_Menu" );
menu_additem( iMenu , "Test 1" , "1" , 0 );
menu_additem( iMenu , "Test 2" , "2" , 0 );
menu_setprop( iMenu , MPROP_EXITNAME , "Sortir" );
}
public client_putinserver( id )
{
g_bIsVip[ id ] = false;
}
public plugin_end( )
{
nvault_close( g_iSaving );
}
public VipMenu( id , iMenu )
{
if( is_user_alive( id ) && g_bIsVip[ id ] == true )
{
menu_display( id , iMenu , 0 );
}
else
{
client_print( id , print_center , "If you whant to go to the VipMenu you msut be a Vip" );
}
}
public Handler_Menu( id , iMenu , item )
{
if( item != MENU_EXIT )
{
switch( item )
{
case 1:
client_print( id , print_center , "Test 1 :: OK" );
case 2:
client_print( id , print_center , "Test 2 :: OK" );
}
}
else
{
client_print( id , print_center , "Menu is closed" );
menu_destroy( iMenu );
}
}
public CmdAddVip( id )
{
new target;
static szName[ 2 ][ 36 ];
get_user_name( id , szName[ 0 ] , charsmax( szName ) );
get_user_name( target , szName[ 1 ] , charsmax( szName ) );
client_print( 0 , print_chat , "%s gave a Vip place for the player %s" , szName[ 0 ] , szName[ 1 ] );
}
I do this about two days ago and today. But (yes but !! ^^ ) i've a big problem with the last function ( public CmdAddVip( id ) )
Ps: I've watched how other plugins functioned...
If someone could help me do this function and explaining to me his approach it would be very useful for me