Raised This Month: $ Target: $400
 0% 

Invalid Statement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 10-12-2009 , 13:32   Invalid Statement
Reply With Quote #1

Whats wrong with this 111 Line:

PHP Code:
        case 2
The error:

Code:
(111) : warning 217: loose indentation
(111) : error 014: invalid statement; not in switch
(111) : warning 215: expression has no effect
(111) : error 001: expected token: ";", but found ":"
(111) : error 029: invalid expression, assumed zero
(111) : fatal error 107: too many error messages on one line
DoviuX is offline
Send a message via Skype™ to DoviuX
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 10-12-2009 , 13:33   Re: Invalid Statement
Reply With Quote #2

The thing that it isn't inside a switch.
SnoW is offline
Send a message via MSN to SnoW
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 10-12-2009 , 13:43   Re: Invalid Statement
Reply With Quote #3

What can be wrong ?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "SURF SHOP"
#define VERSION "1.0"
#define AUTHOR "DoviuX"

/*================================================================================
 [Customization]
=================================================================================*/
new const gHealth[] = "SurfShop/Health.wav"
new const gArmor[] = "SurfShop/Armor.wav"
new const gGun[] = "SurfShop/Gun.wav"
new const gNoMoney[] = "SurfShop/NoMoney.wav"

/*================================================================================
 [New Variables]
=================================================================================*/

new health
new armor
new randomgun
new BoostHealth

/*================================================================================
 [Init and Precache]
=================================================================================*/

public plugin_init()
{
      
register_pluginPLUGINVERSIONAUTHOR );

        
register_logevent"logevent_round_start"2"1=Round_Start" );

      
register_clcmd("say /shop""SurfShop")
      
register_clcmd("say_team /shop""SurfShop")

    
BoostHealth register_cvar("amx_boost_health""145");
    
      
health register_cvar("price_healthbooster""3500")
      
armor register_cvar("price_armor""2000")
      
randomgun register_cvar("price_gun""16000")

      
register_dictionary("surf_shop.txt");
}

/*================================================================================
 [Plugin Start]
=================================================================================*/

public plugin_precache()
{    
    
precache_sound("gHealth")
    
precache_sound("gArmor")
    
precache_sound("gGun")
    
precache_sound("gNoMoney")
}

public 
SurfShop(id)
{
    new 
menu menu_create("\ySurf Shop!""menu_handler")
    
    
menu_additem(menu"Health Booster""1"0)
    
menu_additem(menu"Armor""2"0)
    
menu_additem(menu"Random Gun""3"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1
        {
            new 
Cost get_pcvar_num(health);
            new 
Money cs_get_user_money(id);
            
            if (
Money Cost)
            {
                
client_print(idprint_chat"%L"LANG_PLAYER"NO_MONEY"Cost);
                
client_cmd0"spk %s"gNoMoney);
                return 
PLUGIN_HANDLED;
            } 
            else 
            {

                
set_user_health(idget_user_health(id) + get_pcvar_num(health));
                
client_print(idprint_chat"%L"LANG_PLAYER"HEALTH");
                        
client_cmd0"spk %s"gHealth);    
                
                
Money -= Cost;
    
                
cs_set_user_money(idMoney);
            }

        case 
2
        {
            new 
Cost get_pcvar_num(armor);
            new 
Money cs_get_user_money(id);
            
            if (
Money Cost)
            {
                
client_print(idprint_chat"%L"LANG_PLAYER"NO_MONEY"Cost);
                
client_cmd0"spk %s"gNoMoney);
                return 
PLUGIN_HANDLED
            

            else 
            {
                
set_user_armor(id100)
                
client_print(idprint_chat"%L"LANG_PLAYER"ARMOR");
                        
client_cmd0"spk %s"gARMOR);
    
                
Money -= Cost;
    
                
cs_set_user_money(idMoney);
                
            }

        case 
3
        {
            new 
Cost get_pcvar_num(randomgun);
            new 
Money cs_get_user_money(id);
            
            if (
Money Cost)
            {
                
client_print(idprint_chat"%L"LANG_PLAYER"NO_MONEY"Cost);
                
client_cmd0"spk %s"gNoMoney);
                return 
PLUGIN_HANDLED
            

            else 
            {
                    
strip_user_weapons(id)
                    
give_item(idPrimary[random_num(0sizeof Primary 1)])
                    
give_item(idSecondary[random_num(0sizeof Secondary 1)])
                    
give_item(idGrenades[random_num(0sizeof Grenades 1)])
                    
give_item(idweapon_knife)
                
client_print(idprint_chat"%L"LANG_PLAYER"RANDOMGUN");
                        
client_cmd0"spk %s"gGun);
    
                
Money -= Cost;
    
                
cs_set_user_money(idMoney);    
                
            }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED;
}

public 
logevent_round_start(id
{
            
set_hudmessage(25510001.00.3312.05.0);
            
show_hudmessage0"SurfShop maded by TBagT !" );

DoviuX is offline
Send a message via Skype™ to DoviuX
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 10-12-2009 , 13:44   Re: Invalid Statement
Reply With Quote #4

You don't close the case 1 so the parser thinks case 2 isn't inside the switch but comes after it.
SnoW is offline
Send a message via MSN to SnoW
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 10-12-2009 , 13:49   Re: Invalid Statement
Reply With Quote #5

Thx i get it now
DoviuX is offline
Send a message via Skype™ to DoviuX
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-13-2009 , 10:54   Re: Invalid Statement
Reply With Quote #6

PHP Code:
public plugin_precache() 
{     
    
precache_sound("gHealth"
    
precache_sound("gArmor"
    
precache_sound("gGun"
    
precache_sound("gNoMoney"



PHP Code:
public plugin_precache() 
{     
    
precache_sound(gHealth
    
precache_sound(gArmor
    
precache_sound(gGun
    
precache_sound(gNoMoney

__________________
alan_el_more is offline
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 11:38.


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