Advertisement
iXdoctor

CS Weapons MiniShop

Jun 11th, 2014
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.93 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < amxmisc >
  5. #include < cstrike >
  6. #include < fakemeta_util >
  7.  
  8. enum _: iSettings
  9. {
  10.     iWep[ 32 ],
  11.     iWeapon[ 32 ],
  12.     iPrice,
  13.     iAccess
  14. }
  15.  
  16. new const szSettings [ ] [ iSettings ] =
  17. {
  18.     { "AK47", "weapon_ak47", 2500, ADMIN_ALL },
  19.     { "Mp5Navy", "weapon_mp5navy", 1500, ADMIN_ALL },
  20.     { "Awp", "weapon_awp", 4700, ADMIN_ALL },
  21.     { "M3", "weapon_m3", 0, ADMIN_KICK }
  22. }
  23.  
  24. public plugin_init()
  25. {
  26.     register_plugin( "CS Shop", "1.0", "Xdoctor" );
  27.    
  28.     register_clcmd( "say /shop", "ClcmdShop" );
  29. }
  30.  
  31. public ClcmdShop( client )
  32. {
  33.     if( !is_user_alive( client ) )
  34.         return ColorChat( client, "^4%s^1 You need to be^4 alive ^1to use this shop^3!", GetUserName( client ) );
  35.        
  36.     new szText[ 128 ];
  37.    
  38.     formatex( szText, charsmax( szText ), "\d[ \yAMXX\d ] \yCS Weapons Menu \d( \yBy Xdoctor\d )" )
  39.    
  40.     new Menu = menu_create( szText, "CmdShopHandler" );
  41.    
  42.     for( new i = 0; i < sizeof( szSettings ); i++ )
  43.     {
  44.         formatex( szText, charsmax( szText ), "\rWeapon\w: \y%s \d[ \y%d Money \d ] %s", szSettings[ i ][ iAccess ] == ADMIN_KICK ? "Only Vip" : "" );
  45.        
  46.         menu_additem( Menu, szText );
  47.     }
  48.    
  49.     menu_display( client, Menu, 0 );
  50.    
  51.     return PLUGIN_HANDLED;
  52. }
  53.  
  54. public CmdShopHandler( client, Menu, Item )
  55. {
  56.     if( Item == MENU_EXIT )
  57.     {
  58.         menu_destroy( Menu );
  59.        
  60.         return 1;
  61.     }
  62.    
  63.     if( szSettings[ Item ][ iAccess ] == ADMIN_KICK && !is_user_admin( client ) )
  64.         return ColorChat( client, "^4%s^1 this weapon can be ^4purchased^1 only by a ^4Vip^3!", GetUserName( client ) );
  65.        
  66.     if( cs_get_user_money( client ) < szSettings[ Item ][ iPrice ] )
  67.         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 ] );
  68.        
  69.     else if( cs_get_user_money( client ) >= szSettings[ Item ][ iPrice ] )
  70.     {
  71.         cs_set_user_money( client, cs_get_user_money( client ) - szSettings[ Item ][ iPrice ] );
  72.        
  73.         fm_give_item( client, szSettings[ Item ][ iWeapon ] );
  74.        
  75.         ColorChat( 0, "^4%s^1 just bought ^3the^1 weapon ^4%s^3!", GetUserName( client ), szSettings[ Item ][ iWep ] );
  76.        
  77.     }
  78.    
  79.     return 1;
  80. }
  81.    
  82. stock GetUserName( const Index )
  83. {
  84.     new szName[ 32 ];
  85.    
  86.     get_user_name( Index, szName, charsmax( szName ) );
  87.    
  88.     return szName;
  89. }
  90.  
  91. stock ColorChat(const client, const string[], {Float, Sql, Resul,_}:...)
  92. {
  93. new msg[ 191 ], players[ 32 ], count = 1;
  94.  
  95. static len; len = formatex( msg, charsmax(msg), "^3[^1 AMXX ^3]^1 " );
  96. vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
  97.  
  98. if( client )  players[ 0 ] = client;
  99. else    get_players( players,count, "ch" );
  100.  
  101. for( new i = 0; i < count; i++ )
  102. {
  103.         if( is_user_connected( players[ i ] ) )
  104.         {
  105.                 message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ),_, players[ i ] );
  106.                 write_byte( players[ i ] );
  107.                 write_string( msg );
  108.                 message_end();
  109.         }
  110. }
  111.  
  112. return 1;
  113.  
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement