Raised This Month: $ Target: $400
 0% 

menu_additem with %s | %i | %d


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 05-11-2010 , 13:51   menu_additem with %s | %i | %d
Reply With Quote #1

Hey, how can I make menu item with one of this: %s %i %d like:

PHP Code:
menu_additem(menu"Ban %s""1"tempid
But this code is incorrect, what would be correct one ?
reinert is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-11-2010 , 14:07   Re: menu_additem with %s | %i | %d
Reply With Quote #2

PHP Code:
new Buffer[64];
formatex(Buffer63"Ban %s"tempid);
 
menu_additem(menuBuffer"1"); 
__________________
hleV is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 05-11-2010 , 14:09   Re: menu_additem with %s | %i | %d
Reply With Quote #3

Thanks, hope it works.

EDIT : BTW What is the code for colored text in menu ?

\w - white
\y - yellow
\r - red ?

i think they are not working for me, cuz my server crashed before i removed all my color codes from menu, now it works perfectly.

Last edited by reinert; 05-11-2010 at 14:23.
reinert is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-11-2010 , 15:05   Re: menu_additem with %s | %i | %d
Reply With Quote #4

https://forums.alliedmods.net/showth...46364#EndNotes

Quote:
Originally Posted by Emp` View Post
End Notes: [top]
  • Most of the menu_* natives will throw errors if they are passed an invalid menu. A menu is invalid if it is -1.
  • You can expand on these in many ways, like only have one menu_handler to handle more than 1 menu
  • If you are using a constant menu (doesn't change at all) you do not need to create and destroy it each time. It is better to save it as a global.
  • These examples are not completely optimized, but they are for beginners and so they are simplified.
  • List of Colors for menus: (there are no other colors available)
    • White - \w
    • Yellow - \y
    • Red - \r
    • Grey/Disabled - \d
  • To align text to the right - \R
  • A menu will not show if it does not have any items.
  • To hide a menu (new or old style) one can do:
    Code:
    show_menu(id, 0, "^n", 1);
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
reinert
Veteran Member
Join Date: Feb 2007
Old 05-11-2010 , 15:23   Re: menu_additem with %s | %i | %d
Reply With Quote #5

thanks fixed. problems solved, can lock thread or answer me one more question:

how can I get player name to my menu ?

PHP Code:
        new name[64]
        new 
vardas get_user_name(idname64)
        
formatex(name63"%s",vardas)

        new 
menu menu_create(name"PointMenuHandler"
RESULT:

- Nothing, and how can I delete "0. Exit" option from my menu and numbers before text in menu. like: 1. \ 2. \ 3. ...?
reinert is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-11-2010 , 15:27   Re: menu_additem with %s | %i | %d
Reply With Quote #6

Code:
new name[32] get_user_name( id, name, 31 ) new menu = menu_create( name, "PointMenuHandler" )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 05-11-2010 , 15:30   Re: menu_additem with %s | %i | %d
Reply With Quote #7

Thanks it works (y).

Now how could I remove numbers before text ? :]
reinert is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-11-2010 , 15:33   Re: menu_additem with %s | %i | %d
Reply With Quote #8

I'm pretty sure you can't remove numbers with the new menu system. You can change the color that they appear as, though.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 05-11-2010 , 15:41   Re: menu_additem with %s | %i | %d
Reply With Quote #9

ok, so old menu style is ? :

add(title, 32, "%s^n^n", name)
add(line1, 32, "Hey dudoo, i like your boobs^n")

??
reinert is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-11-2010 , 15:48   Re: menu_additem with %s | %i | %d
Reply With Quote #10

There's a small tutorial (not very helpful, but a demo) in the Snips / Tuts section and there's multiple plugins that use the old menu system on the forums. Look at those.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ 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 03:32.


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