diff --git a/extensions/sdktools/teamnatives.cpp b/extensions/sdktools/teamnatives.cpp index 01a4ca00..33cc0134 100644 --- a/extensions/sdktools/teamnatives.cpp +++ b/extensions/sdktools/teamnatives.cpp @@ -42,6 +42,11 @@ SourceHook::CVector g_Teams; bool FindTeamEntities(SendTable *pTable, const char *name) { + if (strcmp(pTable->GetName(), name) == 0) + { + return true; + } + int props = pTable->GetNumProps(); SendProp *prop; @@ -50,10 +55,6 @@ bool FindTeamEntities(SendTable *pTable, const char *name) prop = pTable->GetProp(i); if (prop->GetDataTable()) { - if (strcmp(prop->GetDataTable()->GetName(), name) == 0) - { - return true; - } if (FindTeamEntities(prop->GetDataTable(), name)) { return true; @@ -111,7 +112,7 @@ static cell_t GetTeamCount(IPluginContext *pContext, const cell_t *params) static cell_t GetTeamName(IPluginContext *pContext, const cell_t *params) { int teamindex = params[1]; - if (teamindex > (int)g_Teams.size()) + if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size())) { pContext->ThrowNativeError("Team index %d is invalid", teamindex); } @@ -127,7 +128,7 @@ static cell_t GetTeamName(IPluginContext *pContext, const cell_t *params) static cell_t GetTeamScore(IPluginContext *pContext, const cell_t *params) { int teamindex = params[1]; - if (teamindex > (int)g_Teams.size()) + if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size())) { pContext->ThrowNativeError("Team index %d is invalid", teamindex); } @@ -140,7 +141,7 @@ static cell_t GetTeamScore(IPluginContext *pContext, const cell_t *params) static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params) { int teamindex = params[1]; - if (teamindex > (int)g_Teams.size()) + if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size())) { pContext->ThrowNativeError("Team index %d is invalid", teamindex); } @@ -154,7 +155,7 @@ static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params) static cell_t GetTeamClientCount(IPluginContext *pContext, const cell_t *params) { int teamindex = params[1]; - if (teamindex > (int)g_Teams.size()) + if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size())) { pContext->ThrowNativeError("Team index %d is invalid", teamindex); }