Raised This Month: $ Target: $400
 0% 

Making Menus


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cronck
Member
Join Date: Apr 2005
Old 04-21-2005 , 13:01   Making Menus
Reply With Quote #1

Im not very good at making menus, as the only way i've made them is by copy/pasting existing code.

Now i want to make a menu with 4 options.

1. Fun
2. Heal
3. Slap

0. Cancel

But the way i want this menu to be different is by making it to show like this:

1. Fun [ON]
2. Heal
3. Slap

0. Cancel

Can anyone help me with this? ON/OFF Should be yellew colored.
Cronck is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-21-2005 , 13:16  
Reply With Quote #2

lol, well if you read my post you'd know I don't know how to make a working menu... but just changing the menu text is really easy. If you posted your code I could have given you a better example, but i'll use my code:

new Menu[1024] //declares the variable for the menu text

now.. here's what you want in your procedure that shows the menu.. for example:
Code:
register_clcmd("AllianceMenu", "ShowAllianceMenu") //calls the menu when AllianceMenu is typed in console

so in this procedure you would have this:

Code:
AllianceMenu(id) {      format(Menu, 1023, "My Menu:^n^n1. Fun %s^n2. Heal^n3. Slap^n^n0. Cancel", FunOn)     show_menu(id, MKeys3, Menu) }

Note you must have FunOn declared as a string variable. (new FunOn[5] In your code, when fun is turned on you want to do this

format(FunOn, 4, "[ON]") //sets FunOn to the string "[ON]"

When you turn fun off in your code you want to do this:

format(FunOn, 5, "[OFF]") //sets FunOn to the string "[OFF]"

That's pretty much it.
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
Cronck
Member
Join Date: Apr 2005
Old 04-21-2005 , 16:24  
Reply With Quote #3

I cant get it to work...
Cronck is offline
Cronck
Member
Join Date: Apr 2005
Old 04-21-2005 , 16:40  
Reply With Quote #4

Here's all my code:
Code:
#include <amxmodx> #include <fun> #include <cstrike> new PLUGIN[]="Test Script" new AUTHOR[]="Cronck" new VERSION[]="1.00" new iSilentPlayer[32][2] new iPlayerDamage[32] new MKeys9 = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9) public plugin_init() {      register_plugin(PLUGIN, VERSION, AUTHOR)            // Commands      register_concmd("heal", "HealPlayer", 0, "admin_hello")      register_concmd("wcteleport","MovePlayer",0,"Teleport")      register_concmd("silent","SilentPlayer",0,"Silent Run")      register_concmd("money","MoneyPlayer",0,"Give Money")      register_clcmd("say testmenu", "ShowTestMenu")      register_clcmd("testmenu", "ShowTestMenu") } public HealPlayer(id) {      client_print(0, print_chat,"someone was healed!")        set_user_health(id, 225) } public MovePlayer(id) {     new origin[3]     get_user_origin(id,origin,3)  // Gets the current location the player is at     origin[2] = origin[2] + 35     set_user_origin(id,origin)   // Moves the player to the location stored in origin } public SilentPlayer(id) {     if (iSilentPlayer[id][1] == 1 ) {         set_user_footsteps(id, 0)         iSilentPlayer[id][1] = 0     }     else if (iSilentPlayer[id][1] == 0 ) {         iSilentPlayer[id][1] = 1         set_user_footsteps(id, 1)     } } public MoneyPlayer(id) {     cs_set_user_money(id, 16000, 1) } public ShowTestMenu(id) {     format(MyTestMenu, 1023, "Settings:^n^n1. Heal Yourself^n2. Silent Run/Walk^n3.Get Money^n4. Teleport to mouse point^n^n0. Cancel")     show_menu(id, MKeys9, MyTestMenu) }     public PerformTestMenu(id, key) {    if (key == 1)     {          HealPlayer(id)     } else if (key == 2) {         SilentPlayer(id)        } else if (key == 3) {         MoneyPlayer(id)     } else if (key == 4) {         MovePlayer(id)     } }
Cronck is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-21-2005 , 21:22  
Reply With Quote #5

ok man, so i just got my menu working, so now i can help you lol. (and by the way i'm a user now and not a nub )

you are missing the line to register your menu (add it in plugin_init):

Code:
register_menucmd(register_menuid("Settings:"), 1023, "PerformTestMenu")


so what this does is it registers a menu with the first line of "Settings:" with a string length (for the whole menu) of 1023 characters (you can probably shorten this cuz ur menu isn't that long, but it doesn't really matter) that will can the procedure PerformTestMenu when something is chosen.

Besides that, I think it should work. Give that a try. Here is what you need to do to get the [OFF] [ON] thing... i'll do it for running.

Code:
public ShowTestMenu(id) {     //create a boolean var for [on] [off] (note: this would be unnecessary if i knew how to compare a string)     new Running = 0 //assumes no as default     //create a new var for [ON] [OFF]     new strRunning[6]         if(Running)         format(strRunning, 5, "[ON]")     else         format(strRunning, 5, "[OFF]")     format(MyTestMenu, 1023, "Settings:^n^n1. Heal Yourself^n2. Silent Run %s^n3.Get Money^n4. Teleport to mouse point^n^n0. Cancel", strRunning)     show_menu(id, MKeys9, MyTestMenu) }

and if I were you i'd change MKeys9 to MKeys10 because you have ten menukeys.. from 0 to 9
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
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 09:50.


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