Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 46

Thread: name , client id in menu

  1. #11
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    Quote Originally Posted by Tally View Post
    You wont be able to show the result of a dvar if you use the action{} element in an itemDef{}. Also, you aren't defining the font and fontstyle and size. It wont show unless you do that.
    Code:
    		itemDef
    		{
    			name			rcon_button
    			type			ITEM_TYPE_BUTTON
    			dvar			"rcon_rsp_player0"
    			rect			0 0 SLOT_SIZE
    			origin			ORIGIN_SLOT
    			textstyle		OPTIONS_ITEM_TEXT_STYLE
    			textalign		OPTIONS_ITEM_ALIGN
    			textalignx		SLOT_ALIGNX
    			textaligny		SLOT_ALIGNY
    			textscale		SLOT_TXTSCALE
    			style			WINDOW_STYLE_FILLED
    			backcolor		OPTIONS_CONTROL_BACKCOLOR
    			forecolor		OPTIONS_CONTROL_FORECOLOR
    			visible			1
    			dvartest		"rcon_rsp_result"
    			showDvar		{ "1" }
    			action
    			{
    				play "mouse_click";
    				scriptMenuResponse "rcon_cmd_player0";
    			}
    			mouseEnter
    			{
    				play "mouse_over";
    			}
    		}
    Using a dvar as text, checking dvar to show at all, and with an action... shows perfectly fine.

  2. The Following User Says Thank You to PatmanSan For This Useful Post:

    kung foo man (2nd May 2013)

  3. #12
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    i did hours of testing and came up with some goodies to bring the max dynamic in cod2 .menu modding
    the following menu contains everything what is possible in cod2
    heres the result for those, who will understand and use it:

    Code:
    #define POS_TEXT_1 100 100
    #define DRAW_BUTTON_DVAR_TEXT( _id , _name , _dvar ) \
    	itemDef \
    	{ \
    		visible		1 \
    		rect			POS_ ## _id 80 80 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_CENTER \
    		origin			10 10 \
    		forecolor		GLOBAL_UNFOCUSED_COLOR \
    		type			ITEM_TYPE_BUTTON \
    		dvar			_dvar ## "_text" \
    		textscale		0.3 \
    		textstyle		ITEM_TEXTSTYLE_SHADOWEDMORE \
    		textalign		ITEM_ALIGN_CENTER \
    		textalignx		40 \
    		textaligny		45 \
    		dvartest		_dvar ## "_text" \
    		hideDvar \
    		{ \
    			""; \
    		} \
    		action \
    		{ \
    			play "mouse_click"; \
    			scriptMenuResponse "response_" ## _name; \
    		} \
    	} \
    
    ...
    ...
    ...
    
    	DRAW_BUTTON_DVAR_TEXT( TEXT_1 , "button_next" , "ui_next_" )
    you are allowed to use strings in a macro combined with the stringify operator (##)
    restrictions:
    -only 1 macro can be defined in another macro
    -dont use global defined vars in a macro combined with the stringify

  4. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (2nd May 2013)

  5. #13
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    I just rememberd, that we had this nice little collection: http://killtube.org/showthread.php?1...ghlight=define


    PHP Code:
            BUTTON(80 80"ui_weapon_0""weapon 0""ui_weapon_0_show""1")
            
    BUTTON(80 100"ui_weapon_1""weapon 1""ui_weapon_1_show""1")
            
    BUTTON(80 120"ui_weapon_2""weapon 2""ui_weapon_2_show""1")
            
    BUTTON(80 140"ui_weapon_3""weapon 3""ui_weapon_3_show""1"
    Would be perfect for 64+64 items. I didn't know about the Stringifiy-operator back then, but my old example can be shortened with that (the _show one).
    timescale 0.01

  6. #14
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by PatmanSan View Post
    Code:
    		itemDef
    		{
    			name			rcon_button
    			type			ITEM_TYPE_BUTTON
    			dvar			"rcon_rsp_player0"
    			rect			0 0 SLOT_SIZE
    			origin			ORIGIN_SLOT
    			textstyle		OPTIONS_ITEM_TEXT_STYLE
    			textalign		OPTIONS_ITEM_ALIGN
    			textalignx		SLOT_ALIGNX
    			textaligny		SLOT_ALIGNY
    			textscale		SLOT_TXTSCALE
    			style			WINDOW_STYLE_FILLED
    			backcolor		OPTIONS_CONTROL_BACKCOLOR
    			forecolor		OPTIONS_CONTROL_FORECOLOR
    			visible			1
    			dvartest		"rcon_rsp_result"
    			showDvar		{ "1" }
    			action
    			{
    				play "mouse_click";
    				scriptMenuResponse "rcon_cmd_player0";
    			}
    			mouseEnter
    			{
    				play "mouse_over";
    			}
    		}
    Using a dvar as text, checking dvar to show at all, and with an action... shows perfectly fine.
    How did u do this? Cos I can't use a dvar and action :/

  7. #15
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    Part of in-game RCON of the eXtreme+ mod (v2.8). Have a look at ui_mp\scriptmenus\rcon_playerctrl.menu

  8. The Following User Says Thank You to PatmanSan For This Useful Post:

    kung foo man (28th May 2013)

  9. #16
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    How did u do this? Cos I can't use a dvar and action :/
    There is essential code missing from that example. This is from the eXtreme+ mod in full:

    Code:
    		itemDef
    		{
    			name			rcon_button
    			type			ITEM_TYPE_MULTI
    			text			" "
    			dvar			"rcon_rsp_model"
    			dvarFloatList		{ "@RCON_PLAYERCTRL_ORIGINAL" 0 "@RCON_PLAYERCTRL_BARREL" 1 "@RCON_PLAYERCTRL_BATHTUB" 2 "@RCON_PLAYERCTRL_FUNMODE" 3
    												"@RCON_PLAYERCTRL_MATTRESS" 4 "@RCON_PLAYERCTRL_TOILET" 5 "@RCON_PLAYERCTRL_TOMBSTONE" 6 "@RCON_PLAYERCTRL_TREE" 7 }
    			rect			0 145 OPTION_SIZE
    			origin			ORIGIN_ITEM
    			textstyle		OPTIONS_ITEM_TEXT_STYLE
    			textalign		OPTIONS_ITEM_ALIGN
    			textalignx		OPTION_ALIGNX
    			textaligny		OPTIONS_ITEM_ALIGN_Y
    			textscale		OPTIONS_CONTROL_TXTSCALE
    			style			WINDOW_STYLE_FILLED
    			backcolor		OPTIONS_CONTROL_BACKCOLOR
    			forecolor		OPTIONS_CONTROL_FORECOLOR
    			visible			1
    			dvartest		"rcon_rsp_result"
    			showDvar		{ "1" }
    			action
    			{
    				play "mouse_click";
    				scriptMenuResponse "rcon_cmd_model";
    			}
    			mouseEnter
    			{
    				play "mouse_over";
    			}
    		}
    Note the dvarFloatList{} - this is what enables you to show the result of a dvartest: it has to have a string (although it doesn't have to be a localized string) + a response element to go with it. You then monitor for the scriptmenuresponse, and then set the dvar on the cliient, and it will then show the corresponding string in the dvarFloatList{}.
    Last edited by Tally; 28th May 2013 at 18:32.

  10. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (28th May 2013)

  11. #17
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    Both itemDef examples are from eXtreme+ rcon_playerctrl.menu. The one I quoted is for displaying a player's name for a specific slot, and that's what the OP wanted. Nothing is missing at all.
    Your itemDef example is for setting a player action in eXtreme in-game RCON. Although the dvar/dvarFloatList stuff is good-to-know for some readers, it's certainly not required.

    btw: dvarFloatList and dvartest are totally unrelated. dvar and dvarFLoatList are related, and dvartest/showdvar/hidedvar are related.

  12. #18
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Post deleted. Refrain from flaming/flamebaiting
    Last edited by IzNoGoD; 30th May 2013 at 16:20.

  13. #19
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    I just found out why previously I couldn't get the value of a dvar to show in an itemDef{} - I had always been using "decoration" as part of the itemDef{}. This prevents it working. Once you leave it out, it works.

  14. #20
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    That still doesnt work for me:/ I already left it out.
    Maybe i place this at the wrong part
    PHP Code:
        players getEntArray"player""classname" ); 
        for( 
    i=0players.sizei++ ) 
        { 
            
    player players[i]; 
             
            if( 
    player getEntityNumber() == 
            { 
                
    player setClientCvar"ui_player_name_" iplayer.name ); 
                
    player setClientCvar"ui_player_entNum_" i); 
            } 
        } 
    Where am I supposed to thread this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •