AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Strange Menu Error (https://forums.alliedmods.net/showthread.php?t=10731)

XunTric 02-27-2005 15:36

Strange Menu Error
 
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 :D
Im making a new huge plugin and dont want idea stealers :lol:
Anyway thats the only error line...

Avalanche??? hehe

xeroblood 02-27-2005 20:16

"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..

XunTric 02-28-2005 07:54

Top Secret!! :lol:

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, ********) }

xeroblood 02-28-2005 08:30

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...

XunTric 02-28-2005 08:45

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 02-28-2005 09:30

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?

xeroblood 02-28-2005 09:49

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, "***************")     } }

XunTric 02-28-2005 10:04

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?

xeroblood 02-28-2005 10:35

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 } // ...

XunTric 02-28-2005 10:50

Didnt work either... Check your PM's xeroblood.


All times are GMT -4. The time now is 14:02.

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