Post deleted. Refrain from flaming/flamebaiting
Post deleted. Refrain from flaming/flamebaiting
Last edited by IzNoGoD; 30th May 2013 at 16:20.
That still doesnt work for me:/ I already left it out.
Maybe i place this at the wrong part
Where am I supposed to thread this?PHP Code:
players = getEntArray( "player", "classname" );
for( i=0; i < players.size; i++ )
{
player = players[i];
if( player getEntityNumber() == i )
{
player setClientCvar( "ui_player_name_" + i, player.name );
player setClientCvar( "ui_player_entNum_" + i, i );
}
}
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.
kung foo man (29th May 2013)
Just removed 3 posts. Please refrain from flaming/flamebaiting.
Be polite and all that crap.
playerlist.menu
in CallbackPlayer_ConnectCode:#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 } } }
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 showingCode:{ 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); } }
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.
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.
kung foo man (1st June 2013)
Huh that is the complete menu.
Look here
The button has the name player_1Code:name "player1"
the dvar is player_0Code:dvar "player_0"
So it should work when i got ID 0
I dont understand what you are saying
Ni3ls (1st June 2013)