Raised This Month: $ Target: $400
 0% 

Ham_Use problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-06-2010 , 18:08   Ham_Use problem
Reply With Quote #1

Gotta problem with Ham_Use. There are no errors printed in logs and nothing, it just doesn't work. Plugin is running, for sure.
PHP Code:
public plugin_init()
{
    
RegisterHamHam_Use"func_button""HamSandwich_PlayerFinishMap" ); 
}



public 
HamSandwich_PlayerFinishMap(id)
{
    if(
is_user_alive(id))
    
cs_set_user_team(idCS_TEAM_CT);
    
    new 
menu menu_create("\rVyber si zbran:""hracMenu_UkazatMenuZbrani");
    
    
menu_additem(menu"\wTMP""1"0);
    
menu_additem(menu"\wMAC-10""2"0);
    
menu_additem(menu"\wGlock-18""3"0);
    
menu_additem(menu"\wScout""4"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    if(
is_user_alive(id))
        
menu_display(idmenu0);

}

public 
hracMenu_UkazatMenuZbrani(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            
give_item(id"weapon_tmp")
            
client_print(idprint_chat"[RFF] Vybral sis TMP. Budes mit pouze 10 naboju!");
            
cs_set_user_bpammo(idCSW_TMP10)
        }
        
        case 
2:
        {
            
give_item(id"weapon_mac10")
            
client_print(idprint_chat"[RFF] Vybral sis MAC10. Budes mit pouze 8 naboju!");
            
cs_set_user_bpammo(idCSW_MAC108)
        }
        
        case 
3:
        {
            
give_item(id"weapon_glock18")
            
client_print(idprint_chat"[RFF] Vybral sis Glock. Budes mit pouze 14 naboju!");
            
cs_set_user_bpammo(idCSW_GLOCK1814)
        }
        
        case 
4:
        {
            
give_item(id"weapon_scout")
            
client_print(idprint_chat"[RFF] Vybral sis Scout. Budes mit pouze 4 naboje!");
            
cs_set_user_bpammo(idCSW_SCOUT4)
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
}

The button teleports as it has tobut menu isn't showed and team isn't changed
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-06-2010 , 18:24   Re: Ham_Use problem
Reply With Quote #2

Use the following plugin, and put the .inc file in scripting/includes/ folder.
Then write your plugin, include the .inc file, and you can use the forward :

client_use_button(id, buttontype)

where button type can be START or STOP.

Exemple :

PHP Code:
#include <amxmodx>
#include <kz_buttons>

const MAX_PLAYERS 32

new bool:g_bIsPlayerInRun[MAX_PLAYERS+1]

public 
client_use_button(idiButton)
{
    switch( 
iButton )
    {
        case 
START:
        {
            
g_bIsPlayerInRun[id] = true
            client_print
(idprint_chat"good luck, make your best")
        }
        case 
STOP:
        {
            if( 
g_bIsPlayerInRun[id] == true )
            {
                
g_bIsPlayerInRun[id] = false
                
// add your code here
            
}
        }
    }

Attached Files
File Type: inc kz_buttons.inc (281 Bytes, 131 views)
File Type: sma Get Plugin or Get Source (kz_buttons.sma - 551 views - 4.9 KB)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 08:47.


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