Raised This Month: $ Target: $400
 0% 

Menu little bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 02-03-2010 , 05:03   Menu little bug
Reply With Quote #1

I got a small bug, that I cant get wath its wrong, i've read the code a lot of times but I cant find a solution.
Code features: Its shows a menu for CTS when they respawn and they can pick some guys with different guns menu.
Bugs:
-When you pick guy 3 you should get a shield but it doesnt work.

Please I really need this help.
PHP Code:
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <engine_stocks>

#define OFFSET_PRIMARYWEAPON        116 


new g_iMenu;


public 
plugin_init() {
    
register_plugin"Tipos armas""1.0""benamo6" );    
    
RegisterHamHam_Spawn"player""HamPlayerSpawn");
    
    
g_iMenu menu_create"Elegi a alguien:""HandleWeaponsMenu" );
    
menu_additemg_iMenu"Capo""1");
    
menu_additemg_iMenu"Groso""2");
    
menu_additemg_iMenu"Gil""3");
    
menu_setpropg_iMenuMPROP_EXITMEXIT_ALL ); 
    
}


public 
HamPlayerSpawn(id) {
    if( 
cs_get_user_teamid ) == CS_TEAM_CT ) {
        
menu_displayidg_iMenu);
    }
}

public 
HandleWeaponsMenuidiMenuiItem ) {
    if( 
iItem == MENU_EXIT || !is_user_aliveid ) )
        return 
PLUGIN_HANDLED;
    
    new 
szKey], _Trash;
    
menu_item_getinfoiMenuiItem_TrashszKey1""0_Trash );
    
    switch( 
szKey] ) {
        case 
'1': {
            if(
cs_get_user_teamid ) == CS_TEAM_CT)
            {
                
set_user_armor(id0);
                
set_user_health(id65);
            }
        }
        case 
'2': {
            if(
cs_get_user_teamid ) == CS_TEAM_CT)
            {
                
set_user_maxspeed(id290.0)
            }
        }
        case 
'3': {
            if(
cs_get_user_teamid ) == CS_TEAM_CT)
            {
                
set_user_maxspeed(id335.0)
                
strip_user_weaponsid );
                
set_pdata_int(idOFFSET_PRIMARYWEAPON0)
                
give_itemid"weapon_knife" );
                
give_itemid"weapon_shield" ); 
                
give_itemid"weapon_fiveseven" ); 
                
cs_set_user_bpammoidCSW_FIVESEVEN100 );
                
give_item(id"weapon_hegrenade")
                
give_item(id"weapon_smokegrenade")
                
set_user_health(id100);
                
set_user_armor(id100);
            }
        }
        
    }
    return 
PLUGIN_HANDLED;

__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it

Last edited by benamo6; 02-03-2010 at 05:28.
benamo6 is offline
Send a message via MSN to benamo6
benjibau
Veteran Member
Join Date: Jul 2009
Location: France (Nord 59)
Old 02-03-2010 , 05:45   Re: Menu little bug
Reply With Quote #2

try this

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

new g_Maxplayers
new g_iMenu1

public plugin_init() 
{
    
register_plugin"Tipos armas""1.1""benamo6" );    

    
register_logevent("Event_Round_Start"2"1=Round_Start")

    
g_Maxplayers get_maxplayers()

    
Menus()
}

Menus()
{
    
g_iMenu1 menu_create("\wChoose:""primmenu_handler")
    
menu_additemg_iMenu1"Capo""1");
    
menu_additemg_iMenu1"Groso""2");
    
menu_additemg_iMenu1"Gil""3");
    
menu_setprop(g_iMenu1MPROP_EXITMEXIT_ALL)
}

public 
plugin_end()
{
    
menu_destroy(g_iMenu1)
}

public 
Event_Round_Start()
{
    for(new 
id 1id <= g_Maxplayersid++)
    {
        if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
        {
            
menu_display(idg_iMenu10)
        }
    }
}

public 
primmenu_handler(idg_iMenu1item)
{
    if (
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(g_iMenu1itemaccessdata5iName63callback)

    switch( 
str_to_num(data) )
    {
        case 
1:
        {
            
set_user_armor(id0);
            
set_user_health(id65);
        }
        case 
2:
        {
            
set_user_maxspeed(id290.0)
        }
        case 
3:
        {
            
strip_user_weapons(id);
            
set_user_maxspeed(id335.0)
            
give_item(id"weapon_knife")
            
give_item(id"weapon_shield")
            
give_item(id"weapon_fiveseven"
            
cs_set_user_bpammo(idCSW_FIVESEVEN100)
            
give_item(id"weapon_hegrenade")
            
give_item(id"weapon_smokegrenade")
            
set_user_health(id100);
            
set_user_armor(id100);
        }
    }
    return 
PLUGIN_HANDLED

benjibau is offline
Send a message via MSN to benjibau
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 02-03-2010 , 06:04   Re: Menu little bug
Reply With Quote #3

Worked. Thanks
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it
benamo6 is offline
Send a message via MSN to benamo6
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 07:22.


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