Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

Marinesniperjc

Custom Main Menu Unable to Rejoin Server

Recommended Posts

Hello all,

I am using a custom main menu on my server. When players exit out of the game onto the main menu they are unable to rejoin the server. The message states that the server is unreachable. I have looked into my scripting and have the correct ip address listed. does anyone have any idea why my server would be unreachable?

constatns.c
static const string MMpath = "ModdedMainMenu_v3/gui/MainMenu/MainMenu.layout";
static const string MMip = "212.22.92.22";
static const int MMport = 2303;
static const string MMdiscord = "https";
static const string MMvk = "https";
static const string MMtwitter = "https";

mainmenu.c

modded class MainMenu extends UIScriptedMenu 
{	
	protected Widget				discord_button;
	protected Widget				twitter_button;
	protected Widget				vk_button;
	
	override Widget Init()
	{
		layoutRoot = GetGame().GetWorkspace().CreateWidgets(MMpath);
		
		m_Play						= layoutRoot.FindAnyWidget( "play" );
		m_CustomizeCharacter		= layoutRoot.FindAnyWidget( "customize_character" );
		m_SettingsButton			= layoutRoot.FindAnyWidget( "settings" );
		m_Exit						= layoutRoot.FindAnyWidget( "exit" );
		discord_button				= layoutRoot.FindAnyWidget( "discord" );
		twitter_button				= layoutRoot.FindAnyWidget( "twitter" );
		vk_button					= layoutRoot.FindAnyWidget( "VK" );

		m_Version					= TextWidget.Cast( layoutRoot.FindAnyWidget( "version" ) );
		m_Stats						= new MainMenuStats( layoutRoot.FindAnyWidget( "stats_root" ) );		
		m_Mission					= MissionMainMenu.Cast( GetGame().GetMission() );		
		m_LastFocusedButton = 		m_Play;
		m_ScenePC					= m_Mission.GetIntroScenePC();
		
		if( m_ScenePC )
		{
			m_ScenePC.ResetIntroCamera();
		}
		
		m_PlayerName				= TextWidget.Cast( layoutRoot.FindAnyWidget("character_name") );
		
		string version;
		GetGame().GetVersion( version );
		m_Version.SetText( version );
		
		GetGame().GetUIManager().ScreenFadeOut(0);

		SetFocus( null );
		
		Refresh();
		
		GetDayZGame().GetBacklit().MainMenu_OnShow();
	
		g_Game.SetLoadState( DayZLoadState.MAIN_MENU_CONTROLLER_SELECT );
		
		return layoutRoot;
	}
	override bool OnClick( Widget w, int x, int y, int button )
	{
		if( button == MouseState.LEFT )
		{
			if( w == m_Play )
			{
				m_LastFocusedButton = m_Play;
				g_Game.ConnectFromServerBrowser( "172.107.80.132", "2302", ); //MMip, MMport,
				return true;
			}	
			else if ( w == m_CustomizeCharacter )
			{
				OpenMenuCustomizeCharacter();
				return true;
			}
			else if ( w == discord_button )
			{
				GetGame().OpenURL(MMdiscord); 
				return true;
			}
			else if ( w == vk_button )
			{
				GetGame().OpenURL(MMvk);
				return true;
			}
			else if ( w == twitter_button )
			{
				GetGame().OpenURL(MMtwitter);
				return true;
			}
			else if ( w == m_SettingsButton )
			{
				OpenSettings();
				return true;
			}
			else if ( w == m_Exit )
			{
				Exit();
				return true;
			}
		}
		return false;
	}

	void OnChangeCharacter(bool create_character = true)
	{
		if ( m_ScenePC && m_ScenePC.GetIntroCharacter() )
		{
			int charID = m_ScenePC.GetIntroCharacter().GetCharacterID();
			if (create_character)
			{
				m_ScenePC.GetIntroCharacter().CreateNewCharacterById( charID );
			}
			m_PlayerName.SetText( "#c_welcome" + " " + m_ScenePC.GetIntroCharacter().GetCharacterNameById( charID ) );
			
			Widget w = m_CustomizeCharacter.FindAnyWidget(m_CustomizeCharacter.GetName() + "_label");
			
			if ( w )
			{
				TextWidget text = TextWidget.Cast( w );
				
				if( m_ScenePC.GetIntroCharacter().IsDefaultCharacter() )
				{
					text.SetText("#layout_main_menu_customize_char");
				}
				else
				{
					text.SetText("#layout_main_menu_rename");
				}
			}
			if (m_ScenePC.GetIntroCharacter().GetCharacterObj() )
			{
				if ( m_ScenePC.GetIntroCharacter().GetCharacterObj().IsMale() )
					m_ScenePC.GetIntroCharacter().SetCharacterGender(ECharGender.Male);
				else
					m_ScenePC.GetIntroCharacter().SetCharacterGender(ECharGender.Female);
			}
			
			//update character stats
			m_Stats.UpdateStats();
		}
	}
	override void LoadMods()
	{
		return;
	}
	
	override void Play()
	{
		return;
	}
}

any help would be greatly appreciated!
 

Share this post


Link to post
Share on other sites

×