Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 46

Thread: name , client id in menu

  1. #21
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    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?
    Well, in the 2 examples above, the dvar is set after a scriptmenuresponse. So, that would be anywhere you are monitoring for menu response (eg maps\mp\gametypes\_menus.gsc, but obviously any file where you have a script varible waiting for a menu and response). So, if your action{} item is a scriptmenuresponse, using a loop to find all players is pretty redundant as you already have the entity defined - it would be the player making the menu response.

    Perhaps the best thing you can do is modding elementary - post your menu code and your menu response waiter script in full. That way we can see if we can spot any problems in the code.

    ADDENDUM -

    I would just point out that I've never had a problem showing a dvar value in a menu itemDef{}. My problem had always been when doing that with an action{} item as well. As I posted above, I just discovered what my problem had been - I was always including decoration as well in the item definition. If you leave it out, showing the value of a dvar works every time with an action{} item.
    Last edited by Tally; 29th May 2013 at 10:35.

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

    kung foo man (29th May 2013)

  3. #22
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    Post deleted. Refrain from flaming/flamebaiting
    Last edited by IzNoGoD; 30th May 2013 at 16:20.

  4. #23
    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.

  5. #24
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Just removed 3 posts. Please refrain from flaming/flamebaiting.

    Be polite and all that crap.

  6. #25
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    playerlist.menu
    Code:
    #include "ui_mp/menudef.h"
    
    #define ORIGIN_TITLE				48 64
    #define ORIGIN_CHOICE1				80 84
    #define ORIGIN_CHOICE2				80 108
    
    {
    	menuDef
    	{
    		name			"playerlist"
    		rect			0 0 640 480
    		focuscolor		GLOBAL_FOCUSED_COLOR
    		style			WINDOW_STYLE_EMPTY
    		blurWorld		5.0
    		onEsc 
    		{
    			close playerlist;
    		}
    
    
    		// Gradient
    		itemDef
    		{
    			style			WINDOW_STYLE_SHADER
    			//rect			-107 0 554 480
    			rect			0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
    			background		"gradient"
    			visible			1
    		}
    
    		#include "ui/bars.menu"
    
    		itemDef
    		{
    			type			ITEM_TYPE_TEXT
    			visible			1
    			origin			ORIGIN_TITLE
    			forecolor		1 1 1 1
    			text			"Playerlist"
    			textfont		UI_FONT_NORMAL
    			textscale		GLOBAL_HEADER_SIZE
    		}
    
    		itemDef 
    		{
    			name			"player1"
    			visible			1
    			rect			0 0 128 24
    			origin			ORIGIN_CHOICE1
    			forecolor		GLOBAL_UNFOCUSED_COLOR
    			type			ITEM_TYPE_BUTTON
    			dvar			"player_0"
    			textfont		UI_FONT_NORMAL
    			textscale		GLOBAL_TEXT_SIZE
    			textstyle		ITEM_TEXTSTYLE_SHADOWED
    			textaligny		20
    
    		}
    		itemDef 
    		{
    			name			"player2"
    			visible			1
    			rect			0 0 128 24
    			origin			ORIGIN_CHOICE2
    			forecolor		GLOBAL_UNFOCUSED_COLOR
    			type			ITEM_TYPE_BUTTON
    			dvar			"player_1"
    			textfont		UI_FONT_NORMAL
    			textscale		GLOBAL_TEXT_SIZE
    			textstyle		ITEM_TEXTSTYLE_SHADOWED
    			textaligny		20
    
    		}
    
    
    	}
    }
    in CallbackPlayer_Connect
    Code:
    {
    	thread dummy();
    
    	self.statusicon = "hud_status_connecting";
    	self waittill("begin");
    	self.statusicon = "";
    
    	level notify("connected", self);
    
    	if(!level.splitscreen)
    		iprintln(&"MP_CONNECTED", self);
    
        	players = getEntArray( "player", "classname" ); 
        	for( i=0; i < players.size; i++ ) 
        	{ 
            	player = players[i]; 
             
            	if( player getEntityNumber() == i ) 
            	{ 
                		player setClientCvar( "player_" + i, player.name );  
    			player iprintlnbold("player_"+i);
    			player iprintlnbold(player.name);
            	} 
        	}
    I can open the menu, but there is nothing inside. If I click on invisible name, it kicks me. So the button is working, the name is just not showing

  7. #26
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    How many were playing when you tested? Because you have it check entity number against the number of players on server. If there was just 1, that would make your entity number 0. Which means the dvar "player_1" wont show for you. Perhaps try testing "player_0" and see what happens.

    FYI - there is nothing wrong with the itemDef{} showing the dvar. I tested it and it was fine. I just set the dvar "player_1" onPlayerConnect, and put my name in. It showed up fine. So, the problem is the script setting the dvar after callback_playerConnect.

  8. #27
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    I was the only person on the server. The button has the name player_1, but the dvar has player_0. So it should work if there is only 1 person in the server. I tried it too with setting my name it and that worked fine as you said. But I dont have any error and the iprints dont show up. So i dont have any clue what to do :/

  9. #28
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    I was the only person on the server. The button has the name player_1, but the dvar has player_0. So it should work if there is only 1 person in the server. I tried it too with setting my name it and that worked fine as you said. But I dont have any error and the iprints dont show up. So i dont have any clue what to do :/
    No, you are setting the dvar "player_" + their entity number. The itemDef{} you posted has a display for the dvar "player_1" - which wont show when the dvar set is "player_0".

    If you have other itemDef{} to cover all possible scenarios, then the above wont explain why it wont show. So, I suggest you post the complete menu so we can check it again.

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

    kung foo man (1st June 2013)

  11. #29
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Huh that is the complete menu.
    Look here

    Code:
    			name			"player1"
    The button has the name player_1

    Code:
    			dvar			"player_0"
    the dvar is player_0

    So it should work when i got ID 0
    I dont understand what you are saying

  12. #30
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    Huh that is the complete menu.
    Look here

    Code:
    			name			"player1"
    The button has the name player_1

    Code:
    			dvar			"player_0"
    the dvar is player_0

    So it should work when i got ID 0
    I dont understand what you are saying
    Sorry, my bad. I was looking only at the last itemDef{}.

    I'll check your scripting to see whether it's at fault.

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

    Ni3ls (1st June 2013)

Posting Permissions

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