added request amb515

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401039
This commit is contained in:
David Anderson
2007-07-03 19:03:14 +00:00
parent 653e9038d3
commit 816bdc8102
2 changed files with 36 additions and 0 deletions
+24
View File
@@ -973,10 +973,34 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
return 1;
}
static cell_t ChangeClientTeam(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
} else if (!pPlayer->IsInGame()) {
return pContext->ThrowNativeError("Client %d is not in game", client);
}
IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
if (!pInfo)
{
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
}
pInfo->ChangeTeam(params[2]);
return 1;
}
REGISTER_NATIVES(playernatives)
{
{"AddUserFlags", AddUserFlags},
{"CanUserTarget", CanUserTarget},
{"ChangeClientTeam", ChangeClientTeam},
{"GetClientAuthString", sm_GetClientAuthStr},
{"GetClientCount", sm_GetClientCount},
{"GetClientInfo", sm_GetClientInfo},