Raised This Month: $ Target: $400
 0% 

Strange Menu Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-27-2005 , 15:36   Strange Menu Error
Reply With Quote #1

Hey i just copyed the menu from the AMX Mod X doc and i get this errors from this line when i try to compile:
Code:
show_menu(id, key, menu)

I get this errors:
"undefined symbol "key""
"expected token ";" but found ")""
"invalid expression, assumed zero"
"too many error messages on one line"

and this warning:
"expresson has no effect"

WTF?

Cant post the script... Its a secret script
Im making a new huge plugin and dont want idea stealers
Anyway thats the only error line...

Avalanche??? hehe
XunTric is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-27-2005 , 20:16  
Reply With Quote #2

"undefined symbol "key""

means you didnt declare a variable named 'key'

The rest of the erros are probably because of the first one..

If you don't want to post the whole script, that is understandable, but at least post more than one line of code.. like, post maybe the function that code is in? If there is text in the menu you dont want others to see, then just change the text to something else..
xeroblood is offline
Send a message via MSN to xeroblood
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-28-2005 , 07:54  
Reply With Quote #3

Top Secret!!

Code:
// ============================================================================================================= // ******************************** // ============================================================================================================= public client_connect(id) {     new menu[192]     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     format(menu, 191, "*********^n^n1. *******^n2. *****^n3. ****")     show_menu(id, key, menu)     return PLUGIN_HANDLED } // ============================================================================================================= // ************************ // ============================================================================================================= public ********(id,key) {     if (key == 0)     {          client_print(id, print_chat, "******************")     } else if (key == 1) {          client_print(id, print_chat, "*****************")     } else if (key == 2) {          client_print(id, print_chat, "***************")     } } // ============================================================================================================= // ******************** // ============================================================================================================= public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2          //*********     register_menucmd(register_menuid("*********"), keys, ********) }
XunTric is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-28-2005 , 08:30  
Reply With Quote #4

Code:
public client_connect(id) {     new menu[192]     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     format(menu, 191, "*********^n^n1. *******^n2. *****^n3. ****")     show_menu(id, key, menu)     return PLUGIN_HANDLED }

Should Be:

Code:
public client_connect(id) {     new menu[192]     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     format(menu, 191, "*********^n^n1. *******^n2. *****^n3. ****")     show_menu(id, keys, menu)     return PLUGIN_HANDLED }

The variable key should be keys...
xeroblood is offline
Send a message via MSN to xeroblood
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-28-2005 , 08:45  
Reply With Quote #5

Thanks! Ill credit you...
If i ever complete the plugin like i think i never will make
-------------------------------------
EDIT:
My menu didnt show up... How do i make it show up when after a player joined the server???
XunTric is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-28-2005 , 09:30  
Reply With Quote #6

Ok i did so you can type "/changeclass" and the menu show up, but how to i make it come up when a player joins the server too?
XunTric is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-28-2005 , 09:49  
Reply With Quote #7

Well, problem is that client_connect() is called before they are actually put in the server.. And even then, you have to wait until they pick a team and model... Once that happens, they are in-game and can now see menus and stuff..

So, you could delay showing the menu until the event ResetHUD is called for each connecting user...

something like this:

Code:
#include <amxmodx> new g_bJustJoined[33] = false public plugin_init() {     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     register_menucmd(register_menuid("*********"), keys, "BlahBlah")     register_event( "ResetHUD", "ResetHud", "b" ) } public client_connect(id) {     g_bJustJoined[id] = true     return PLUGIN_CONTINUE } public ResetHud( id ) {     if( g_bJustJoined[id] )     {         ShowMenu( id )         g_bJustJoined[id] = false     }     return PLUGIN_CONTINUE } stock ShowMenu( id ) {     new menu[192]     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     format(menu, 191, "*********^n^n1. *******^n2. *****^n3. ****")     show_menu(id, keys, menu) } public BlahBlah(id,key) {     if (key == 0)     {          client_print(id, print_chat, "******************")     } else if (key == 1) {          client_print(id, print_chat, "*****************")     } else if (key == 2) {          client_print(id, print_chat, "***************")     } }
xeroblood is offline
Send a message via MSN to xeroblood
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-28-2005 , 10:04  
Reply With Quote #8

Thanks, but i get "undefined symbol" error from this line:
Code:
    g_bJustJoined[id] = true

And now that i changed this stuffs, i dont got "say /changeclass"..
How do i add so people can type "/changeclass" too?
XunTric is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-28-2005 , 10:35  
Reply With Quote #9

Ooops.. my bad.. it should be:

Code:
new bool:g_bJustJoined[33] = false

And your changeclass thingy would be:

Code:
public plugin_init() {     // ....     register_clcmd( "say /changeclass", "DoChangeClass" )     register_clcmd( "say_team /changeclass", "DoChangeClass" ) } //... public DoChangeClass( id ) {     ShowMenu( id )     return PLUGIN_HANDLED } // ...
xeroblood is offline
Send a message via MSN to xeroblood
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-28-2005 , 10:50  
Reply With Quote #10

Didnt work either... Check your PM's xeroblood.
XunTric 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 14:02.


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