Raised This Month: $ Target: $400
 0% 

Help with lr


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-03-2010 , 21:19   Help with lr
Reply With Quote #1

How do i edit this code so every time i pick a weapon it will pop a message like this.. for example if i choose an ak47..
Code:
 ColorChat(id, RED, "You have chosen an ak47."
.. where do i put the message?

Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fakemeta >
#include < fun >
#include < hamsandwich >
#include < colorchat >


#define ADMIN_VOICE ADMIN_MENU


new g_iMaxClients;
new g_iMenu;

new bool:g_connected[33]; 

public plugin_init() {
    register_plugin( "Jb Weapon", "1.0", "wundeR" );    
    RegisterHam( Ham_Spawn, "player", "HamPlayerSpawn", 1 );
    
    register_forward( FM_Voice_SetClientListening, "FwdSetVoice" );
    
    g_iMaxClients = get_maxplayers();
    
    g_iMenu = menu_create( "Choose your weapon", "HandleWeaponsMenu" );
    menu_additem( g_iMenu, "AK47", "1", 0 );
    menu_additem( g_iMenu, "M4A1", "2", 0 );
    menu_additem( g_iMenu, "AWP", "3", 0 );
    menu_additem( g_iMenu, "M3", "4", 0 );
    menu_additem( g_iMenu, "FAMAS", "5", 0 );
    menu_additem( g_iMenu, "P90", "6", 0 );
    menu_additem( g_iMenu, "M249", "7", 0 );
    menu_setprop( g_iMenu, MPROP_EXIT, MEXIT_ALL ); 
    
    g_iMaxClients = global_get( glb_maxClients );
}

public HamPlayerSpawn(id) {
    if( is_user_alive( id ) && is_user_connected( id ) ) {
        strip_user_weapons( id );
        give_item( id, "weapon_knife" );
        if( cs_get_user_team( id ) == CS_TEAM_CT ) {
            give_item( id, "weapon_deagle" );
            cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
            menu_display( id, g_iMenu, 0 );
        }
    }    
}

public client_putinserver(client)
{
    g_connected[client] = true;
}

public client_disconnect(client)
{
    g_connected[client] = false;
}

public FwdSetVoice(receiver, sender, bool:listen)
{
    if( !(1 <= receiver <= g_iMaxClients)
    || !g_connected[receiver]
    || !(1 <= sender <= g_iMaxClients)
    || !g_connected[sender] ) return FMRES_IGNORED;
    
    new CsTeams:team = cs_get_user_team(sender);
    if( (team == CS_TEAM_T || team == CS_TEAM_CT && !is_user_alive(sender)) && !access(sender, ADMIN_VOICE) )
    {
        engfunc(EngFunc_SetClientListening, receiver, sender, 0);
        return FMRES_SUPERCEDE;
    }
    
    return FMRES_IGNORED;
}

public HandleWeaponsMenu( id, iMenu, iItem ) {
    if( iItem == MENU_EXIT || !is_user_alive( id ) )
    return PLUGIN_HANDLED;
    
    new szKey[ 7 ], _Trash;
    menu_item_getinfo( iMenu, iItem, _Trash, szKey, 1, "", 0, _Trash );
    
    switch( szKey[ 0 ] ) {
        case '1': {
            give_item( id, "weapon_ak47" );
            cs_set_user_bpammo( id, CSW_AK47, 90 );
        }
        case '2': {
            give_item( id, "weapon_m4a1" );
            cs_set_user_bpammo( id, CSW_M4A1, 90 );
        }
        case '3': {
            give_item( id, "weapon_awp" );
            cs_set_user_bpammo( id, CSW_AWP, 30 );
        }
        case '4': {
            give_item( id, "weapon_m3" );
            cs_set_user_bpammo( id, CSW_M3, 32 );
        }
        case '5': {
            give_item( id, "weapon_famas" );
            cs_set_user_bpammo( id, CSW_FAMAS, 90 );
        }
        case '6': {
            give_item( id, "weapon_p90" );
            cs_set_user_bpammo( id, CSW_P90, 100 );
        }
        case '7': {
            give_item( id, "weapon_m249" );
            cs_set_user_bpammo( id, CSW_M249, 200 );
        }
    }
    return PLUGIN_HANDLED;
}

Last edited by FlyingHorse; 05-03-2010 at 21:23.
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-03-2010 , 21:28   Re: Help with lr
Reply With Quote #2

you put them in the cases of your menu handler like this:

PHP Code:
        case '1': {
            
give_itemid"weapon_ak47" );
            
cs_set_user_bpammoidCSW_AK4790 );
            
ColorChat(idRED"You have chosen an ak47.");
        }
        case 
'2': {
            
give_itemid"weapon_m4a1" );
            
cs_set_user_bpammoidCSW_M4A190 );
            
ColorChat(idRED"You have chosen a m4a1.");
        }
        case 
'3': {
            
give_itemid"weapon_awp" );
            
cs_set_user_bpammoidCSW_AWP30 );
            
ColorChat(idRED"You have chosen an awp.");
        }
        case 
'4': {
            
give_itemid"weapon_m3" );
            
cs_set_user_bpammoidCSW_M332 );
            
ColorChat(idRED"You have chosen a m3.");
        }
        case 
'5': {
            
give_itemid"weapon_famas" );
            
cs_set_user_bpammoidCSW_FAMAS90 );
            
ColorChat(idRED"You have chosen a famas.");
        }
        case 
'6': {
            
give_itemid"weapon_p90" );
            
cs_set_user_bpammoidCSW_P90100 );
            
ColorChat(idRED"You have chosen a p90.");
        }
        case 
'7': {
            
give_itemid"weapon_m249" );
            
cs_set_user_bpammoidCSW_M249200 );
            
ColorChat(idRED"You have chosen a m249.");
        } 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-03-2010 at 21:37.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-03-2010 , 22:07   Re: Help with lr
Reply With Quote #3

You need to post questions like this in scripting help (if you seriously can't figure it out, test things yourself first).
__________________
fysiks 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 03:36.


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