Raised This Month: $ Target: $400
 0% 

say /smoke


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ryokin
Senior Member
Join Date: Jan 2010
Old 01-08-2010 , 05:02   say /smoke
Reply With Quote #1

i want a plugin when you say /smoke(only t) you will get a smokegrenade
and a mesage on chat display everyone "% has bought a smokegrenade"
pls send me code
thanks
Ryokin is offline
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 01-08-2010 , 05:26   Re: say /smoke
Reply With Quote #2

Not Tested:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

new smoke_costsmoke_on;

public 
plugin_init() 
{
    
register_plugin("Buy Smoke""1.0""Author");

    
register_clcmd("say /smoke","Smoke");
    
register_clcmd("say_team /smoke","Smoke");

    
smoke_on register_cvar"smoke_on""1");
    
smoke_cost register_cvar"smoke_cost""250");
}

public 
Smoke(id)
{
    if( 
cs_get_user_teamid ) == CS_TEAM_T )
    {
        new 
Name[32];
        
get_user_name(idName31);

        new 
money cs_get_user_moneyid );
        new 
price get_pcvar_numsmoke_cost );

        if( 
get_pcvar_numsmoke_on ) == )
        {
            
client_printidprint_chat"*Smoke-Grenades have been disabled!" );
            return 
PLUGIN_HANDLED;
        }
        if( 
is_user_aliveid ) )
        {
             if( 
user_has_weaponidCSW_SMOKEGRENADE ) )
             {
                  
client_printidprint_chat"*You already have a Smoke-Grenade!" );
                  return 
PLUGIN_HANDLED;
             }
             if( 
money price )
             {
                  
client_printidprint_chat"*You dont have enough money to buy a Smoke-Grenade!" );
                  return 
PLUGIN_HANDLED;
             }
             if( 
money >= price 
             {
                  
cs_set_user_moneyidmoney price );  
                  
give_itemid"weapon_smokegrenade" );
                  
client_print0print_chat"*%s has bought a Smoke-Grenade!"Name );
                  return 
PLUGIN_HANDLED;
             }
         }
    }
    else
    {
         
client_printidprint_chat"*Only Terrorist's can buy a Smoke-Grenade!" );
         return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;

Stupid copying pasting makes it go out of place. Might be loose identication.
Cleaned bit manually
__________________
R.I.P Aziz 'Zyzz' Sergeyevich Shavershian

Last edited by cikjam; 01-08-2010 at 05:33.
cikjam is offline
Ryokin
Senior Member
Join Date: Jan 2010
Old 01-08-2010 , 05:53   Re: say /smoke
Reply With Quote #3

...

Last edited by Ryokin; 05-09-2010 at 07:34.
Ryokin is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-08-2010 , 05:57   Re: say /smoke
Reply With Quote #4

Here's how it would be better:
Put sv_smokecost to 0 if you want give it for free. Put -1 to disabled plugin. Any other value above 0 is price.

EDIT: Added colors.

Code:
#include < amxmodx > #include < cstrike > #include < fun > new g_pSmokeCost; public plugin_init( ) {     register_plugin( "Buy Smoke", "1.0", "AMXx Community" );     register_clcmd( "say /smoke", "CmdSmoke" );     register_clcmd( "say_team /smoke", "CmdSmoke" );         g_pSmokeCost = register_cvar( "sv_smokecost", "250"); } public CmdSmoke( const id ) {     if( cs_get_user_team( id ) != CS_TEAM_T ) {         GreenPrint( id, "^4*^1 Only Terrorists can buy a FrostNade!" );                 return PLUGIN_HANDLED;     }     else if( !is_user_alive( id ) ) {         GreenPrint( id, "^4*^1 You need to be alive to buy FrostNade!" );                 return PLUGIN_HANDLED;     }         new iPrice = get_pcvar_num( g_pSmokeCost );         if( iPrice < 0 ) {         GreenPrint( id, "^4*^1 Smoke-Grenades have been disabled!" );                 return PLUGIN_HANDLED;     }         if( user_has_weapon( id, CSW_SMOKEGRENADE ) ) {         GreenPrint( id, "^4*^1 You already have a FrostNade!" );                 return PLUGIN_HANDLED;     }         if( iPrice > 0 ) {         new iMoney = cs_get_user_money( id ) - iPrice;                 if( iMoney < 0 ) {             GreenPrint( id, "^4*^1 You dont have enough money to buy a Smoke-Grenade!" );                         return PLUGIN_HANDLED;         }                 cs_set_user_money( id, iMoney );     }         new szName[ 32 ];     get_user_name( id, szName, 31 );         give_item( id, "weapon_smokegrenade" );         GreenPrint( 0, "^4*^3 %s^1 has bought a^4 FrostNade^1!", szName, iPrice );         return PLUGIN_HANDLED; } GreenPrint( const id, const message[ ], any:... ) {     new szMessage[ 192 ];     vformat( szMessage, 191, message, 3 );         static iSayText;     if( !iSayText )         iSayText = get_user_msgid( "SayText" );         message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, _, id );     write_byte( id ? id : 1 );     write_string( szMessage );     message_end( ); }
__________________

Last edited by xPaw; 01-08-2010 at 06:00.
xPaw is offline
Ryokin
Senior Member
Join Date: Jan 2010
Old 01-08-2010 , 06:07   Re: say /smoke
Reply With Quote #5

...

Last edited by Ryokin; 05-09-2010 at 07:33.
Ryokin is offline
Reply



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 00:13.


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