Cstrike: cs_set_user_team - Add a param to choose whether TeamInfo message should be sent
This commit is contained in:
parent
8be119aa6a
commit
939aad5cb9
|
@ -514,7 +514,7 @@ static cell AMX_NATIVE_CALL cs_get_user_team(AMX *amx, cell *params)
|
||||||
return get_pdata<int>(pPlayer, m_iTeam);
|
return get_pdata<int>(pPlayer, m_iTeam);
|
||||||
}
|
}
|
||||||
|
|
||||||
// native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE);
|
// native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE, bool:send_teaminfo = true);
|
||||||
static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
GET_OFFSET("CBasePlayer", m_iModelName);
|
GET_OFFSET("CBasePlayer", m_iModelName);
|
||||||
|
@ -536,6 +536,13 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params)
|
||||||
|
|
||||||
Players[index].ResetModel(pPlayer);
|
Players[index].ResetModel(pPlayer);
|
||||||
|
|
||||||
|
bool sendTeamInfo = true;
|
||||||
|
|
||||||
|
if (*params / sizeof(cell) >= 4)
|
||||||
|
{
|
||||||
|
sendTeamInfo = params[4] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
char teaminfo[32];
|
char teaminfo[32];
|
||||||
|
|
||||||
switch (team)
|
switch (team)
|
||||||
|
@ -547,10 +554,13 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params)
|
||||||
default: sprintf(teaminfo, "TEAM_%i", team);
|
default: sprintf(teaminfo, "TEAM_%i", team);
|
||||||
}
|
}
|
||||||
|
|
||||||
MESSAGE_BEGIN(MSG_ALL, MessageIdTeamInfo);
|
if (sendTeamInfo)
|
||||||
WRITE_BYTE(index);
|
{
|
||||||
WRITE_STRING(teaminfo);
|
MESSAGE_BEGIN(MSG_ALL, MessageIdTeamInfo);
|
||||||
MESSAGE_END();
|
WRITE_BYTE(index);
|
||||||
|
WRITE_STRING(teaminfo);
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
|
||||||
MF_SetPlayerTeamInfo(index, team, team <= TEAM_SPECTATOR ? teaminfo : nullptr);
|
MF_SetPlayerTeamInfo(index, team, team <= TEAM_SPECTATOR ? teaminfo : nullptr);
|
||||||
|
|
||||||
|
|
|
@ -465,17 +465,17 @@ native cs_set_user_plant(index, plant = 1, showbombicon = 1);
|
||||||
* @note For a list of valid team ids see the CsTeams enum, and for a list of
|
* @note For a list of valid team ids see the CsTeams enum, and for a list of
|
||||||
* valid internal model ids see the CsInternalModel enum.
|
* valid internal model ids see the CsInternalModel enum.
|
||||||
*
|
*
|
||||||
* @param index Client index
|
* @param index Client index
|
||||||
* @param team Team id
|
* @param team Team id
|
||||||
* @param model Internal model id, if CS_DONTCHANGE the game will choose the
|
* @param model Internal model id, if CS_DONTCHANGE the game will choose the model
|
||||||
* model
|
* @param send_teaminfo If true, a TeamInfo message will be sent
|
||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error If the client index is not within the range of 1 to
|
* @error If the client index is not within the range of 1 to
|
||||||
* MaxClients, or the client is not connected, an error will be
|
* MaxClients, or the client is not connected, an error will be
|
||||||
* thrown.
|
* thrown.
|
||||||
*/
|
*/
|
||||||
native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE);
|
native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE, bool:send_teaminfo = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the client's team and optionally the model id.
|
* Returns the client's team and optionally the model id.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user