Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx >
- #include < amxmisc >
- #include < cstrike >
- #include < fakemeta_util >
- enum _: iSettings
- {
- iWep[ 32 ],
- iWeapon[ 32 ],
- iPrice,
- iAccess
- }
- new const szSettings [ ] [ iSettings ] =
- {
- { "AK47", "weapon_ak47", 2500, ADMIN_ALL },
- { "Mp5Navy", "weapon_mp5navy", 1500, ADMIN_ALL },
- { "Awp", "weapon_awp", 4700, ADMIN_ALL },
- { "M3", "weapon_m3", 0, ADMIN_KICK }
- }
- public plugin_init()
- {
- register_plugin( "CS Shop", "1.0", "Xdoctor" );
- register_clcmd( "say /shop", "ClcmdShop" );
- }
- public ClcmdShop( client )
- {
- if( !is_user_alive( client ) )
- return ColorChat( client, "^4%s^1 You need to be^4 alive ^1to use this shop^3!", GetUserName( client ) );
- new szText[ 128 ];
- formatex( szText, charsmax( szText ), "\d[ \yAMXX\d ] \yCS Weapons Menu \d( \yBy Xdoctor\d )" )
- new Menu = menu_create( szText, "CmdShopHandler" );
- for( new i = 0; i < sizeof( szSettings ); i++ )
- {
- formatex( szText, charsmax( szText ), "\rWeapon\w: \y%s \d[ \y%d Money \d ] %s", szSettings[ i ][ iAccess ] == ADMIN_KICK ? "Only Vip" : "" );
- menu_additem( Menu, szText );
- }
- menu_display( client, Menu, 0 );
- return PLUGIN_HANDLED;
- }
- public CmdShopHandler( client, Menu, Item )
- {
- if( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- if( szSettings[ Item ][ iAccess ] == ADMIN_KICK && !is_user_admin( client ) )
- return ColorChat( client, "^4%s^1 this weapon can be ^4purchased^1 only by a ^4Vip^3!", GetUserName( client ) );
- if( cs_get_user_money( client ) < szSettings[ Item ][ iPrice ] )
- return ColorChat( client, "^4%s^1 Your money ^4amount^1 isn't^4 enough^1 to purchase^4 %s^3!", GetUserName( client ), szSettings[ Item ][ iWep ] );
- else if( cs_get_user_money( client ) >= szSettings[ Item ][ iPrice ] )
- {
- cs_set_user_money( client, cs_get_user_money( client ) - szSettings[ Item ][ iPrice ] );
- fm_give_item( client, szSettings[ Item ][ iWeapon ] );
- ColorChat( 0, "^4%s^1 just bought ^3the^1 weapon ^4%s^3!", GetUserName( client ), szSettings[ Item ][ iWep ] );
- }
- return 1;
- }
- stock GetUserName( const Index )
- {
- new szName[ 32 ];
- get_user_name( Index, szName, charsmax( szName ) );
- return szName;
- }
- stock ColorChat(const client, const string[], {Float, Sql, Resul,_}:...)
- {
- new msg[ 191 ], players[ 32 ], count = 1;
- static len; len = formatex( msg, charsmax(msg), "^3[^1 AMXX ^3]^1 " );
- vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
- if( client ) players[ 0 ] = client;
- else get_players( players,count, "ch" );
- for( new i = 0; i < count; i++ )
- {
- if( is_user_connected( players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ),_, players[ i ] );
- write_byte( players[ i ] );
- write_string( msg );
- message_end();
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement