extensions/sdktools/teamnatives.cpp
changeset 1997 bc77ecae3bda
parent 1993 8c08aaff4d39
child 2274 80a5a7d4b259
     1.1 --- a/extensions/sdktools/teamnatives.cpp	Sat Apr 12 02:18:03 2008 +0000
     1.2 +++ b/extensions/sdktools/teamnatives.cpp	Sat Apr 12 23:03:30 2008 +0000
     1.3 @@ -42,6 +42,11 @@
     1.4  
     1.5  bool FindTeamEntities(SendTable *pTable, const char *name)
     1.6  {
     1.7 +	if (strcmp(pTable->GetName(), name) == 0)
     1.8 +	{
     1.9 +		return true;
    1.10 +	}
    1.11 +
    1.12  	int props = pTable->GetNumProps();
    1.13  	SendProp *prop;
    1.14  
    1.15 @@ -50,10 +55,6 @@
    1.16  		prop = pTable->GetProp(i);
    1.17  		if (prop->GetDataTable())
    1.18  		{
    1.19 -			if (strcmp(prop->GetDataTable()->GetName(), name) == 0)
    1.20 -			{
    1.21 -				return true;
    1.22 -			}
    1.23  			if (FindTeamEntities(prop->GetDataTable(), name))
    1.24  			{
    1.25  				return true;
    1.26 @@ -111,7 +112,7 @@
    1.27  static cell_t GetTeamName(IPluginContext *pContext, const cell_t *params)
    1.28  {
    1.29  	int teamindex = params[1];
    1.30 -	if (teamindex > (int)g_Teams.size())
    1.31 +	if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
    1.32  	{
    1.33  		pContext->ThrowNativeError("Team index %d is invalid", teamindex);
    1.34  	}
    1.35 @@ -127,7 +128,7 @@
    1.36  static cell_t GetTeamScore(IPluginContext *pContext, const cell_t *params)
    1.37  {
    1.38  	int teamindex = params[1];
    1.39 -	if (teamindex > (int)g_Teams.size())
    1.40 +	if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
    1.41  	{
    1.42  		pContext->ThrowNativeError("Team index %d is invalid", teamindex);
    1.43  	}
    1.44 @@ -140,7 +141,7 @@
    1.45  static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params)
    1.46  {
    1.47  	int teamindex = params[1];
    1.48 -	if (teamindex > (int)g_Teams.size())
    1.49 +	if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
    1.50  	{
    1.51  		pContext->ThrowNativeError("Team index %d is invalid", teamindex);
    1.52  	}
    1.53 @@ -154,7 +155,7 @@
    1.54  static cell_t GetTeamClientCount(IPluginContext *pContext, const cell_t *params)
    1.55  {
    1.56  	int teamindex = params[1];
    1.57 -	if (teamindex > (int)g_Teams.size())
    1.58 +	if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
    1.59  	{
    1.60  		pContext->ThrowNativeError("Team index %d is invalid", teamindex);
    1.61  	}