Skip to content

Commit 1b65afd

Browse files
authored
Merge branch 'master' into client_c20
2 parents 1a42391 + b24ff88 commit 1b65afd

File tree

13 files changed

+256
-89
lines changed

13 files changed

+256
-89
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,12 +4405,9 @@ bool CClientGame::ApplyPedDamageFromGame(eWeaponType weaponUsed, float fDamage,
44054405
return false;
44064406
}
44074407

4408-
if (pDamagedPed->IsLocalPlayer())
4409-
{
4410-
// Reget values in case they have been changed during onClientPlayerDamage event (Avoid AC#1 kick)
4411-
fCurrentHealth = pDamagedPed->GetGamePlayer()->GetHealth();
4412-
fCurrentArmor = pDamagedPed->GetGamePlayer()->GetArmor();
4413-
}
4408+
// Reget values in case they have been changed during onClientPlayerDamage/onClientPedDamage event (Avoid AC#1 kick)
4409+
fCurrentHealth = pDamagedPed->GetGamePlayer()->GetHealth();
4410+
fCurrentArmor = pDamagedPed->GetGamePlayer()->GetArmor();
44144411

44154412
bool bIsBeingShotWhilstAiming = (weaponUsed >= WEAPONTYPE_PISTOL && weaponUsed <= WEAPONTYPE_MINIGUN && pDamagedPed->IsUsingGun());
44164413
bool bOldBehaviour = !IsGlitchEnabled(GLITCH_HITANIM);

Client/mods/deathmatch/logic/CClientPad.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ CClientPad::CClientPad()
116116
{
117117
m_fStates[i] = 0.0f;
118118
}
119-
120-
// Initialise our analog control states
121-
for (unsigned int i = 0; i < MAX_GTA_ANALOG_CONTROLS; i++)
122-
{
123-
m_sScriptedStates[i] = CS_NAN;
124-
m_bScriptedStatesNextFrameOverride[i] = false;
125-
}
126119
}
127120

128121
bool CClientPad::GetControlState(const char* szName, bool& bState)
@@ -468,6 +461,16 @@ bool CClientPad::GetAnalogControlIndex(const char* szName, unsigned int& uiIndex
468461
return false;
469462
}
470463

464+
void CClientPad::InitAnalogControlStates()
465+
{
466+
// Initialise our analog control states
467+
for (unsigned int i = 0; i < MAX_GTA_ANALOG_CONTROLS; i++)
468+
{
469+
m_sScriptedStates[i] = CS_NAN;
470+
m_bScriptedStatesNextFrameOverride[i] = false;
471+
}
472+
}
473+
471474
// Get the analog control state directly from a pad state. Use for players.
472475
bool CClientPad::GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides)
473476
{

Client/mods/deathmatch/logic/CClientPad.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class CClientPad
2323
static const char* GetControlName(unsigned int uiIndex);
2424

2525
static bool GetAnalogControlIndex(const char* szName, unsigned int& uiIndex);
26+
static void InitAnalogControlStates();
2627

2728
CClientPad();
2829

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ void CClientPed::Init(CClientManager* pManager, unsigned long ulModelID, bool bI
251251
// Init the local player
252252
_CreateLocalModel();
253253

254+
// Init default analog control states
255+
CClientPad::InitAnalogControlStates();
256+
254257
// Give full health, no armor, no weapons and put him at a safe location
255258
SetHealth(GetMaxHealth());
256259
SetArmor(0);
@@ -2705,6 +2708,10 @@ void CClientPed::StreamedInPulse(bool bDoStandardPulses)
27052708
return;
27062709
}
27072710

2711+
// Re-create ped
2712+
if (m_shouldRecreate)
2713+
ReCreateGameEntity();
2714+
27082715
// Grab some vars here, saves getting them twice
27092716
CClientVehicle* pVehicle = GetOccupiedVehicle();
27102717

@@ -3974,11 +3981,7 @@ void CClientPed::_ChangeModel()
39743981
{
39753982
// ChrML: Changing the skin in certain cases causes player sliding. So we recreate instead.
39763983

3977-
// Kill the old player
3978-
_DestroyModel();
3979-
3980-
// Create the new with the new skin
3981-
_CreateModel();
3984+
m_shouldRecreate = true;
39823985
}
39833986

39843987
// ReAttach satchels
@@ -4012,11 +4015,7 @@ void CClientPed::ReCreateModel()
40124015
m_pLoadedModelInfo->ModelAddRef(BLOCKING, "CClientPed::ReCreateModel");
40134016
}
40144017

4015-
// Destroy the old model
4016-
_DestroyModel();
4017-
4018-
// Create the new model
4019-
_CreateModel();
4018+
m_shouldRecreate = true;
40204019

40214020
// Remove the reference we temporarily added again
40224021
if (bSameModel)
@@ -4026,6 +4025,20 @@ void CClientPed::ReCreateModel()
40264025
}
40274026
}
40284027

4028+
void CClientPed::ReCreateGameEntity()
4029+
{
4030+
if (!m_shouldRecreate || !m_pPlayerPed)
4031+
return;
4032+
4033+
// Destroy current game entity
4034+
_DestroyModel();
4035+
4036+
// Create the new game entity
4037+
_CreateModel();
4038+
4039+
m_shouldRecreate = false;
4040+
}
4041+
40294042
void CClientPed::ModelRequestCallback(CModelInfo* pModelInfo)
40304043
{
40314044
// If we have a player loaded

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
566566

567567
// Used to destroy the current game ped and create a new one in the same state.
568568
void ReCreateModel();
569+
void ReCreateGameEntity();
569570

570571
void _CreateModel();
571572
void _CreateLocalModel();
@@ -725,6 +726,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
725726
bool m_bPendingRebuildPlayer;
726727
uint m_uiFrameLastRebuildPlayer;
727728
bool m_bIsSyncing;
729+
bool m_shouldRecreate{false};
728730

729731
bool m_bBulletImpactData;
730732
CClientEntityPtr m_pBulletImpactEntity;

Server/mods/deathmatch/editor.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
<!-- This parameter specifies the name the server will be visible as in the ingame server browser
44
and on Game-Monitor. It is a required parameter. -->
55
<servername>Map Editor Server</servername>
6+
7+
<!-- The rule parameters are optional settings that the server will make public for the server browser/list.
8+
A brief description of the server. -->
9+
<rule name="description" value="" />
10+
11+
<!-- A comma separated list of languages that the server supports (e.g. en). -->
12+
<rule name="languages" value="" />
13+
14+
<!-- A comma separated list of tags that describe the server (e.g. freeroam,roleplay). -->
15+
<rule name="tags" value="" />
16+
17+
<!-- The URL of the server's website. -->
18+
<rule name="website_url" value="" />
19+
20+
<!-- A social media URL #1 (e.g. Discord). -->
21+
<rule name="social_url_1" value="" />
22+
23+
<!-- A social media URL #2 (e.g. YouTube). -->
24+
<rule name="social_url_2" value="" />
25+
26+
<!-- A social media URL #3 (e.g. Facebook). -->
27+
<rule name="social_url_3" value="" />
628

729
<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
830
The email addresses will not be publicly available, and only used by MTA administrators

Server/mods/deathmatch/local.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
<!-- This parameter specifies the name the server will be visible as in the ingame server browser
44
and on Game-Monitor. It is a required parameter. -->
55
<servername>Default MTA Server</servername>
6+
7+
<!-- The rule parameters are optional settings that the server will make public for the server browser/list.
8+
A brief description of the server. -->
9+
<rule name="description" value="" />
10+
11+
<!-- A comma separated list of languages that the server supports (e.g. en). -->
12+
<rule name="languages" value="" />
13+
14+
<!-- A comma separated list of tags that describe the server (e.g. freeroam,roleplay). -->
15+
<rule name="tags" value="" />
16+
17+
<!-- The URL of the server's website. -->
18+
<rule name="website_url" value="" />
19+
20+
<!-- A social media URL #1 (e.g. Discord). -->
21+
<rule name="social_url_1" value="" />
22+
23+
<!-- A social media URL #2 (e.g. YouTube). -->
24+
<rule name="social_url_2" value="" />
25+
26+
<!-- A social media URL #3 (e.g. Facebook). -->
27+
<rule name="social_url_3" value="" />
628

729
<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
830
The email addresses will not be publicly available, and only used by MTA administrators

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,15 @@ bool CGame::Start(int iArgumentCount, char* szArguments[])
979979
}
980980
}
981981

982-
// If ASE is enabled
982+
// Init ASE
983983
m_pASE = new ASE(m_pMainConfig, m_pPlayerManager, static_cast<int>(usServerPort), strServerIPList);
984984
if (m_pMainConfig->GetSerialVerificationEnabled())
985985
m_pASE->SetRuleValue("SerialVerification", "yes");
986+
987+
// Set the Rules loaded from config
988+
for (const auto& [key, value] : m_pMainConfig->GetRulesForASE())
989+
m_pASE->SetRuleValue(key, value);
990+
986991
ApplyAseSetting();
987992
m_pMasterServerAnnouncer = new CMasterServerAnnouncer();
988993
m_pMasterServerAnnouncer->Pulse();

0 commit comments

Comments
 (0)