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

I do not understand much of the code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zoolk
New Member
Join Date: Jul 2013
Old 05-25-2015 , 13:53   I do not understand much of the code
Reply With Quote #1

hello, what I would like for this works, what does?

VGUI Menu
PHP Code:
new const g_hook_args[][] = { "#Team_Select""#Team_Select_Spect""#IG_Team_Select""#IG_Team_Select_Spect" }

public 
message_showmenu(msg_idmsg_destmsg_entity)
{
    new 
message[32]
    
get_msg_arg_string(4messagecharsmax(message)) // I do not understand
    
    
for(new isizeof g_hook_argsi++)
    {
        if(
equal(messageg_hook_args[i])) // I do not understand
        
{
            if(!
get_bit(msg_entitygb_logedin))
                
show_menu_account(msg_entity)
            
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

Show Menu
PHP Code:
public message_vguimenu(msg_idmsg_destmsg_entity)
{
    new 
menuid get_msg_arg_int(1// I do not understand
    
    
if(menuid == || menuid == 3// I do not understand :c
    
{
        if(!
get_bit(msg_entitygb_logedin))
            
show_menu_account(msg_entity)
        
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;

Someone could explain what makes these lines do not understand and they are? Thanks
zoolk is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 05-25-2015 , 19:25   Re: I do not understand much of the code
Reply With Quote #2

First of all you should learn about messages code using. According to Half-Life 1 Game Events - AlliedModders Wiki:
Code:
ShowMenu

This message displays a "menu" to a player (text on the left side of the screen). It acts like AMXX's show_menu (in fact, this is how AMXX shows a menu).
Note: Multipart should be 1 if your menu takes up multiple messages (i.e.: string is too big to fit into one). On the final message, Multipart should be 0.

Structure:
short  KeysBitSum
char  Time
byte  Multipart
string  Text
Code:
VGUIMenu

This message displays a predefined VGUI menu.

Structure:
byte  MenuID
short  KeysBitSum
char  Time?
byte  Multipart?
string  Name?
PHP Code:
get_msg_arg_string(4messagecharsmax(message)) // I do not understand 
Get 4th message argument, it is 'Text'.

PHP Code:
if(equal(messageg_hook_args[i])) // I do not understand 
Then check it against defined set of aliases ("#Team_Select", "#Team_Select_Spect", "#IG_Team_Select" or "#IG_Team_Select_Spect"; see 'titles.txt' in mod directory, hash sign is mandatory symbol to indicate an alias). The purpose is to determine whether it is one of 'Team Selection' menus.


VGUI menu message has other structure and so the code for determination is other one but for the same purpose.

PHP Code:
new menuid get_msg_arg_int(1// I do not understand 
Get 1st message argument, it is 'MenuID'.

PHP Code:
if(menuid == || menuid == 3// I do not understand :c 
Now we check against well-known menu ids whether it is Menu_ChooseTeam or Menu_IGChooseTeam. You could see all of them here.
__________________

Last edited by isotonic; 05-25-2015 at 19:30.
isotonic is offline
zoolk
New Member
Join Date: Jul 2013
Old 05-26-2015 , 11:41   Re: I do not understand much of the code
Reply With Quote #3

thank you very much, and what I have understood
zoolk 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 17:50.


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