AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu plugins problem (plz help me) (https://forums.alliedmods.net/showthread.php?t=159468)

Joker. 06-17-2011 13:38

Menu plugins problem (plz help me)
 
1 Attachment(s)
PHP Code:

mshop.sma(68) : warning217loose indentation
mshop
.sma(68) : error 014invalid statementnot in switch
mshop.sma(68) : warning215expression has no effect
mshop
.sma(68) : error 001expected token";"but found ":"
mshop.sma(68) : error 029invalid expressionassumed zero
mshop
.sma(68) : fatal error 107too many error messages on one line 

I don't know problem of my code. Anyone can help me to solve the problem?:cry:

Exolent[jNr] 06-17-2011 13:45

Re: Menu plugins problem (plz help me)
 
On every case, you have this:
PHP Code:

        case #: 
        

            { 
// remove this 


Joker. 06-17-2011 23:32

Re: Menu plugins problem (plz help me)
 
1 Attachment(s)
PHP Code:

mshop1.sma(77) : warning217loose indentation
mshop1
.sma(77) : error 014invalid statementnot in switch
mshop1.sma(77) : warning215expression has no effect
mshop1
.sma(77) : error 001expected token";"but found ":"
mshop1.sma(77) : error 029invalid expressionassumed zero
mshop1
.sma(77) : fatal error 107too many error messages on one line 

It's still not work:cry::cry::cry:

nikhilgupta345 06-17-2011 23:37

Re: Menu plugins problem (plz help me)
 
You had an extra brace on line 77 (it says the line number where the error occurs right next to the file name.)

You also had used fm_set_user_health, but had included the fun module, so I just changed it to set_user_health for you.

PHP Code:


#include <amxmodx>
#include <cstrike> 
#include <fun>
 
public plugin_init() 

    
register_clcmd"mshop","ExtraMenu"); 


public 
ExtraMenu(id


    new 
menu menu_create("\w something""menu_handler"); 
 
    
menu_additem(menu"\w something""1"0); 
    
menu_additem(menu"\w something""2"0); 
    
menu_additem(menu"\w something""3"0); 
    
menu_additem(menu"\w something""4"0); 
   
    
menu_setprop(menuMPROP_EXITMEXIT_ALL); 
 
    
menu_display(idmenu0); 
 
    return 
PLUGIN_HANDLED

 
public 
menu_handler(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
        { 
            new 
money cs_get_user_money(id
            new 
money1 500;
            if (
money <money1)
            {     
            
client_print(idprint_chat"[AMXX] something $%d "money1);
            return 
PLUGIN_CONTINUE;
            }
            else if (
money >= money1)
            {
                
give_item(id"weapon_hegrenade");
                
cs_set_user_money(idmoney-money1)
                
menu_destroy(menu);      
                return 
PLUGIN_HANDLED;      
                }
            } 
        case 
2
        { 
            new 
money cs_get_user_money(id
            new 
money2 500;
            if (
money <money2)
            {     
            
client_print(idprint_chat"[AMXX] something $%d "money2);
            return 
PLUGIN_CONTINUE;
            }
            else if (
money >= money2)
            {
                
give_item(id"weapon_smokegrenade");
                
cs_set_user_money(idmoney-money2)
                
menu_destroy(menu);     
                return 
PLUGIN_HANDLED;    
            } 
        }
        case 
3
        { 
            new 
money cs_get_user_money(id
            new 
money3 5000;
            if (
money <money3)
            {     
                
client_print(idprint_chat"[AMXX] something $%d "money3);
                return 
PLUGIN_CONTINUE;
            }
            else if (
money >= money3)
            {
                
client_print(idprint_chat"[AMXX] something");
                new 
health
                health 
get_user_health(id) + 150
                set_user_health
(idhealth)
                
cs_set_user_money(idmoney-money3)
                
menu_destroy(menu);      
                return 
PLUGIN_HANDLED;     
                }
            } 
        case 
4
        { 
            new 
money cs_get_user_money(id
            new 
money4 1500;
            if (
money <money4)
            {     
                
client_print(idprint_chat"something $%d "money4);
                return 
PLUGIN_CONTINUE;
            }
            else if (
money >= money4)
            {
                
client_print(idprint_chat"[AMXX] something");
                
cs_set_user_armor(id ,150 ,CS_ARMOR_KEVLAR);
                
cs_set_user_money(idmoney-money4)
                
menu_destroy(menu);     
                return 
PLUGIN_HANDLED;    
            }
        } 
    } 
 
    
menu_destroy(menu); 

    return 
PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/ 


Joker. 06-18-2011 00:09

Re: Menu plugins problem (plz help me)
 
It is work now. Thx


All times are GMT -4. The time now is 23:28.

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