Raised This Month: $51 Target: $400
 12% 

Whats wrong with menu creation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mogel
Senior Member
Join Date: Jan 2007
Old 02-26-2009 , 02:35   Whats wrong with menu creation
Reply With Quote #1

Hi,

following code

Code:
public TeamSelect2(player) {
    
    new menu[1000]
    new line[100]
    new class[PLAYERCLASS]
    new keys
    
    client_cmd(player, "play sound/predatormod/menuloop.wav")
    
    // Anzahl aller Spieler zählen und entsprechend verhindern
    new players[32], count
    get_players(players, count, "h")
    for(new i = 0; i < count; i++) class[PLAYERCLASS:newclass[players[i]]]++;
    
    // die Headline einfügen
    //get_pcvar_string(pcv_headline, line, 99)
    format(menu, 999, "Predator-Mod (Version %s)^n%s", VERSION, line)
    
    
    format(menu, 999, "%s^n^n^n\rchoose your class\w^n", menu)
    
    AddMenuPoint(menu, 999, 1, "scout", class[PC_AUFKLAERUNG], get_pcvar_num(pcv_max_scout), keys, MENU_KEY_1, " - \ycan see the predator on his radar")
    AddMenuPoint(menu, 999, 2, "dogfight", class[PC_NAHKAMPF], get_pcvar_num(pcv_max_dogfight), keys, MENU_KEY_2, " - \yhas a flash")
    AddMenuPoint(menu, 999, 3, "infantry", class[PC_INFANTERIE], get_pcvar_num(pcv_max_infantry), keys, MENU_KEY_3, " - \yuse a parachute")
    AddMenuPoint(menu, 999, 4, "sniper", class[PC_SNIPER], get_pcvar_num(pcv_max_sniper), keys, MENU_KEY_4, " - \yless visible")
    AddMenuPoint(menu, 999, 5, "rear cover", class[PC_RUECKENDECKUNG], get_pcvar_num(pcv_max_rearcover), keys, MENU_KEY_5, " - \yhas a smoke")
    
    // Leerzeile
    format(menu, 999, "%s^n^n", menu)
    
    // Admins das Spect-Menü ermöglichen
    if (get_user_flags(player) & ADMIN_BAN) AddMenuPoint(menu, 999, 7, "spectator", 0, 0, keys, MENU_KEY_7, "")
    
    // Leerzeile
    format(menu, 999, "%s^n^n", menu)
    
    // und immer beenden
    AddMenuPoint(menu, 999, 0, "exit", 0, 0, keys, MENU_KEY_0, "")
    
    show_menu(player, keys, menu, -1, "TeamMenu")
    
    return PLUGIN_HANDLED
}
public AddMenuPoint(menu[], length, point, text[], count, max, &keys, key, info[]) {
    if (!max)
    {
        format(menu, length, "%s^n%i - %s%s", menu, point, text, info)
    } else
    {
        format(menu, length, "%s^n%c%i - %s (%i/%i)\w%s", menu, (count < max ? "\w" : "\d"), point, text, count, max, info)
    }
    if ((count < max) || !max) keys |= key
}
generates this bad menu



changes in Amxx since 1.7 ?

hand, mogel

PS: i'm using Notepad++ (ANSI/Utf-8/etc.) and Webcompiler
__________________
mogel is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-26-2009 , 02:40   Re: Whats wrong with menu creation
Reply With Quote #2

I use Notepad++ too! I love it with my syntax highlighting. Also, you should use ANSI when programming these. I get failed compiles with UTF-8.
__________________
fysiks is offline
mogel
Senior Member
Join Date: Jan 2007
Old 02-26-2009 , 03:09   Re: Whats wrong with menu creation
Reply With Quote #3

first i used ANSI ... then i try the same with UTF-8 ... same probleme
__________________
mogel is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-26-2009 , 03:10   Re: Whats wrong with menu creation
Reply With Quote #4

use new-style menus
__________________
xPaw is offline
mogel
Senior Member
Join Date: Jan 2007
Old 02-26-2009 , 04:23   Re: Whats wrong with menu creation
Reply With Quote #5

new-style menu
__________________
mogel is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-26-2009 , 04:35   Re: Whats wrong with menu creation
Reply With Quote #6

http://forums.alliedmods.net/showthread.php?t=46364 ...
__________________
xPaw is offline
mogel
Senior Member
Join Date: Jan 2007
Old 02-26-2009 , 05:10   Re: Whats wrong with menu creation
Reply With Quote #7

ah - ok ... copy&paste the code to the mod ... it looks better - but not corrent ... i try it an other time
__________________
mogel is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2009 , 06:38   Re: Whats wrong with menu creation
Reply With Quote #8

mogel ; old-menu works perfectly fine and using new-menu is not necessary. I don't understand why some users give you as suggestions to use new-menu. Not the time to look at your code, but it's built strangely ; maybe should you redo your code with some testing.
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-26-2009 , 06:50   Re: Whats wrong with menu creation
Reply With Quote #9

May be it's because the string is formatted numerous times in a row, try to use add or formatex(menu[n],.. or something equivalent.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
mogel
Senior Member
Join Date: Jan 2007
Old 02-26-2009 , 09:11   Re: Whats wrong with menu creation
Reply With Quote #10

Moin,

Quote:
Originally Posted by arkshine View Post
old-menu works perfectly fine
ahhh - nice to hear ... but now i found the problem webcompiler

e.g., this code
Code:
format(menu, 999, "%s^n^n^n\rchoose your class\w^n", menu)
have to replace with

Code:
format(menu, 999, "%s^n^n^n\\\rchoose your class\\\w^n", menu)
__________________
mogel 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 09:38.


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