AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_Use problem (https://forums.alliedmods.net/showthread.php?t=120626)

Backstabnoob 03-06-2010 18:08

Ham_Use problem
 
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


ConnorMcLeod 03-06-2010 18:24

Re: Ham_Use problem
 
2 Attachment(s)
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
            
}
        }
    }




All times are GMT -4. The time now is 08:47.

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