Raised This Month: $ Target: $400
 0% 

Shop menu problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Joker.
Member
Join Date: Mar 2011
Old 05-29-2011 , 07:34   Shop menu problem
Reply With Quote #1

PHP Code:
shopzx.sma(39) : warning217loose indentation
shopzx
.sma(66) : warning217loose indentation
shopzx
.sma(66) : error 014invalid statementnot in switch
shopzx.sma(66) : warning215expression has no effect
shopzx
.sma(66) : error 001expected token";"but found ":"
shopzx.sma(66) : error 029invalid expressionassumed zero
shopzx
.sma(66) : fatal error 107too many error messages on one line 
I don't know where is the problem. Anyone can help me ??
sorry for my bad english.

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>
#include <fakemeta>
 
#define PLUGIN "Zombie Shop"
#define VERSION ""
#define AUTHOR ""
 
public plugin_init()
{
          register_plugin(PLUGIN, VERSION,AUTHOR)
          register_clcmd("say /shop","mostrarmenu")
          register_clcmd("say_team /shop","mostrarmenu")
          register_clcmd("shop", "mostrarmenu")
}
public mostrarmenu(id)
{
        if ( cs_get_user_team(id) == CS_TEAM_T )
        {
                client_print(id, print_center, "[系統]你是喪屍,不能購買武器")
        }
        else
        {
                new menu = menu_create("\r武器商店:", "mostrar_cliente")
 
                menu_additem(menu, "\w 燃燒彈 $400", "1", 0) 
                menu_additem(menu, "\w 冰凍彈 $400", "2", 0)
                menu_additem(menu, "\w 閃光彈 $400", "3", 0)
                menu_additem(menu, "\w 300血量 $5000", "4", 0)
                menu_additem(menu, "\w 100護甲 $1000", "5", 0)
                menu_additem(menu, "\w 黃金AK $7200", "6", 0)             
 
        menu_display(id, menu, 0)
        }
}
public mostrar_cliente(id, menu, item)
{
         new data[6], iName[64]
         new access, callback
 
         menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
 
         new key = str_to_num(data)
 
         switch(key)
         {
                        case 1:{
                                  if(cs_get_user_money(id) >= 400)
                                  {
                                  give_item(id, "weapon_hegrenade")
                                  cs_set_user_money(id,cs_get_user_money(id) - 400)
                                  client_print(id, print_chat, "[系統]你已購買燃燒彈。")
                                  return PLUGIN_HANDLED
                                  }
                                  else
                                  {
                                  client_print(id, print_chat, "[系統]你沒有足夠金錢購買燃燒彈")
                                  }
                       case 2:{
                                  if(cs_get_user_money(id) >= 400)
                                  {
                                  give_item(id, "weapon_smokegrenade")
                                  cs_set_user_money(id,cs_get_user_money(id) - 400)
                                  client_print(id, print_chat, "[系統]你已購買冰凍彈。")
                                  return PLUGIN_HANDLED
                                  }
                                  else
                                  {
                                  client_print(id, print_chat, "[系統]你沒有足夠金錢購買冰凍彈")
                                  }
                       case 3:{
                                  if(cs_get_user_money(id) >= 400)
                                  {
                                  give_item(id, "weapon_flashbang")
                                  cs_set_user_money(id,cs_get_user_money(id) - 400)
                                  client_print(id, print_chat, "[系統]你已購買閃光彈。")
                                  return PLUGIN_HANDLED
                                  }
                                  else
                                  {
                                  client_print(id, print_chat, "[系統]你沒有足夠金錢購買閃光彈")
                                  }
                                  }
                      case 4:{
                                  if(cs_get_user_money(id) >= 5000)
                                  {
                                  new health
                                  health = get_user_health(id) + 300
                                  fm_set_user_health(id, health)
                                  cs_set_user_money(id,cs_get_user_money(id) - 5000)
                                  client_print(id, print_chat, "[系統]你已增加300血量")
                                  return PLUGIN_HANDLED
                                  }
                                  else
                                  {
                                  client_print(id, print_chat, "[系統]你沒有足夠金錢購買300血量")
                                   }
                                   }
                        case 5:{
                                   if(cs_get_user_money(id) >= 1000)
                                   {
                                   cs_set_user_armor(id ,100 ,CS_ARMOR_KEVLAR)
                                   cs_set_user_money(id,cs_get_user_money(id) - 1000)
                                   client_print(id, print_chat, "[系統]你已增加100護甲")
                                   return PLUGIN_HANDLED
                                   }
                                   else
                                   {
                                   client_print(id, print_chat, "[系統]]你沒有足夠金錢購買護甲")
                                   }
                                   }
                        case 6:{ 
                                   client_cmd(id, "goldenak", iName);    
                                   return PLUGIN_HANDLED
                                   }
                               }
                       }
                       menu_destroy(menu)
                       return PLUGIN_HANDLED
}

Last edited by Joker.; 05-29-2011 at 07:53. Reason: i write something wrong
Joker. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-30-2011 , 02:16   Re: Shop menu problem
Reply With Quote #2

You must close [the braces of] a case statement before starting a new case.

I.e.

PHP Code:
switch( variable )
{
    case 
1:
    {
        
// stuff
    
}
    case 
2:
    {
        
// stuff2
    
}
    
// ...

__________________
fysiks is online now
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 22:49.


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