Raised This Month: $ Target: $400
 0% 

menu title


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TrueType
Junior Member
Join Date: May 2008
Location: sweden
Old 01-29-2009 , 10:10   menu title
Reply With Quote #1

Hallo,
I have looked and looked but i couldnt find it anywhere.
So i wonder how to set a title to this vote.

Code:
public ChangeClass(id) {
    new menu = menu_create("Class Menu" , "Class_Handle");
    menu_additem(menu ,"Emil", "1" , 0);
    menu_additem(menu ,"Aron", "2" , 0);
    menu_additem(menu ,"Jacob", "3" , 0);
    menu_additem(menu ,"Marcus", "4" , 0);
    menu_additem(menu ,"Amadeus", "5" , 0);

    menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
    menu_display(id , menu , 0);

    return PLUGIN_CONTINUE;
}
I have tried with this from the Allied Modders wiki...

Code:
public ChangeClass(id) {
    new menu = menu_create("Class Menu" , "Class_Handle");
    SetMenuTitle(menu, "Valj din kompis.")
    menu_additem(menu ,"Emil", "1" , 0);
    menu_additem(menu ,"Aron", "2" , 0);
    menu_additem(menu ,"Jacob", "3" , 0);
    menu_additem(menu ,"Marcus", "4" , 0);
    menu_additem(menu ,"Amadeus", "5" , 0);

    menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
    menu_display(id , menu , 0);

    return PLUGIN_CONTINUE;
}
The whole code is this.

Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define MAXCLASSES 6
#define PREFIX "Kompis Mod"

new const CLASSES[MAXCLASSES][] = {
    "En dum blondin (inget)",
    "Emil",
    "Aron",
    "Jacob",
    "Marcus",
    "Amadeus"
};

new const LEVELS[6] = {
    100, 
    200, 
    400, 
    800,
    1600,
    3200
};

new PlayerXP[33], PlayerLevel[33], PlayerClass[33];
new gCvar_Kill, gCvar_Knife, gCvar_HS, gCvar_Enable, g_Vault;

public plugin_init() {
    register_plugin("Kompis Mod", "1.0", "TrueType");

    register_event("DeathMsg", "eDeath", "a");

    gCvar_Enable    = register_cvar("xp_save", "1");
    gCvar_Kill    = register_cvar("xp_per_kill", "20");
    gCvar_HS    = register_cvar("xp_hs_bonus", "20");
    gCvar_Knife    = register_cvar("xp_Knife_bonus", "20");
    g_Vault        = nvault_open("kompismod");
    
    register_concmd("amx_take_exp", "cmd_take_exp", ADMIN_KICK, "<target> <amount>"); 
    register_concmd("amx_give_exp", "cmd_give_exp", ADMIN_KICK, "<target> <amount>");
    
    register_clcmd("say /kompis",    "ChangeClass");
    register_clcmd("say_team /kompis", "ChangeClass");
    register_clcmd("say /iq",    "ShowHud");
    register_clcmd("say_team /iq",    "ShowHud");
}

public eDeath() {
    new attacker = read_data( 1 );
    new headshot = read_data( 3 );
    new clip, ammo, weapon = get_user_weapon(attacker, clip, ammo);

    PlayerXP[attacker] += get_pcvar_num(gCvar_Kill);

    if(headshot)
        PlayerXP[attacker] += get_pcvar_num(gCvar_HS);

    if(weapon == CSW_KNIFE)
        PlayerXP[attacker] += get_pcvar_num(gCvar_Knife);

    while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
        client_print(attacker, print_chat, "[%s] Grattis! Du ar nu i level %i %s! Och du har fatt mer IQ!", PREFIX, PlayerLevel[attacker], CLASSES[PlayerClass[attacker]]);
        PlayerLevel[attacker] += 1;
    }

    ShowHud(attacker);
    SaveData(attacker);
}

public ShowHud(id) {
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0);
    show_hudmessage(id, "Level: %i^nIQ: %i^nKompis: %s", PlayerLevel[id], PlayerXP[id], CLASSES[PlayerClass[id]]);
}

public ChangeClass(id) {
    new menu = menu_create("Class Menu" , "Class_Handle");
    SetMenuTitle(menu, "Valj din kompis.")
    menu_additem(menu ,"Emil", "1" , 0);
    menu_additem(menu ,"Aron", "2" , 0);
    menu_additem(menu ,"Jacob", "3" , 0);
    menu_additem(menu ,"Marcus", "4" , 0);
    menu_additem(menu ,"Amadeus", "5" , 0);

    menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
    menu_display(id , menu , 0);

    return PLUGIN_CONTINUE;
}

public Class_Handle(id , menu , item)  {
    if(item == MENU_EXIT) 
        menu_destroy(menu);

    new szCommand[6] , szName[64];
    new access , callback;

    menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback);

    new i = str_to_num(szCommand);
    if(PlayerClass[id] != i) {
        PlayerClass[id] = i;
        client_print(id,print_chat,"[%s] Du är nu %s", PREFIX, CLASSES[i]);
    } else
        client_print(id,print_chat,"[%s] Du är redan %s", PREFIX, CLASSES[i]);

    menu_destroy(menu);
    return PLUGIN_CONTINUE;
}

public client_connect(id)
    if(get_pcvar_num(gCvar_Enable) == 1)
        LoadData(id);

public client_disconnect(id) {
    if(get_pcvar_num(gCvar_Enable) == 1)
        SaveData(id);

    PlayerXP[id]    = 0;
    PlayerLevel[id]    = 0;
    PlayerClass[id]    = 0;
}

public SaveData(id) {
    new AuthID[35];
    get_user_authid(id, AuthID, 34);
    
    new vaultkey[64], vaultdata[256];
    format(vaultkey, 63, "%s-Mod", AuthID);
    format(vaultdata, 255, "%i#%i#", PlayerXP[id], PlayerLevel[id]);
    nvault_set(g_Vault, vaultkey, vaultdata);
    return PLUGIN_CONTINUE;
}

public LoadData(id) {
    new AuthID[35];
    get_user_authid(id,AuthID,34);
    
    new vaultkey[64], vaultdata[256];
    format(vaultkey, 63, "%s-Mod", AuthID);
    format(vaultdata, 255, "%i#%i#", PlayerXP[id], PlayerLevel[id]);
    nvault_get(g_Vault, vaultkey, vaultdata,255);

    replace_all(vaultdata, 255, "#", " ");

    new playerxp[32], playerlevel[32];

    parse(vaultdata, playerxp, 31, playerlevel, 31);

    PlayerXP[id] = str_to_num(playerxp);
    PlayerLevel[id] = str_to_num(playerlevel);

    return PLUGIN_CONTINUE;
}

// Give/Take XP addaon by [X]-RayCat
public cmd_give_exp( id, level,cid ) {
    if( ! cmd_access ( id, level, cid, 3 ) )
        return PLUGIN_HANDLED;

    new target[32], amount[21], reason[21];

    read_argv( 1, target, 31 );
    read_argv(2, amount, 20 );
    read_argv( 3, reason, 20 );

    new player = cmd_target( id, target, 8 );

    if( ! player ) 
        return PLUGIN_HANDLED;

    new admin_name[32], player_name[32];
    get_user_name( id, admin_name, 31 );
    get_user_name( player, player_name, 31 );

    new expnum = str_to_num( amount );

    PlayerXP[player] += expnum;

    switch( get_cvar_num ( "amx_show_activity" ) ) {
        case 1: client_print( 0, print_chat, "ADMIN: gav %i IQ for %s.", expnum, player_name );
        case 2: client_print( 0, print_chat, "ADMIN %s: gav %i IQ for %s.", admin_name, expnum, player_name );
    }

    client_print( player, print_chat, "[%s] Du fick %i IQ. (Total: %d)", PREFIX, expnum, PlayerXP[player] );
    SaveData( id );

    return PLUGIN_CONTINUE;
}
 
public cmd_take_exp( id, level,cid ) {
    if( ! cmd_access ( id, level, cid, 3 ) )
       return PLUGIN_HANDLED;

    new target[32], amount[21], reason[21];

    read_argv( 1, target, 31 );
    read_argv( 2, amount, 20 );
    read_argv( 3, reason, 20 );

    new player = cmd_target( id, target, 8 );

    if( ! player ) 
       return PLUGIN_HANDLED;

    new admin_name[32], player_name[32];
    get_user_name( id, admin_name, 31 );
    get_user_name( player, player_name, 31 );

    new expnum = str_to_num( amount );

    PlayerXP[player] -= expnum;

    switch(get_cvar_num("amx_show_activity")){
        case 1: client_print( 0, print_chat, "ADMIN: tog %i IQ fran %s.", expnum, player_name );
        case 2: client_print( 0, print_chat, "ADMIN %s: tog %i IQ fran %s.", admin_name, expnum, player_name );
    }

    client_print( player, print_chat, "[%s] You lost %i points. (Total: %d)", PREFIX, expnum, PlayerXP[player] );
    SaveData( id );

    return PLUGIN_CONTINUE;
}
And when i compile it I'm getting this ERROR...

PHP Code:
/home/groups/amxmodx/tmp3/textpxbyzQ.sma(78) : error 017undefined symbol "SetMenuTitle" 
Just in case nobody wonder, "Valj din kompis." = "Choose your friend." in English.

I'm making a friend mod to me and my friends that we are going to play on a LAN!

Thanks for help, please.
TrueType is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-29-2009 , 10:17   Re: menu title
Reply With Quote #2

Moved to Scripting Help

Look in the newmenu.inc file. Try menu_setprop
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
TrueType
Junior Member
Join Date: May 2008
Location: sweden
Old 01-29-2009 , 10:24   Re: menu title
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
Moved to Scripting Help

Look in the newmenu.inc file. Try menu_setprop
Ok thanks, but it didnt work or had I just typed wrong?

Code:
menu_setprop(menu ,"Valj din kompis.")
Is that right? Because now i get this error.

PHP Code:
/home/groups/amxmodx/tmp3/texthQl9RM.sma(78) : error 035argument type mismatch (argument 2
TrueType is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-29-2009 , 10:29   Re: menu title
Reply With Quote #4

You need to look at the functions usage. I only gave you the function name and the include file it is in. You need to read up on the proper usage
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
SkiesOFF
Member
Join Date: Mar 2008
Old 01-29-2009 , 18:19   Re: menu title
Reply With Quote #5

what about that?
Code:
public ChangeClass(id) {
new menu = menu_create("Class Menu^n Valj din kompis^n" , "Class_Handle");
menu_additem(menu ,"Emil", "1" , 0);
menu_additem(menu ,"Aron", "2" , 0);
menu_additem(menu ,"Jacob", "3" , 0);
menu_additem(menu ,"Marcus", "4" , 0);
menu_additem(menu ,"Amadeus", "5" , 0);
 
menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
menu_display(id , menu , 0);
 
return PLUGIN_CONTINUE;
}

Last edited by SkiesOFF; 01-29-2009 at 18:22.
SkiesOFF is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 01-29-2009 , 19:16   Re: menu title
Reply With Quote #6

look here emp make a really nice tut about menus http://forums.alliedmods.net/showthr...highlight=menu

Btw that link is a search result ;)
__________________
Dr.G is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-29-2009 , 19:41   Re: menu title
Reply With Quote #7

Code:
menu_setprop(menu, MPROP_TITLE, "Valj din kompis.")
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`
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 01:42.


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