Raised This Month: $ Target: $400
 0% 

Menu error on compile.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-21-2009 , 04:41   Re: Menu error on compile.
Reply With Quote #1

Hey,

i have no time but i tried to fix it... :-(

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

#define PLUGIN    "Stat Menu (Test Mod)"
#define VERSION    "1.1"
#define AUTHOR    "ianglowz"

new plugin_on;
new 
speedpricearmorpricehealthprice;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /stat" "statmenu");
    
    
plugin_on    register_cvar("sm_pluginon","1");
    
speedprice    register_cvar("sm_speedprice","2000");
    
armorprice    register_cvar("sm_armorprice","2000");
    
healthprice    register_cvar("sm_healthprice","2500");
}

public 
statmenuid ) {
    if( 
get_pcvar_num(plugin_on) == ) {
        
        new 
menu menu_create"Choose your stat""menu_handler");
    
        
menu_additem(menu"Speed""1"0);
        
menu_additem(menu"Armor""2"0);
        
menu_additem(menu"Health""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
(menuitemaccessdata,5iName63callback)

    new 
key str_to_num(data)
    switch( 
key ) {
        case 
1: {    
            new 
money cs_get_user_money(id);
            
            if (
money >= get_pcvar_num(speedprice)) {
                
client_print(idprint_chat"You have selected Speed Stats."
                
set_user_maxspeed(id5.0)    
            } else {
                
client_print(id ,print_chat"You do not have enough money.WORK HARD!!")
            }
        }
    
        case 
2:{
    new 
money cs_get_user_money(id);
        
               if (
money >= get_pcvar_num(armorprice)) {
               
client_print(idprint_chat"You have selected Armor Stats.")
               
set_user_armor(id,200)
        } else {
             
client_print(id ,print_chat"You do not have enough money.WORK HARD!!")
            }
    }
        
        case 
3:{ 
    new 
money cs_get_user_money(id);
        
               if (
money >= get_pcvar_num(healthprice)) {
               
client_print(idprint_chat"You have choose Health Stats")
               
set_user_health(id,200)
               }  else  {
             
client_print(id ,print_chat"You do not have enough money.WORK HARD!!")
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ianglowz
Senior Member
Join Date: Nov 2008
Old 01-21-2009 , 04:49   Re: Menu error on compile.
Reply With Quote #2

Thanks to you.But still getting same error.
__________________
~ +karma to me and leave your name. ~
~ If you -karma to me,please leave your name so I know you are pro scripter. ~
~ Helping anytime ~


ianglowz is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-21-2009 , 08:11   Re: Menu error on compile.
Reply With Quote #3

Just be careful with braces, and remember that you can't have anything else in switch than cases.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN    "Stat Menu (Test Mod)"
#define VERSION    "1.1"
#define AUTHOR    "ianglowz"
new plugin_on;
new speedprice, armorprice, healthprice;
public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR);
 register_clcmd("say /stat" , "statmenu");
 
 plugin_on    = register_cvar("sm_pluginon","1");
 speedprice    = register_cvar("sm_speedprice","2000");
 armorprice    = register_cvar("sm_armorprice","2000");
 healthprice    = register_cvar("sm_healthprice","2500");
}
public statmenu( id ) {
 if( get_pcvar_num(plugin_on) == 1 ) {
  
  new menu = menu_create( "Choose your stat", "menu_handler");
  
  menu_additem(menu, "Speed", "1", 0);
  menu_additem(menu, "Armor", "2", 0);
  menu_additem(menu, "Health", "3",0);
  
  menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  menu_display(id, menu, 0);
 }
}
public menu_handler(id, menu, item) {
 if (item == MENU_EXIT) {
  menu_destroy(menu);
  return PLUGIN_HANDLED;
 }
 
 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: {    
   new money = cs_get_user_money(id);
   
   if (money >= get_pcvar_num(speedprice)) {
    client_print(id, print_chat, "You have selected Speed Stats.") 
    set_user_maxspeed(id, 5.0)    
    } else {
    client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
   }
  }
  
  case 2:{
   new money = cs_get_user_money(id);
   
   if (money >= get_pcvar_num(armorprice)) {
    client_print(id, print_chat, "You have selected Armor Stats.")
    set_user_armor(id,200)
    } else {
    client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
   }
  }
  
  case 3:{ 
   new money = cs_get_user_money(id);
   
   if (money >= get_pcvar_num(healthprice)) {
    client_print(id, print_chat, "You have choose Health Stats")
    set_user_health(id,200)
    }  else  {
    client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
   }
  }
 }
 menu_destroy(menu);
 return PLUGIN_HANDLED;
}
SnoW is offline
Send a message via MSN to SnoW
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-21-2009 , 08:30   Re: Menu error on compile.
Reply With Quote #4

Quote:
Originally Posted by SnoW View Post
Just be careful with braces, and remember that you can't have anything else in switch than cases.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN    "Stat Menu (Test Mod)"
#define VERSION    "1.1"
#define AUTHOR    "ianglowz"
new plugin_on;
new speedprice, armorprice, healthprice;
public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR);
 register_clcmd("say /stat" , "statmenu");
 
 plugin_on    = register_cvar("sm_pluginon","1");
 speedprice    = register_cvar("sm_speedprice","2000");
 armorprice    = register_cvar("sm_armorprice","2000");
 healthprice    = register_cvar("sm_healthprice","2500");
}
public statmenu( id ) {
 if( get_pcvar_num(plugin_on) == 1 ) {
  
  new menu = menu_create( "Choose your stat", "menu_handler");
  
  menu_additem(menu, "Speed", "1", 0);
  menu_additem(menu, "Armor", "2", 0);
  menu_additem(menu, "Health", "3",0);
  
  menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  menu_display(id, menu, 0);
 }
}
public menu_handler(id, menu, item) {
 if (item == MENU_EXIT) {
  menu_destroy(menu);
  return PLUGIN_HANDLED;
 }
 
 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: {    
   new money = cs_get_user_money(id);
   
   if (money >= get_pcvar_num(speedprice)) {
    client_print(id, print_chat, "You have selected Speed Stats.") 
    set_user_maxspeed(id, 5.0)    
    } else {
    client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
   }
  }
  
  case 2:{
   new money = cs_get_user_money(id);
   
   if (money >= get_pcvar_num(armorprice)) {
    client_print(id, print_chat, "You have selected Armor Stats.")
    set_user_armor(id,200)
    } else {
    client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
   }
  }
  
  case 3:{ 
   new money = cs_get_user_money(id);
   
   if (money >= get_pcvar_num(healthprice)) {
    client_print(id, print_chat, "You have choose Health Stats")
    set_user_health(id,200)
    }  else  {
    client_print(id ,print_chat, "You do not have enough money.WORK HARD!!")
   }
  }
 }
 menu_destroy(menu);
 return PLUGIN_HANDLED;
}
Hey,

Lol? i did it 2...maybe i forget to copy the new sma :-))
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ianglowz
Senior Member
Join Date: Nov 2008
Old 01-21-2009 , 08:43   Re: Menu error on compile.
Reply With Quote #5

Wow,thanks to you two.

Of course.Present to you.
__________________
~ +karma to me and leave your name. ~
~ If you -karma to me,please leave your name so I know you are pro scripter. ~
~ Helping anytime ~


ianglowz 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 01:46.


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