Raised This Month: $ Target: $400
 0% 

[Menu] Why when I'm pressing 1 plugin gets 0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
orglee
Member
Join Date: Dec 2005
Old 12-03-2007 , 16:31   [Menu] Why when I'm pressing 1 plugin gets 0
Reply With Quote #1

Hello.
Why when I'm pressing 1 while being in the rifle menu plugin gets 0
and 0 is 9 for him. Is this the way it should be or I screwed something up ?
- Im checking key value with this:
Code:
client_print(id, print_chat, "Key = %d, Player = %d", key, id)
My code:
Code:
new menu_rifle_keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0 new g_rifle_names[14][] = {     "Clarion", "M4A1",     "Bullpup", "Galil",     "AK47", "Krieg",     "Scout", "AWP",     "Ingram", "Schmidt",     "UMP", "P90",     "MP5", "M249"} new g_rifle_ids[14][] = {     "weapon_famas", "weapon_m4a1",     "weapon_aug", "weapon_galil",     "weapon_ak47", "weapon_sg552",     "weapon_scout", "weapon_awp",     "weapon_mac10", "weapon_tmp",     "weapon_ump45", "weapon_p90",     "weapon_mp5navy", "weapon_m249"} public menuRifleHandler(id, key) {   client_print(id, print_chat, "Key = %d, Player = %d", key, id)     new current_page = riflePageGet(id)   // Next page   if(key == 9)   {     if(current_page < 2)     {       riflePageSet(id, current_page + 1)     }   }   // Back   else if(key == 0)   {     if(current_page > 1)     {       riflePageSet(id, current_page - 1)     }   }   menuRifle(id) } public menuRifle(id) {   new menutext[192]     new current_page = riflePageGet(id)   if(current_page == 1)   {     format(menutext, 191, "\^n\r1. \w%s^n\r2. \w%s^n\r3. \w%s^n\r4. \w%s^n\r5. \w%s^n\r6. \w%s^n\r7. \w%s^n\r9. \wNext",         g_rifle_names[0],         g_rifle_names[1],         g_rifle_names[2],         g_rifle_names[3],         g_rifle_names[4],         g_rifle_names[5],         g_rifle_names[6])   } else {     format(menutext, 191, "\r1. \w%s^n\r2. \w%s^n\r3. \w%s^n\r4. \w%s^n\r5. \w%s^n\r6. \w%s^n\r7. \w%s^n\r0. \wPrevious",         g_rifle_names[7],         g_rifle_names[8],         g_rifle_names[9],         g_rifle_names[10],         g_rifle_names[11],         g_rifle_names[12],         g_rifle_names[13])   }   show_menu(id, menu_rifle_keys, menutext, -1, "Rifle_Menu") }

Last edited by orglee; 12-03-2007 at 16:35.
orglee is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-03-2007 , 17:14   Re: [Menu] Why when I'm pressing 1 plugin gets 0
Reply With Quote #2

That's it: 0=slot1, 8 = slot9, 9 = slot10
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
orglee
Member
Join Date: Dec 2005
Old 12-03-2007 , 17:30   Re: [Menu] Why when I'm pressing 1 plugin gets 0
Reply With Quote #3

] bind 9
"9" = "slot9"
] bind 0
"0" = "slot10"
] bind 1
"1" = "slot1"
In other menu I have the same weird thing

Last edited by orglee; 12-03-2007 at 17:33.
orglee is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-03-2007 , 17:50   Re: [Menu] Why when I'm pressing 1 plugin gets 0
Reply With Quote #4

You don't get it.
In you function menuRifleHandler, key 0 is slot1, etc.., you just have to deal with it.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 12-03-2007 , 17:51   Re: [Menu] Why when I'm pressing 1 plugin gets 0
Reply With Quote #5

Quote:
Originally Posted by connorr View Post
You don't get it.
In you function menuRifleHandler, key 0 is slot1, etc..
@orglee, connorr is pointing out that the keys are 1 off from the slot, much like array[0] is the first element, and array[1] refers to the second.
__________________
M249-M4A1 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 11:12.


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