added request amb515
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401039
This commit is contained in:
parent
653e9038d3
commit
816bdc8102
@ -973,10 +973,34 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
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)
|
REGISTER_NATIVES(playernatives)
|
||||||
{
|
{
|
||||||
{"AddUserFlags", AddUserFlags},
|
{"AddUserFlags", AddUserFlags},
|
||||||
{"CanUserTarget", CanUserTarget},
|
{"CanUserTarget", CanUserTarget},
|
||||||
|
{"ChangeClientTeam", ChangeClientTeam},
|
||||||
{"GetClientAuthString", sm_GetClientAuthStr},
|
{"GetClientAuthString", sm_GetClientAuthStr},
|
||||||
{"GetClientCount", sm_GetClientCount},
|
{"GetClientCount", sm_GetClientCount},
|
||||||
{"GetClientInfo", sm_GetClientInfo},
|
{"GetClientInfo", sm_GetClientInfo},
|
||||||
|
@ -514,3 +514,15 @@ native GetClientOfUserId(userid);
|
|||||||
* @error Invalid client index, or client not connected.
|
* @error Invalid client index, or client not connected.
|
||||||
*/
|
*/
|
||||||
native KickClient(client, const String:format[]="", any:...);
|
native KickClient(client, const String:format[]="", any:...);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes a client's team through the mod's generic team changing function.
|
||||||
|
* On CS:S, this will kill the player.
|
||||||
|
*
|
||||||
|
* @param client Client index.
|
||||||
|
* @param team Mod-specific team index.
|
||||||
|
* @noreturn
|
||||||
|
* @error Invalid client index, client not connected, or lack of
|
||||||
|
* mod support.
|
||||||
|
*/
|
||||||
|
native ChangeClientTeam(client, team);
|
||||||
|
Loading…
Reference in New Issue
Block a user