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

Why menu doesn't work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-16-2013 , 10:26   Why menu doesn't work?
Reply With Quote #1

meta_api:

PHP Code:
int MSGID_ShowMenu 0;

void MessageBegin(int msg_destint msg_type, const float *pOriginedict_t *ed)
{
    static 
bool LoadedMSGS false;

    if(!
LoadedMSGS)
    {
        
MSGID_ShowMenu GET_USER_MSG_ID(PLID"ShowMenu"NULL);

        
LoadedMSGS true;
    }

    
RETURN_META(MRES_IGNORED);
}

void ClientCommand(edict_t *pEntity)
{
    const 
char *szArg;

    
szArg CMD_ARGV(0);

    if (
FStrEq(szArg"jointeam") || FStrEq(szArg"chooseteam"))
    {
        
fw_JoinTeampEntity );
        
RETURN_META(MRES_SUPERCEDE);
    }
    
    
RETURN_META(MRES_IGNORED);

main_menu.cpp:
PHP Code:
#define KEY_1        (1<<0)

extern void fw_JoinTeamedict_t *pEntity );
extern int MSGID_ShowMenu;

void UTIL_ShowMenu(edict_tpEdictint slotsint timechar *menuint mlen);

void fw_JoinTeamedict_t *pPlayer )
{
    
int keys KEY_1;

    
char menu[512];    

    
int len  sprintf(menu"\\yMain Menu\n\n\
                 \\r1.\\w Menu"
);

    
UTIL_ShowMenupPlayerkeys, -1menulen);
}

void UTIL_ShowMenu(edict_tpEdictint slotsint timechar *menuint mlen)
{
    
char *menu;
    
char c 0;
    
int a;

    if (!
MSGID_ShowMenu)
        return;            
// some games don't support ShowMenu (Firearms)

    
while (*n)
    {
        
mlen;
        if (
175175;
        
mlen -= a;
        
= *(n+=a);
        *
0;
        
        
MESSAGE_BEGIN(MSG_ONEMSGID_ShowMenuNULLpEdict);
        
WRITE_SHORT(slots);
        
WRITE_CHAR(time);
        
WRITE_BYTE(TRUE FALSE);
        
WRITE_STRING(menu);
        
MESSAGE_END();
        *
c;
        
menu n;
    }

All functions are called,but menu,doesn't show.
__________________

Last edited by Bos93; 01-16-2013 at 13:29.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-16-2013 , 15:13   Re: Why menu doesn't work?
Reply With Quote #2

IIRC you might need two keys on the menu.
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`
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-16-2013 , 15:29   Re: Why menu doesn't work?
Reply With Quote #3

added all keys,but doesn't work..
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-16-2013 , 16:52   Re: Why menu doesn't work?
Reply With Quote #4

Menu is opened when I drop weapons О_О
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-16-2013 , 22:14   Re: Why menu doesn't work?
Reply With Quote #5

Why you get MSGID at MessageBegin?

It's better (for performance) to get it at server start, at first Spawn for example.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-16-2013 , 22:27   Re: Why menu doesn't work?
Reply With Quote #6

no..

PHP Code:
void UTIL_ShowMenu(edict_tpEdictint slotsint timechar *menuint mlen)
{
    
char *menu;
    
char c 0;
    
int a;

    if (!
GET_USER_MSG_ID(PLID"ShowMenu"NULL))
        return;            
// some games don't support ShowMenu (Firearms)

    
while (*n)
    {
        
mlen;
        if (
175175;
        
mlen -= a;
        
= *(n+=a);
        *
0;
        
        
MESSAGE_BEGIN(MSG_ONEGET_USER_MSG_ID(PLID"ShowMenu"NULL), NULLpEdict);
        
WRITE_SHORT(slots);
        
WRITE_CHAR(time);
        
WRITE_BYTE(TRUE FALSE);
        
WRITE_STRING(menu);
        
MESSAGE_END();
        *
c;
        
menu n;
    }

doesn't work,but

Quote:
Menu is opened when I drop weapons О_О
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-17-2013 , 00:57   Re: Why menu doesn't work?
Reply With Quote #7

LOL
GET_USER_MSG_ID(PLID, "ShowMenu", NULL);
-->
REG_USER_MSG( "ShowMenu", -1 );

solved
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
fl0werD
Senior Member
Join Date: May 2011
Old 01-17-2013 , 12:35   Re: Why menu doesn't work?
Reply With Quote #8

PHP Code:
if (!GET_USER_MSG_ID(PLID"ShowMenu"NULL))
        return;            
// some games don't support ShowMenu (Firearms) 
Senselessly.
fl0werD is offline
Send a message via ICQ to fl0werD
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 16:58.


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