Raised This Month: $ Target: $400
 0% 

[SOLVED] Menu bug


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:52.


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