Member
|
03-18-2012
, 08:25
Restrict vipmenu on certain maps!
|
#1
|
Hi!
I have a VIP-weapon menu. And I want it to be not able to use on certain maps, like fy_buzzkill and 35hp_2.
PHP Code:
#include < amxmodx >
#include < fun >
#include < cstrike >
#include < colorchat >
#define ADMIN_VIP ADMIN_VOTE // Change access to menu here
new g_iCurrentRound;
new bool:g_bMenuUsed[ 33 ];
public plugin_init()
{
register_plugin( "Vip Menu", "1.0", "nikhilgupta345/Byyy" );
register_clcmd( "say vipmenu","CmdVIPMenu" );
register_clcmd( "say /vipmenu", "CmdVIPMenu" );
register_clcmd( "say /vip", "CmdMotd" );
register_clcmd( "say /admin", "CmdMotdadmin" );
register_clcmd( "say /vips", "CmdShowVIP" );
register_logevent( "Event_RoundStart", 2, "1=Round_Start" );
}
public CmdMotd( id )
{
show_motd( id, "vip.txt", "VIP Information" );
}
public CmdMotdadmin( id )
{
show_motd( id, "admin.txt", "ADMIN Information" );
}
public Event_RoundStart()
{
g_iCurrentRound++;
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum );
new iPlayer, szName[ 32 ];
for( new i = 0; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];
if( get_user_flags( iPlayer ) & ADMIN_VIP )
{
get_user_name( iPlayer, szName, charsmax( szName ) );
server_cmd( "wc3_givexp ^"%s^" 50", szName );
}
}
for( new i = 0; i < sizeof g_bMenuUsed; i++ )
g_bMenuUsed[ i ] = false;
}
public client_connect( id )
{
g_bMenuUsed[ id ] = false;
}
public CmdVIPMenu( id )
{
new hMenu = menu_create( "VIP Menu", "VIPMenu_Handler" );
if( get_user_flags( id ) & ADMIN_VIP )
menu_additem( hMenu, "Weapon Menu", "0" );
else
menu_additem( hMenu, "\dWeapon Menu", "0" );
menu_additem( hMenu, "Want VIP", "1" );
menu_additem( hMenu, "Want ADMIN", "2" );
menu_display( id, hMenu, 0 );
return PLUGIN_HANDLED;
}
public VIPMenu_Handler( id, hMenu, iItem )
{
new szData[ 6 ], szName[ 64 ];
new iAccess, hCallback;
menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), szName, charsmax( szName ), hCallback );
switch( str_to_num( szData ) )
{
case 0:
{
if( !( get_user_flags( id ) & ADMIN_VIP ) )
{
ColorChat( id, NORMAL, "[ ^04VIP ^01] You do not have access to this menu." );
return PLUGIN_HANDLED;
}
else if( !is_user_alive( id ) )
{
ColorChat( id, NORMAL, "[ ^04VIP ^01] You can't use this when you are dead, dumbass." );
return PLUGIN_HANDLED;
}
else if( g_iCurrentRound < 3 )
{
ColorChat( id, NORMAL, "[ ^04VIP ^01] You can't use this until the second round is over." );
return PLUGIN_HANDLED;
}
else if( g_bMenuUsed[ id ] )
{
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have already used this menu this round!" );
return PLUGIN_HANDLED;
}
else WeaponMenu( id );
}
case 1: show_motd( id, "vip.txt", "VIP Information" );
case 2: show_motd( id, "admin.txt", "ADMIN Information" );
}
menu_destroy( hMenu );
return PLUGIN_HANDLED;
}
public WeaponMenu( id )
{
new hMenu = menu_create( "VIP Guns", "WeaponMenu_Handler" );
menu_additem( hMenu, "M4A1", "1");
menu_additem( hMenu, "AK47", "2");
menu_additem( hMenu, "AWP", "3");
menu_additem( hMenu, "Clarion", "4");
menu_additem( hMenu, "Gailil", "5");
menu_additem( hMenu, "D3/AU-1", "6");
menu_additem( hMenu, "M249", "7");
menu_additem( hMenu, "MP5", "8");
menu_setprop( hMenu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, hMenu, 0 );
}
public WeaponMenu_Handler( id, hMenu, iItem )
{
if( iItem == MENU_EXIT )
{
menu_destroy( hMenu );
return PLUGIN_HANDLED;
}
new szData[ 6 ], szName[ 64 ];
new iAccess, hCallback;
menu_item_getinfo( hMenu, iItem, iAccess, szData, charsmax( szData ), szName, charsmax( szName ), hCallback );
if( user_has_weapon( id, CSW_C4 ) )
{
strip_user_weapons( id );
give_item( id, "weapon_c4" );
}
else
strip_user_weapons( id );
switch( str_to_num( szData ) )
{
case 1:
{
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 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen M4A1, use it wisely." );
}
case 2:
{
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 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen AK47, use it wisely." );
}
case 3:
{
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 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen AWP, use it wisely." );
}
case 4:
{
give_item(id,"weapon_famas")
cs_set_user_bpammo( id, CSW_FAMAS, 90 );
give_item( id, "weapon_deagle" );
cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen Clarion, use it wisely." );
}
case 5:
{
give_item(id,"weapon_galil")
cs_set_user_bpammo( id, CSW_GALIL, 90 );
give_item( id, "weapon_deagle" );
cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen Galil, use it wisely." );
}
case 6:
{
give_item(id,"weapon_g3sg1")
cs_set_user_bpammo( id, CSW_G3SG1, 90 );
give_item( id, "weapon_deagle" );
cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen D3/AU-1, use it wisely." );
}
case 7:
{
give_item(id,"weapon_m249")
cs_set_user_bpammo( id, CSW_M249, 200 );
give_item( id, "weapon_deagle" );
cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen M249, use it wisely." );
}
case 8:
{
give_item(id,"weapon_mp5navy")
cs_set_user_bpammo( id, CSW_MP5NAVY, 120 );
give_item( id, "weapon_deagle" );
cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
ColorChat( id, NORMAL, "[ ^04VIP ^01] You have chosen MP5, use it wisely." );
}
}
give_item( id, "weapon_knife" );
give_item( id, "weapon_hegrenade" );
give_item( id, "item_assaultsuit" );
give_item( id, "item_thighpack" );
g_bMenuUsed[ id ] = true;
menu_destroy( hMenu );
return PLUGIN_HANDLED;
}
public CmdShowVIP( id ) // Taken from AMX_SUPER
{
new szMessage[ 256 ];
new szVIPNames[ 33 ][ 32 ];
new iCount, x, iLen;
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum );
new iPlayer;
for( new i = 0; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];
if( get_user_flags( iPlayer ) & ADMIN_VIP )
{
get_user_name( iPlayer, szVIPNames[ iCount++ ], 31 );
}
}
iLen = format( szMessage, charsmax( szMessage ), "^04 VIPS ONLINE: " );
if( iCount > 0 )
{
for( x = 0 ; x < iCount ; x++ )
{
iLen += format( szMessage[iLen], charsmax( szMessage ) - iLen, "%s%s ", szVIPNames[ x ], x < ( iCount - 1 ) ? ", " : "" );
if( iLen > 96 )
{
ColorChat( id, NORMAL, szMessage );
iLen = format( szMessage, 255, "^04" );
}
}
ColorChat( id, NORMAL, szMessage );
}
else
{
iLen += format( szMessage[ iLen ], charsmax( szMessage ) - iLen, "No vips online." );
ColorChat( id, NORMAL, szMessage );
}
}
Also, add a amx_vote Next map on this menu too.
Please help. Would mean alot!
__________________
|
|