Skip to content

Conversation

@Xenius97
Copy link
Contributor

Closes #3970, #3860

This PR allows you to launch a secondary client. Similar to FiveM, it can be accessed using the “-cl2” command line argument.
The secondary client uses its own configuration files and resource cache, avoiding any conflicts. Your serial remains the same, nothing changes there.
To use it, you need to disable the double-serial check in mtaserver.conf.

<check_duplicate_serials>0</check_duplicate_serials>

From a development perspective, if you have two monitors, it can be extremely helpful to test things like synchronization even before potentially publishing a script.
You can also be in two places at the same time, which is an advantage when working with multiple servers.
I hope this feature can be included, and that MTA server developers will be able to make use of the potential it offers.

Please let me know if you have any requests or ideas related to the change, and I’ll do my best to accommodate them.

@FileEX
Copy link
Member

FileEX commented Nov 23, 2025

@Xenius97
Copy link
Contributor Author

master...feature/multi-client-support

Yes i saw but that looks unfinished or idk whats with that now. Isn't merged, has no update since june.

@G-Moris
Copy link
Contributor

G-Moris commented Nov 23, 2025

How about running an unlimited number of clients? Or maybe up to 5-10?

@Xenius97
Copy link
Contributor Author

How about running an unlimited number of clients? Or maybe up to 5-10?

I think it’s doable if we completely scrap this whole “mutex” and “GUID” thing. Although for such a step, feedback from the MTA leadership would also be necessary.
However, I would definitely separate the configs and the resource cache for each one to avoid any issues.

@Xenius97 Xenius97 closed this Nov 30, 2025
@qaisjp qaisjp reopened this Jan 24, 2026
@qaisjp qaisjp requested a review from a team as a code owner January 24, 2026 18:01
Comment on lines 335 to 341
// Don't report GTA as running if CL2 is active (to allow coexistence)
HANDLE hCL2Mutex = OpenMutexA(SYNCHRONIZE, FALSE, MTA_GUID_CL2);
if (hCL2Mutex)
{
CloseHandle(hCL2Mutex);
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should abstract this to a common IsSecondaryClientRunning

///////////////////////////////////////////////////////////////
void CServerIdManagerImpl::StaticSaveServerIdMap()
{
CXMLFile* pConfigFile = g_pCore->GetXML()->CreateXML(PathJoin(g_pClientGame->GetFileCacheRoot(), MTA_SERVERID_LOOKUP_XML));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, we can address this in a future PR -- what if we just change the GetFileCacheRoot to return a different directory for cl2?

if (CCore::GetSingleton().IsSecondaryClient())
return;

#ifdef MTA_CL2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can remove these checks too in CVersionUpdater since is blocked already with CCore::GetSingleton().IsSecondaryClient
@qaisjp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we need this?

#ifdef MTA_CL2
    // Don't allow update if CL2 is running
    HANDLE hCL2Mutex = OpenMutexA(SYNCHRONIZE, FALSE, "Global\\{4962AF5F-5D82-412D-9CCA-AB8BB9DBD354}");
    if (hCL2Mutex)
    {
        CloseHandle(hCL2Mutex);
        return;
    }
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to check both IsSecondaryClient and IsSecondaryClientRunning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but here is a small typo, AB8BB9DBD354 and you changed in Utils to AB8BB9DBD352 as i see

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to control game in VM

4 participants