Raised This Month: $ Target: $400
 0% 

Harbu/Menu Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
geertjan88
Member
Join Date: May 2006
Old 12-02-2006 , 04:17   Harbu/Menu Help
Reply With Quote #1

In harbu there is an menu called atm_menu.
Code:
///////////////////////////////
//
// ATM CODE
//
///////////////////////////////



// ATM Menu 1. Deposit, 2. Withdraw
public actionMenuatm(id,key)
{
 switch(key){
 case 0:{
 showMenudep(id)
 }
 case 1:{
 showMenuwit(id)
 }
 }

 return PLUGIN_HANDLED
}

public Menu_Atm(id)
{
   if(get_item_amount(id,get_cvar_num("rp_itemid_atmcard"),"money") == 0)
   {
      client_print(id,print_chat,"[Bank] You need an ATM Card to use this^n")
      return PLUGIN_HANDLED
   }
   if(cuffed[id] == 1)
   {
      client_print(id,print_chat,"[Bank] Can't deposit or withdraw money when cuffed^n")
      return PLUGIN_HANDLED
   }
   new menuBodyp[512]
   new len = format(menuBodyp,511,"ATM Menu^n^n")
   len += format(menuBodyp[len],511-len,"1. Deposit^n2. Withdraw^n^n0. Exit")
   show_menu(id,((1<<0)|(1<<1)|(1<<9)),menuBodyp)
   return PLUGIN_HANDLED
}
Now this is probably a really stupid question, but well also donkey's can learn things. When you use an atm it shows up Menu_atm wich is shown above. But how does amx knows when you press 1 or 2 it should excecute what is written in ActionMenuAtm how are those two things connected i mean how do you connect them. I tried to search all over the code but i can't find the piece of code where it is coded that when someone presses a key in menu_atm that after that it should excecute the action in actionMenuatm.
__________________
if i help? +karma!
geertjan88 is offline
geertjan88
Member
Join Date: May 2006
Old 12-02-2006 , 06:42   Re: Harbu/Menu Help
Reply With Quote #2

never mind i already found out it is in this little sentence:
Code:
new len = format(menuBodyp,511,"Phone Menu^n^n")
Please lock this
__________________
if i help? +karma!
geertjan88 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 12-02-2006 , 17:10   Re: Harbu/Menu Help
Reply With Quote #3

Not quite...

Code:
show_menu(id,((1<<0)|(1<<1)|(1<<9)),menuBodyp)

show_menu

The (1<<0) means, in lay-man's terms, to check when the 1 key is pressed, which corresponds with the first, #0, option in the menu.
The key 2 corresponds with the second, #1, option in the menu.
The key 0 corresponds with the ninth, #9, option in the menu.

Option 1 = 0
Option 2 = 1
Option 3 = 2
etc...

In your above post, you did not include the function that reads what key was pressed.

Last edited by stupok; 12-02-2006 at 17:15.
stupok is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 12-03-2006 , 19:16   Re: Harbu/Menu Help
Reply With Quote #4

Quote:
Originally Posted by geertjan88 View Post
never mind i already found out it is in this little sentence:
Code:
new len = format(menuBodyp,511,"Phone Menu^n^n")
Please lock this
Yeah the fact that the line you showed refers to a phone menu should have given it away
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
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 06:48.


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