Add GetTeamEntity native to SDKTools.

This commit is contained in:
Nicholas Hastings 2015-03-10 07:25:49 -07:00
parent 7f24f137d6
commit ae8efdddcb
2 changed files with 21 additions and 0 deletions

View File

@ -219,6 +219,17 @@ static cell_t GetTeamClientCount(IPluginContext *pContext, const cell_t *params)
return fn(g_Teams[teamindex].pEnt, 0);
}
static cell_t GetTeamEntity(IPluginContext *pContext, const cell_t *params)
{
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
return gamehelpers->EntityToBCompatRef(g_Teams[teamindex].pEnt);
}
sp_nativeinfo_t g_TeamNatives[] =
{
{"GetTeamCount", GetTeamCount},
@ -226,5 +237,6 @@ sp_nativeinfo_t g_TeamNatives[] =
{"GetTeamScore", GetTeamScore},
{"SetTeamScore", SetTeamScore},
{"GetTeamClientCount", GetTeamClientCount},
{"GetTeamEntity", GetTeamEntity},
{NULL, NULL}
};

View File

@ -259,6 +259,15 @@ native SetTeamScore(index, value);
*/
native GetTeamClientCount(index);
/**
* Returns the entity index of a team.
*
* @param teamIndex Team index.
* @return Entity index of team.
* @error Invalid team index.
*/
native int GetTeamEntity(int teamIndex);
/**
* Sets the model to a given entity.
*