AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Saving Menu Variables (https://forums.alliedmods.net/showthread.php?t=50708)

OmgHi 02-01-2007 22:26

Saving Menu Variables
 
Hello, this is part of the code for my menu, once this part of the menu is called, i want the variables in the menu to be saved, onto the menu keys, and onto the next menu, and so forth...

I want the "Mage,SelectedPlayers,PlayerSelecter,ExpG od" To be saved onto the keys and following menus that are called instead of just the regular (id,keys)

This is my attempt at doing that....

Code:
register_menucmd(register_menuid("ExpMenu:"),1023,"ExpMenu1Function") public ExpMenu1(Mage,SelectedPlayers,PlayerSelecter,ExpGod) {  new exp[32], exp1[32], exp2[32], exp3[32]  get_euser_exp(mage,exp,31)  get_euser_exp(SelectedPlayers,exp1,31)  get_euser_exp(PlayerSelecter,exp2,31)  get_euser_exp(ExpGod,exp3,31)  client_print(menuuser,print_center,"%s|%s|%s|%s|",exp,exp1,exp2,exp3)  new menuBodyp[512]  new len = format(menuBodyp,511,"ExpMenu:^n^nMenu Info^n",name,name1)  len += format(menuBodyp[len],511-len,"1. More Info^n2. Exp God Info^n^n0. Exit")  show_menu(Mage,SelectedPlayers,PlayerSelecter,ExpGod,((1<<0)|(1<<1)|(1<<9)),menuBodyp)  return PLUGIN_HANDLED } public ExpMenu1Function(Mage,SelectedPlayers,PlayerSelecter,ExpGod,key) {  switch(key)  {   case 0:   {    ExpMenu1MoreInfo(Mage,SelectedPlayers,PlayerSelecter,ExpGod)   }   case 1:   {    ExpMenu1ExpGod(Mage,SelectedPlayers,PlayerSelecter,ExpGod)   }   case 9:   {    return PLUGIN_HANDLED   }  }  return PLUGIN_HANDLED }

But it gives me an argument error at the "show_menu" line when I compile :(

So my questions is how, do I save multiple variables in the menus?

Edit:

Hmm more explaining...

I want only the person who pressed the menu to see the menu(playerselecter), but i want the other 3 player variables (mage, expgod, selectedplayers) to be saved as well..

So that in the next menus i can also do things like get_user_authid, get_euser_exp, get_euser_level, etc on the variables! Thanks!

[ --<-@ ] Black Rose 02-02-2007 06:01

Re: Help- Saving Menu Variables
 
WTF!? You can't do it like that! You have to loop it!
I suggest you read through some kinda manual.

Code:
new players[4] players[0] = Mage players[1] = SelectedPlayers players[2] = PlayerSelecter players[3] = ExpGod for ( new i ; i < 4 ; i++ )     show_menu(players[i], (1<<0)|(1<<1)|(1<<9), menuBodyp)
And that is not the only error.

OmgHi 02-02-2007 13:29

Re: Help- Saving Menu Variables
 
That would make it so only the person who used the menu sees the menu, but it would save the other 3 variables right?

OmgHi 02-02-2007 13:42

Re: Help- Saving Menu Variables
 
This really looks like its going to send the menu to EVERYONE in the variables instead of just 1 person the menu should go to :(...

[ --<-@ ] Black Rose 02-02-2007 14:04

Re: Help- Saving Menu Variables
 
Well, wtf do you mean by this then?
Explain exactly what this does.
PHP Code:

show_menu(Mage,SelectedPlayers,PlayerSelecter,ExpGod,((1<<0)|(1<<1)|(1<<9)),menuBodyp


OmgHi 02-02-2007 14:13

Re: Help- Saving Menu Variables
 
Yes I know that makes no sence, but it was the only way I could think of to describe what im trying to do...

I want the menu to only go to 1 person ( the person who selected the menu ), but I want the other 3 variables saved, so I can perform commands on them!

This is what you gave me...

Code:
register_menucmd(register_menuid("ExpMenu:"),1023,"ExpMenu1Function") public ExpMenu1(Mage,SelectedPlayers,PlayerSelecter,ExpGod) {  new exp[32], exp1[32], exp2[32], exp3[32]  get_euser_exp(mage,exp,31)  get_euser_exp(SelectedPlayers,exp1,31)  get_euser_exp(PlayerSelecter,exp2,31)  get_euser_exp(ExpGod,exp3,31)  client_print(menuuser,print_center,"%s|%s|%s|%s|",exp,exp1,exp2,exp3)  new menuBodyp[512]  new len = format(menuBodyp,511,"ExpMenu:^n^nMenu Info^n",name,name1)  len += format(menuBodyp[len],511-len,"1. More Info^n2. Exp God Info^n^n0. Exit")  new players[4]  players[0] = Mage  players[1] = SelectedPlayers  players[2] = PlayerSelecter  players[3] = ExpGod  for( new i ; i < 4; i++ )  show_menu(players[i],((1<<0)|(1<<1)|(1<<9)),menuBodyp)  return PLUGIN_HANDLED } public ExpMenu1Function(players) {  switch(key)  {   case 0:   {    ExpMenu1MoreInfo(players)   }   case 1:   {    ExpMenu1ExpGod(players)   }   case 9:   {    return PLUGIN_HANDLED   }  }  return PLUGIN_HANDLED }

Which does not give me what I need at all. :(

Not only is the menu going to all 4 people, but now i can't access the variables!

I cant do..

Code:
register_menucmd(register_menuid("ExpMenu:"),1023,"ExpMenu1Function") public ExpMenu1(Mage,SelectedPlayers,PlayerSelecter,ExpGod) {  new exp[32], exp1[32], exp2[32], exp3[32]  get_euser_exp(mage,exp,31)  get_euser_exp(SelectedPlayers,exp1,31)  get_euser_exp(PlayerSelecter,exp2,31)  get_euser_exp(ExpGod,exp3,31)  client_print(menuuser,print_center,"%s|%s|%s|%s|",exp,exp1,exp2,exp3)  new menuBodyp[512]  new len = format(menuBodyp,511,"ExpMenu:^n^nMenu Info^n",name,name1)  len += format(menuBodyp[len],511-len,"1. More Info^n2. Exp God Info^n^n0. Exit")  new players[4]  players[0] = Mage  players[1] = SelectedPlayers  players[2] = PlayerSelecter  players[3] = ExpGod  for( new i ; i < 4; i++ )  show_menu(players[i],((1<<0)|(1<<1)|(1<<9)),menuBodyp)  return PLUGIN_HANDLED } public ExpMenu1Function(players) {  switch(key)  {   case 0:   {    ExpMenu1MoreInfo(players[0],players[1],players[2],players[3])   }   case 1:   {    ExpMenu1ExpGod(players[0],players[1],players[2],players[3])   }   case 9:   {    return PLUGIN_HANDLED   }  }  return PLUGIN_HANDLED }

or...

Code:
register_menucmd(register_menuid("ExpMenu:"),1023,"ExpMenu1Function") public ExpMenu1(Mage,SelectedPlayers,PlayerSelecter,ExpGod) {  new exp[32], exp1[32], exp2[32], exp3[32]  get_euser_exp(mage,exp,31)  get_euser_exp(SelectedPlayers,exp1,31)  get_euser_exp(PlayerSelecter,exp2,31)  get_euser_exp(ExpGod,exp3,31)  client_print(menuuser,print_center,"%s|%s|%s|%s|",exp,exp1,exp2,exp3)  new menuBodyp[512]  new len = format(menuBodyp,511,"ExpMenu:^n^nMenu Info^n",name,name1)  len += format(menuBodyp[len],511-len,"1. More Info^n2. Exp God Info^n^n0. Exit")  new players[4]  players[0] = Mage  players[1] = SelectedPlayers  players[2] = PlayerSelecter  players[3] = ExpGod  for( new i ; i < 4; i++ )  show_menu(PlayerSelecter,((1<<0)|(1<<1)|(1<<9)),menuBodyp)  return PLUGIN_HANDLED } public ExpMenu1Function(PlayerSelecter) {  switch(key)  {   case 0:   {    ExpMenu1MoreInfo(players[0],players[1],players[2],players[3])   }   case 1:   {    ExpMenu1ExpGod(players[0],players[1],players[2],players[3])   }   case 9:   {    return PLUGIN_HANDLED   }  }  return PLUGIN_HANDLED }

This last one describes more what im trying to do...

I want the menu to only go to 1 person, but I want the 4 variables saved so I can still access them to perform commands on them!

Thanks if you can help!

JCobra 02-02-2007 15:45

Re: Help- Saving Menu Variables
 
You're supposed to be banned.... Go away.

OmgHi 02-02-2007 15:56

Re: Help- Saving Menu Variables
 
-Karma'ed and Flamed for no reason?

Seems to me YOU should be banned...

Get the hell off my thread!

Mod! Delete him! >.<

OmgHi 02-02-2007 17:32

Re: Saving Menu Variables
 
Code:
new callfunc1 register_menucmd(register_menuid("ExpMenu:"),1023,"ExpMenu1Function") callfunc1 = get_func_id("ExpMenu1") //Yes, the stuff above is in the public plugin_init()... public ExpMenu1(Mage,SelectedPlayers,PlayerSelecter,ExpGod) {  new exp[32], exp1[32], exp2[32], exp3[32]  get_euser_exp(mage,exp,31)  get_euser_exp(SelectedPlayers,exp1,31)  get_euser_exp(PlayerSelecter,exp2,31)  get_euser_exp(ExpGod,exp3,31)  client_print(menuuser,print_center,"%s|%s|%s|%s|",exp,exp1,exp2,exp3)  new menuBodyp[512]  new len = format(menuBodyp,511,"ExpMenu:^n^nMenu Info^n",name,name1)  len += format(menuBodyp[len],511-len,"1. More Info^n2. Exp God Info^n^n0. Exit")  show_menu(PlayerSelecter,((1<<0)|(1<<1)|(1<<9)),menuBodyp)  return PLUGIN_HANDLED } public ExpMenu1Function(id,key) {  callfunc_begin_i(callfunc1)  callfunc_push_int(Mage,SelectedPlayers,PlayerSelecter,ExpGod)  callfunc_end()  switch(key)  {   case 0:   {    ExpMenu1MoreInfo(Mage,SelectedPlayers,PlayerSelecter,ExpGod)   }   case 1:   {    ExpMenu1ExpGod(Mage,SelectedPlayers,PlayerSelecter,ExpGod)   }   case 9:   {    return PLUGIN_HANDLED   }  }  return PLUGIN_HANDLED }

I tryed this too ...

But it says

unknown command Mage
unknown command SelectedPlayers
unknown command PlayerSelecter
unknown command ExpGod

Can someone please help me with this?

JCobra 02-02-2007 18:32

Re: Saving Menu Variables
 
Quote:

Originally Posted by Karma
Hawk552: Flaming n00bs for no reason...

Thanks for pretending to be Hawk, but he doesn't have negative karma. Your spoof failed. And you should be banned for not only giving +Karma to Valdomine or whatever, be you should be shot in the head for calling him a pimp after he said Suzuka was dead.
See post here
OmgHi's Reply


All times are GMT -4. The time now is 00:35.

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