AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu_additem with %s | %i | %d (https://forums.alliedmods.net/showthread.php?t=126605)

reinert 05-11-2010 13:51

menu_additem with %s | %i | %d
 
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 ?

hleV 05-11-2010 14:07

Re: menu_additem with %s | %i | %d
 
PHP Code:

new Buffer[64];
formatex(Buffer63"Ban %s"tempid);
 
menu_additem(menuBuffer"1"); 


reinert 05-11-2010 14:09

Re: menu_additem with %s | %i | %d
 
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.

Emp` 05-11-2010 15:05

Re: menu_additem with %s | %i | %d
 
https://forums.alliedmods.net/showth...46364#EndNotes

Quote:

Originally Posted by Emp` (Post 394840)
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);


reinert 05-11-2010 15:23

Re: menu_additem with %s | %i | %d
 
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. ...?

wrecked_ 05-11-2010 15:27

Re: menu_additem with %s | %i | %d
 
Code:
new name[32] get_user_name( id, name, 31 ) new menu = menu_create( name, "PointMenuHandler" )

reinert 05-11-2010 15:30

Re: menu_additem with %s | %i | %d
 
Thanks it works (y).

Now how could I remove numbers before text ? :]

wrecked_ 05-11-2010 15:33

Re: menu_additem with %s | %i | %d
 
I'm pretty sure you can't remove numbers with the new menu system. You can change the color that they appear as, though.

reinert 05-11-2010 15:41

Re: menu_additem with %s | %i | %d
 
ok, so old menu style is ? :

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

??

wrecked_ 05-11-2010 15:48

Re: menu_additem with %s | %i | %d
 
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.


All times are GMT -4. The time now is 03:32.

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