Raised This Month: $48 Target: $400
 12% 

CS Weapons MiniShop


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-12-2014 , 18:15   Re: CS Weapons MiniShop
Reply With Quote #11

This is redundant, poorly coded, and doesn't serve really a purpose.
Also, it seems you don't know really what you're doing.
Please read the rules before posting. Take your time to learn Pawn and back with quality plugin.

Unapproved.

PS: Yami asked you to attach the plugin. Don't ignore him, if you don't know how to do it, simply ask. Edit your post, then "go advanced" and below you have a button "Manage attachments.
__________________

Last edited by Arkshine; 06-12-2014 at 18:15.
Arkshine is offline
Pawn_Basic
New Member
Join Date: Jun 2014
Old 06-14-2014 , 10:17   Re: CS Weapons MiniShop
Reply With Quote #12

Quote:
Originally Posted by Kia View Post
Made some suggestions in the code, you might want to check it out.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fakemeta_util >

// Indented Code

enum _iSettings
{
    
iWep32 ],
    
iWeapon32 ],
    
iPrice,
    
iAccess
}

new const 
szSettings [ ] [ iSettings ] = 
{
    { 
"AK47""weapon_ak47"5000ADMIN_ALL },
    { 
"Mp5Navy""weapon_mp5navy"1250ADMIN_ALL },
    { 
"Awp""weapon_awp"7500ADMIN_ALL },
    { 
"M3""weapon_m3"0ADMIN_KICK }
}

public 
plugin_init()
{
    
register_plugin"CS Shop""1.0""Xdoctor" );
    
    
register_clcmd"say /shop""ClcmdShop" );
}

public 
ClcmdShopclient )
{
    if(!
is_user_aliveclient ) ) // Removed is_user_connected check, since is_user_alive does that already
        
return ColorChatclient"^4%s^1 You need to be^4 alive ^1to use this shop^3!"GetUserNameclient ) );
    
    new 
szText128 ];
    
formatexszTextcharsmaxszText ), "\d[ \yAMXX\d ] \yCS Weapons Menu \d( \yBy Xdoctor\d )" )
    
    new 
Menu menu_createszText"CmdShopHandler" );
    for( new 
0sizeofszSettings ); i++ )
    {
        
formatexszTextcharsmaxszText ), "\rWeapon\w: \y%s \d[ \y%d Money \d ] %s"szSettings][ iAccess ] == ADMIN_KICK "Only Vip" "" );
        
menu_additemMenuszText_get_user_flags(client) & szSettings[i][iAccess] ? 1<<31 ); // Blocking the Menu Item already here when he has not the required flag
    
}
    
    
menu_displayclientMenu);
    return 
PLUGIN_HANDLED// Replaced 1 with PLUGIN_HANDLED, use such consts when we have them
}

public 
CmdShopHandlerclientMenuItem )
{
    if( 
Item == MENU_EXIT )
    {
        
menu_destroyMenu );
        
        return 
1;
    }
    
    
// Removed Flag Check
    
    
new iMoney cs_get_user_money(client// Saving the money here so we save some calls
    
    
if( iMoney szSettingsItem ][ iPrice ] )
        return 
ColorChatclient"^4%s^1 Your money ^4amount^1 isn't^4 enough^1 to purchase^4 %s^3!"GetUserNameclient ), szSettingsItem ][ iWep ] );
    
    else if( 
iMoney >= szSettingsItem ][ iPrice ] )
    {
        
cs_set_user_moneyclientiMoney szSettingsItem ][ iPrice ] );
        
        
fm_give_itemclientszSettingsItem ][ iWeapon ] );
        
        
ColorChat0"^4%s^1 just bought ^3the^1 weapon ^4%s^3!"GetUserNameclient ), szSettingsItem ][ iWep ] );
        
    }
    
    return 
PLUGIN_HANDLED// Replaced 1 with PLUGIN_HANDLED, use such consts when we have them
}

stock GetUserName( const Index )
{
    new 
szName32 ];
    
    
get_user_nameIndexszNamecharsmaxszName ) );
    
    return 
szName;
}

stock ColorChat(const client, const string[], {FloatSqlResul,_}:...)
{
    new 
msg191 ], players32 ], count 1;
    
    static 
lenlen formatexmsgcharsmax(msg), "^3[^1 AMXX ^3]^1 " );
    
vformatmsglen ], charsmaxmsg ) - lenstring);
    
    if( 
client )  players] = client;
    else    
get_playersplayers,count"ch" );
    
    for( new 
0counti++ )
    {
        if( 
is_user_connectedplayers] ) )
        {
            
message_beginMSG_ONE_UNRELIABLEget_user_msgid"SayText" ),_players] );
            
write_byteplayers] );
            
write_stringmsg );
            
message_end();
        }
    }
    
    return 
1;


cs_set_user_money( client, iMoney - szSettings[ Item ][ iPrice ] );
-->
iMoney -= szSettings[ Item ][ iPrice ]
---------------------------------------------------------------
If you set a variable to go with him to the end..
Doctor, you're sure that all the variables read in the menu?
Pawn_Basic is offline
Old 09-09-2014, 15:56
Strick3n
This message has been deleted by YamiKaitou. Reason: spam/rude
Reply


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 14:40.


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