Raised This Month: $ Target: $400
 0% 

Problem with Menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 03-27-2011 , 14:10   Problem with Menu
Reply With Quote #1

Hey again,

So i today made a small plagin which includes menu and some items, everything compiled ok, but in game when i tested i could open menu but when chosed what to buy nothing happened... Did i miss anything? Please correct it.

PHP Code:
new menu[512]
const 
KEYS MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd("say /kshop""opens_shop")
    
register_clcmd("say /kmshop""opens_shop")
    
    
register_clcmd("say !kshop""opens_shop")
    
register_clcmd("say !kmshop""opens_shop")

        
register_menucmd(register_menuid("Knife Mod Shop"), KEYS"kmshop")
}

public 
opens_shop(player)
{
    
CreateMenu(player)
}

public 
CreateMenu(player)
{
    new 
len format(menu511"\yKnife Mod Shop:^n")
    
len += format(menu[len], 511 len"^n\w1. Health Pack ($ %d)"get_pcvar_num(g_hp_cost))
    
len += format(menu[len], 511 len"^n\w2. Armor ($ %d)"get_pcvar_num(g_armor_cost))
    
len += format(menu[len], 511 len"^n\w3. Respawn ($ %d)"get_pcvar_num(g_respawn_cost))
     
len += format(menu[len], 511 len"^n^n\w4. Exit")

    
show_menu(idkeysmenu, -1)
    
    return 
PLUGIN_HANDLED       
}

public 
kmshop(playerKEYS)
{
    switch (
KEYS)
    {
        case 
0:
        {    
            if (!
is_user_alive(player))
            {
                
client_print(playerprint_chat"[KMS] Dead players cant buy this")
                return 
PLUGIN_HANDLED
            
}
                
            new 
cost1 get_pcvar_num(g_hp_cost)
            new 
current_cash cs_get_user_money(player)
            
            if (
cost1 current_cash)
            {
                
client_print(playerprint_chat"[KMS] You dont have enough money to buy Health"cost1)
                return 
PLUGIN_HANDLED
            
}
            
            
g_hasHP[player] = true
            
            fm_set_user_health
(player100)
            
cs_set_user_money(playercurrent_cash cost1)
            
            
client_print(playerprint_chat"[KMS] You have successfully bought Health Pack")
        }
        
        case 
1:
        {
            if (!
is_user_alive(player))
            {
                
client_print(playerprint_chat"[KMS] Dead players cant buy this")
                return 
PLUGIN_HANDLED
            
}
                
            new 
cost2 get_pcvar_num(g_armor_cost)
            new 
current_cash cs_get_user_money(player)
            
            if (
cost2 current_cash)
            {
                
client_print(playerprint_chat"[KMS] You dont have enough money to buy Armor"cost2)
                return 
PLUGIN_HANDLED
            
}
            
            
cs_set_user_armor(player100CS_ARMOR_VESTHELM)
            
cs_set_user_money(playercurrent_cash cost2)
            
            
client_print(playerprint_chat"[KMS] You have successfully bought Armor")
        }
        
        case 
2:
        {
            if (
is_user_alive(player))
                return 
PLUGIN_HANDLED
                
            
new cost3 get_pcvar_num(g_respawn_cost)
            new 
current_cash cs_get_user_money(player)
            
            if (
cost3 current_cash)
            {
                
client_print(playerprint_chat"[KMS] You dont have enough money to respawn")
                return 
PLUGIN_HANDLED
            
}
            
            
g_hasRespawned[player] = true
            
            ExecuteHamB
(Ham_CS_RoundRespawnplayer)
            
cs_set_user_money(playercurrent_cash cost3)
            
            
client_print(playerprint_chat"[KMS] You are now RESPAWNED")
        }
        
        case 
3:
        {
            return 
PLUGIN_HANDLED
        
}
    }
    
    return 
PLUGIN_HANDLED

__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
 



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 14:39.


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