diff --git a/cs2_sdk/entity/cbaseplayerpawn.h b/cs2_sdk/entity/cbaseplayerpawn.h
deleted file mode 100644
index 264c024..0000000
--- a/cs2_sdk/entity/cbaseplayerpawn.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * =============================================================================
- * CS2Fixes
- * Copyright (C) 2023 Source2ZE
- * =============================================================================
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 3.0, as published by the
- * Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-#pragma once
-
-#include "cbaseentity.h"
-#include "cbasemodelentity.h"
-#include "services.h"
-
-class CBasePlayerPawn : public CBaseModelEntity
-{
-public:
- DECLARE_SCHEMA_CLASS(CBasePlayerPawn);
-
- SCHEMA_FIELD(CPlayer_MovementServices*, m_pMovementServices)
- SCHEMA_FIELD(CPlayer_WeaponServices*, m_pWeaponServices)
- SCHEMA_FIELD(CCSPlayer_ItemServices*, m_pItemServices)
- SCHEMA_FIELD(CHandle, m_hController)
-
- void TakeDamage(int iDamage)
- {
- if (m_iHealth() - iDamage <= 0)
- CommitSuicide(false, true);
- else
- CBaseEntity::TakeDamage(iDamage);
- }
-
- void CommitSuicide(bool bExplode, bool bForce)
- {
- static int offset = g_GameConfig->GetOffset("CBasePlayerPawn_CommitSuicide");
- CALL_VIRTUAL(void, offset, this, bExplode, bForce);
- }
-
- CBasePlayerController *GetController() { return m_hController.Get(); }
-};
\ No newline at end of file
diff --git a/cs2_sdk/schema.cpp b/cs2_sdk/schema.cpp
index 054ca9d..e944a8b 100644
--- a/cs2_sdk/schema.cpp
+++ b/cs2_sdk/schema.cpp
@@ -22,20 +22,27 @@
#include "entity/cbaseentity.h"
#include "../utils/plat.h"
#include "schemasystem/schemasystem.h"
+#include "entity2/entityclass.h"
#include "tier0/memdbgon.h"
using SchemaKeyValueMap_t = std::map;
using SchemaTableMap_t = std::map;
-static bool IsFieldNetworked(SchemaClassFieldData_t& field)
+static bool IsFieldNetworked(const char* cppName, SchemaClassFieldData_t& field)
{
- for (int i = 0; i < field.m_nStaticMetadataCount; i++)
- {
- static auto networkEnabled = hash_32_fnv1a_const("MNetworkEnable");
- if (networkEnabled == hash_32_fnv1a_const(field.m_pStaticMetadata[i].m_pszName))
- return true;
- }
+ if (!GameEntitySystem())
+ return false;
+
+ // Just use a random class to get access to the full database, as some schema classes don't have entity representations
+ CNetworkSerializerCodeGenDatabase* pDatabase = GameEntitySystem()->FindClassByName("CBaseEntity")->m_NetworkSerializerInfo->m_pDatabase;
+ int index = pDatabase->m_ClassInfos.Find(cppName);
+
+ if (index == pDatabase->m_ClassInfos.InvalidIndex())
+ return false;
+
+ if (pDatabase->m_ClassInfos[index]->FindField(field.m_pszName))
+ return true;
return false;
}
@@ -74,7 +81,7 @@ static bool InitSchemaFieldsForClass(SchemaTableMap_t& tableMap, const char* cla
std::pair keyValuePair;
keyValuePair.first = hash_32_fnv1a_const(field.m_pszName);
keyValuePair.second.offset = field.m_nSingleInheritanceOffset;
- keyValuePair.second.networked = IsFieldNetworked(field);
+ keyValuePair.second.networked = IsFieldNetworked(pClassInfo->m_pszName, field);
keyValueMap.insert(keyValuePair);
}
diff --git a/serverlistplayersfix.cpp b/serverlistplayersfix.cpp
index e0427b2..f20cd4d 100644
--- a/serverlistplayersfix.cpp
+++ b/serverlistplayersfix.cpp
@@ -100,7 +100,7 @@ void ServerListPlayersFix::UpdatePlayers()
auto gpGlobals = engine->GetServerGlobals();
g_pEntitySystem = GameEntitySystem();
- if(!gpGlobals)
+ if(!gpGlobals || !g_pEntitySystem)
return;
for (int i = 0; i < gpGlobals->maxClients; i++)
@@ -126,7 +126,6 @@ void ServerListPlayersFix::Hook_GameFrame(bool simulating, bool bFirstTick, bool
g_flNextUpdate = curtime + 5.0;
}
-
}
void ServerListPlayersFix::AllPluginsLoaded()