Raised This Month: $ Target: $400
 0% 

[SOLVED] Menu bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-12-2009 , 13:29   [SOLVED] Menu bug
Reply With Quote #1

Hi, when i do this:
menu_additem(mPsArmorShop, item, "10");

It takes it as its the first 1, in the menu handler it should be case 10 it will do, but it does case 1, any1 know why?

Thanks
-zacky

Last edited by zacky; 06-12-2009 at 13:57.
zacky is offline
Send a message via Skype™ to zacky
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-12-2009 , 13:32   Re: Menu bug
Reply With Quote #2

Show code for start.
__________________
xPaw is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-12-2009 , 13:38   Re: Menu bug
Reply With Quote #3

PHP Code:
new mPsArmorShop menu_create("\rArmor \wShop""handlePsArmorShop");

new 
item[128];
formatex(item127"100 Armor on spawn \r(You have this all the time) \y- \r%d \wpoints^n"get_pcvar_num(gCvarAlwaysHundredArmorCost));
menu_additem(mPsArmorShopitem"1");

new 
item1[64];
formatex(item163"10 Extra Armor \r(CT) \y- \r%d \wpoints"get_pcvar_num(gCvarCtArmorOneCost));
menu_additem(mPsArmorShopitem1"2");

formatex(item163"20 Extra Armor \r(CT) \y- \r%d \wpoints"get_pcvar_num(gCvarCtArmorTwoCost));
menu_additem(mPsArmorShopitem1"3");

formatex(item163"30 Extra Armor \r(CT) \y- \r%d \wpoints"get_pcvar_num(gCvarCtArmorThreeCost));
menu_additem(mPsArmorShopitem1"4");

formatex(item163"40 Extra Armor \r(CT) \y- \r%d \wpoints"get_pcvar_num(gCvarCtArmorFourCost));
menu_additem(mPsArmorShopitem1"5");

formatex(item163"50 Extra Armor \r(CT) \y- \r%d \wpoints^n"get_pcvar_num(gCvarCtArmorFiveCost));
menu_additem(mPsArmorShopitem1"6");

formatex(item163"10 Extra Armor \r(T) \y- \r%d \wpoints"get_pcvar_num(gCvarTArmorOneCost));
menu_additem(mPsArmorShopitem1"7");

formatex(item163"20 Extra Armor \r(T) \y- \r%d \wpoints"get_pcvar_num(gCvarTArmorTwoCost));
menu_additem(mPsArmorShopitem1"8");

formatex(item163"30 Extra Armor \r(T) \y- \r%d \wpoints"get_pcvar_num(gCvarTArmorThreeCost));
menu_additem(mPsArmorShopitem1"9");

formatex(item163"40 Extra Armor \r(T) \y- \r%d \wpoints"get_pcvar_num(gCvarTArmorFourCost));
menu_additem(mPsArmorShopitem1"10");

formatex(item163"50 Extra Armor \r(T) \y- \r%d \wpoints"get_pcvar_num(gCvarTArmorFiveCost));
menu_additem(mPsArmorShopitem1"11");

menu_setprop(mPsArmorShopMPROP_EXITMEXIT_ALL);
menu_setprop(mPsArmorShopMPROP_EXITNAME"Close");
menu_display(idmPsArmorShop0); 
PHP Code:
public handlePsArmorShop(idmPsArmorShopitem) {
    if (
item == MENU_EXIT) {
        
menu_destroy(mPsArmorShop);
        return 
PLUGIN_HANDLED;
    }
    
    new 
Data[2];
    new 
Access;
    new 
Callback;
    
menu_item_getinfo(mPsArmorShopitemAccessData1__Callback);
    
    new 
Key str_to_num(Data);
    
    switch (
Key)
    {
        case 
1: { // 100 Armor on spawn
            
new iCost get_pcvar_num(gCvarAlwaysHundredArmorCost);
            
            if (
gPlayerArmorSpawn[id] == 100) {
                
ColorChat(idGREEN"%s^x01 You already have this^x03 item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerArmorSpawn[id] = 100;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 100 Armor on spawn^x04 (You have this all the time)"PREFIX);
        }
        case 
2: { // 10 Extra  (CT)
            
new iCost get_pcvar_num(gCvarCtArmorOneCost);
            
            if (
gPlayerCtArmor[id] == 10 || gPlayerCtArmor[id] == 20 || gPlayerCtArmor[id] == 30 || gPlayerCtArmor[id] == 40 || gPlayerCtArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerCtArmor[id] = 10;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 10 Extra Armor^x01 as CT^x04 (You have this all the time)"PREFIX);
        }
        case 
3: { // 20 Extra Armor (CT)
            
new iCost get_pcvar_num(gCvarCtArmorTwoCost);
            
            if (
gPlayerCtArmor[id] == 20 || gPlayerCtArmor[id] == 30 || gPlayerCtArmor[id] == 40 || gPlayerCtArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerCtArmor[id] != 10) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 10 Extra Armor (CT)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerCtArmor[id] = 20;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 20 Extra Armor^x01 as CT^x04 (You have this all the time)"PREFIX);
        }
        case 
4: { // 30 Extra Armor (CT)
            
new iCost get_pcvar_num(gCvarCtArmorThreeCost);
            
            if (
gPlayerCtArmor[id] == 30 || gPlayerCtArmor[id] == 40 || gPlayerCtArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerCtArmor[id] != 20) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 20 Extra Armor (CT)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerCtArmor[id] = 30;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 30 Extra Armor^x01 as CT^x04 (You have this all the time)"PREFIX);
        }
        case 
5: { // 40 Extra Armor (CT)
            
new iCost get_pcvar_num(gCvarCtArmorFourCost);
            
            if (
gPlayerCtArmor[id] == 40 || gPlayerCtArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerCtArmor[id] != 30) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 30 Extra Armor (CT)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerCtArmor[id] = 40;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 40 Extra Armor^x01 as CT^x04 (You have this all the time)"PREFIX);
        }
        case 
6: { // 50 Extra Armor (CT)
            
new iCost get_pcvar_num(gCvarCtArmorFiveCost);
            
            if (
gPlayerCtArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerCtArmor[id] != 40) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 40 Extra Armor (CT)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerCtArmor[id] = 50;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 50 Extra Armor^x01 as CT^x04 (You have this all the time)"PREFIX);
        }
        case 
7: { // 10 Extra Armor (T)
            
new iCost get_pcvar_num(gCvarTArmorOneCost);
            
            if (
gPlayerTArmor[id] == 10 || gPlayerTArmor[id] == 20 || gPlayerTArmor[id] == 30 || gPlayerTArmor[id] == 40 || gPlayerTArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerTArmor[id] = 10;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 10 Extra Armor^x01 as T^x04 (You have this all the time)"PREFIX);
        }
        case 
8: { // 20 Extra Armor (T)
            
new iCost get_pcvar_num(gCvarTArmorTwoCost);
            
            if (
gPlayerTArmor[id] == 20 || gPlayerTArmor[id] == 30 || gPlayerTArmor[id] == 40 || gPlayerTArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerTArmor[id] != 10) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 10 Extra Armor (T)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerTArmor[id] = 20;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 20 Extra Armor^x01 as T^x04 (You have this all the time)"PREFIX);
        }
        case 
9: { // 30 Extra Armor (T)
            
new iCost get_pcvar_num(gCvarTArmorThreeCost);
            
            if (
gPlayerTArmor[id] == 30 || gPlayerTArmor[id] == 40 || gPlayerTArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerTArmor[id] != 20) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 20 Extra Armor (T)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerTArmor[id] = 30;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 30 Extra Armor^x01 as T^x04 (You have this all the time)"PREFIX);
        }
        case 
10: { // 40 Extra Armor (T)
            
new iCost get_pcvar_num(gCvarTArmorFourCost);
            
            if (
gPlayerTArmor[id] == 40 || gPlayerTArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerTArmor[id] != 30) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 30 Extra Armor (T)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerTArmor[id] = 40;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 40 Extra Armor^x01 as T^x04 (You have this all the time)"PREFIX);
        }
        case 
11: { // 50 Extra Armor (T)
            
new iCost get_pcvar_num(gCvarTArmorFiveCost);
            
            if (
gPlayerTArmor[id] == 50) {
                
ColorChat(idGREEN"%s^x01 You already have this item"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerPoints[id] < iCost) {
                
ColorChat(idGREEN"%s^x01 You don't have enough^x03 points"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            if (
gPlayerTArmor[id] != 40) {
                
ColorChat(idGREEN"%s^x01 You must buy^x03 40 Extra Armor (T)^x01 before you can buy this"PREFIX);
                return 
PLUGIN_CONTINUE;
            }
            
            
gPlayerPoints[id] -= iCost;
            
gPlayerTArmor[id] = 50;
            
            
ColorChat(idGREEN"%s^x01 You just bought^x03 50 Extra Armor^x01 as T^x04 (You have this all the time)"PREFIX);
        }
    }
    
    
menu_destroy(mPsArmorShop);
    return 
PLUGIN_HANDLED;

zacky is offline
Send a message via Skype™ to zacky
larito
Veteran Member
Join Date: Nov 2008
Location: Argentina- Mendoza
Old 06-12-2009 , 13:44   Re: Menu bug
Reply With Quote #4

I think understand the question!

the option is located in frist position because not exist key number 10 , exist key numer 1 , 2, ,3 ,4, 5 ,6, 7, 8, 9 and 0

I help you?
__________________
Facebook: Ariel Berardi
larito is offline
Send a message via MSN to larito
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-12-2009 , 13:57   Re: Menu bug
Reply With Quote #5

Quote:
Originally Posted by larito View Post
I think understand the question!

the option is located in frist position because not exist key number 10 , exist key numer 1 , 2, ,3 ,4, 5 ,6, 7, 8, 9 and 0

I help you?
No, sorry, but xpaw found out error.

Thanks xpaw
zacky is offline
Send a message via Skype™ to zacky
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-12-2009 , 13:57   Re: Menu bug
Reply With Quote #6

Quote:
Originally Posted by larito View Post
I think understand the question!

the option is located in frist position because not exist key number 10 , exist key numer 1 , 2, ,3 ,4, 5 ,6, 7, 8, 9 and 0

I help you?
Nop. He just using wrong menu_item_getinfo
__________________
xPaw is offline
larito
Veteran Member
Join Date: Nov 2008
Location: Argentina- Mendoza
Old 06-12-2009 , 14:53   Re: [SOLVED] Menu bug
Reply With Quote #7

you´re right

I not see the code because he posted the code at same time what i posted the answer

Same i am practicing english with answer
__________________
Facebook: Ariel Berardi
larito is offline
Send a message via MSN to larito
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 13:53.


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