Skip to content

Commit c8bfe8e

Browse files
committed
Make a new parameter
Make a new parameter called check_duplicate_serials which is enabled by default
1 parent aa33493 commit c8bfe8e

File tree

6 files changed

+23
-1
lines changed

6 files changed

+23
-1
lines changed

Server/mods/deathmatch/local.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@
274274
Values: 0 - Off, 1 - Enabled. Default - 0 -->
275275
<elementdata_whitelisted>0</elementdata_whitelisted>
276276

277+
<!-- This parameter determines that the server checks when the players connect that there are no other players with the same serial number.
278+
Note that this may break compatibility with virtual machines.
279+
Not guarantees that the player cannot manipulate their serial.
280+
Values: 0 - Off, 1 - Enabled. Default - 1 -->
281+
<check_duplicate_serials>1</check_duplicate_serials>
282+
277283
<!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module>
278284
parameter(s). Optional parameter. -->
279285
<!-- <module src="sample_win32.dll"/> -->

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ void CGame::Packet_PlayerJoinData(CPlayerJoinDataPacket& Packet)
17991799
}
18001800

18011801
// Check if another player is using the same serial
1802-
if (m_pPlayerManager->GetBySerial(strSerial))
1802+
if (m_pMainConfig->IsCheckDuplicateSerialsEnabled() && m_pPlayerManager->GetBySerial(strSerial))
18031803
{
18041804
// Tell the console
18051805
CLogger::LogPrintf("CONNECT: %s failed to connect (Serial already in use) (%s)\n", szNick, strIPAndSerial.c_str());

Server/mods/deathmatch/logic/CMainConfig.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ CMainConfig::CMainConfig(CConsole* pConsole) : CXMLConfig(NULL)
8080
m_iBackupAmount = 5;
8181
m_bSyncMapElementData = true;
8282
m_elementDataWhitelisted = false;
83+
m_checkDuplicateSerials = true;
8384
}
8485

8586
bool CMainConfig::Load()
@@ -528,6 +529,7 @@ bool CMainConfig::Load()
528529
}
529530

530531
GetBoolean(m_pRootNode, "elementdata_whitelisted", m_elementDataWhitelisted);
532+
GetBoolean(m_pRootNode, "check_duplicate_serials", m_checkDuplicateSerials);
531533

532534
ApplyNetOptions();
533535

Server/mods/deathmatch/logic/CMainConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class CMainConfig : public CXMLConfig
127127
bool IsDatabaseCredentialsProtectionEnabled() const { return m_bDatabaseCredentialsProtectionEnabled != 0; }
128128
bool IsFakeLagCommandEnabled() const { return m_bFakeLagCommandEnabled != 0; }
129129
bool IsElementDataWhitelisted() const { return m_elementDataWhitelisted; }
130+
bool IsCheckDuplicateSerialsEnabled() const noexcept { return m_checkDuplicateSerials; }
130131
bool IsCheckResourceClientFilesEnabled() const noexcept { return m_checkResourceClientFiles != 0; }
131132

132133
SString GetSetting(const SString& configSetting);
@@ -230,5 +231,6 @@ class CMainConfig : public CXMLConfig
230231
int m_iPlayerTriggeredEventIntervalMs;
231232
int m_iMaxPlayerTriggeredEventsPerInterval;
232233
bool m_elementDataWhitelisted;
234+
bool m_checkDuplicateSerials;
233235
int m_checkResourceClientFiles;
234236
};

Server/mods/deathmatch/mtaserver.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@
274274
Values: 0 - Off, 1 - Enabled. Default - 0 -->
275275
<elementdata_whitelisted>0</elementdata_whitelisted>
276276

277+
<!-- This parameter determines that the server checks when the players connect that there are no other players with the same serial number.
278+
Note that this may break compatibility with virtual machines.
279+
Not guarantees that the player cannot manipulate their serial.
280+
Values: 0 - Off, 1 - Enabled. Default - 1 -->
281+
<check_duplicate_serials>1</check_duplicate_serials>
282+
277283
<!-- These parameters specify the maximum amount of events that can be triggered by the client (via triggerServerEvent) within the given interval.
278284
Note: The interval is given in milliseconds
279285
Interval range: 50 to 5000. Default: 1000

Server/mods/deathmatch/mtaserver.conf.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@
275275
Values: 0 - Off, 1 - Enabled. Default - 0 -->
276276
<elementdata_whitelisted>0</elementdata_whitelisted>
277277

278+
<!-- This parameter determines that the server checks when the players connect that there are no other players with the same serial number.
279+
Note that this may break compatibility with virtual machines.
280+
Not guarantees that the player cannot manipulate their serial.
281+
Values: 0 - Off, 1 - Enabled. Default - 1 -->
282+
<check_duplicate_serials>1</check_duplicate_serials>
283+
278284
<!-- These parameters specify the maximum amount of events that can be triggered by the client (via triggerServerEvent) within the given interval.
279285
Note: The interval is given in milliseconds
280286
Interval range: 50 to 5000. Default: 1000

0 commit comments

Comments
 (0)