Cstrike: cs_set_user_deaths - Add a param to choose whether scoreboard should be updated
This commit is contained in:
parent
71c6ac8c2e
commit
b82588f081
|
@ -80,7 +80,7 @@ static cell AMX_NATIVE_CALL cs_get_user_deaths(AMX *amx, cell *params)
|
||||||
return get_pdata<int>(pPlayer, m_iDeaths);
|
return get_pdata<int>(pPlayer, m_iDeaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
// native cs_set_user_deaths(index, newdeaths);
|
// native cs_set_user_deaths(index, newdeaths, bool:scoreboard = true);
|
||||||
static cell AMX_NATIVE_CALL cs_set_user_deaths(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL cs_set_user_deaths(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
GET_OFFSET("CBasePlayer", m_iDeaths);
|
GET_OFFSET("CBasePlayer", m_iDeaths);
|
||||||
|
@ -94,13 +94,23 @@ static cell AMX_NATIVE_CALL cs_set_user_deaths(AMX *amx, cell *params)
|
||||||
|
|
||||||
set_pdata<int>(pPlayer, m_iDeaths, deaths);
|
set_pdata<int>(pPlayer, m_iDeaths, deaths);
|
||||||
|
|
||||||
MESSAGE_BEGIN(MSG_ALL, MessageIdScoreInfo);
|
bool updateScoreboard = true;
|
||||||
WRITE_BYTE(index);
|
|
||||||
WRITE_SHORT(static_cast<int>(pPlayer->v.frags));
|
if (*params / sizeof(cell) >= 3)
|
||||||
WRITE_SHORT(deaths);
|
{
|
||||||
WRITE_SHORT(0);
|
updateScoreboard = params[3] != 0;
|
||||||
WRITE_SHORT(get_pdata<int>(pPlayer, m_iTeam));
|
}
|
||||||
MESSAGE_END();
|
|
||||||
|
if (updateScoreboard)
|
||||||
|
{
|
||||||
|
MESSAGE_BEGIN(MSG_ALL, MessageIdScoreInfo);
|
||||||
|
WRITE_BYTE(index);
|
||||||
|
WRITE_SHORT(static_cast<int>(pPlayer->v.frags));
|
||||||
|
WRITE_SHORT(deaths);
|
||||||
|
WRITE_SHORT(0);
|
||||||
|
WRITE_SHORT(get_pdata<int>(pPlayer, m_iTeam));
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
|
||||||
*static_cast<int *>(MF_PlayerPropAddr(index, Player_Deaths)) = deaths;
|
*static_cast<int *>(MF_PlayerPropAddr(index, Player_Deaths)) = deaths;
|
||||||
|
|
||||||
|
|
|
@ -152,13 +152,14 @@ native cs_get_user_deaths(index);
|
||||||
*
|
*
|
||||||
* @param index Client index
|
* @param index Client index
|
||||||
* @param newdeaths New value to set
|
* @param newdeaths New value to set
|
||||||
|
* @param scoreboard If true the scoreboard will be updated to reflect the new value.
|
||||||
*
|
*
|
||||||
* @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
|
* MaxClients, or the client is not connected, an error
|
||||||
* will be thrown.
|
* will be thrown.
|
||||||
*/
|
*/
|
||||||
native cs_set_user_deaths(index, newdeaths);
|
native cs_set_user_deaths(index, newdeaths, bool:scoreboard = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns index of the entity that a hostage is following.
|
* Returns index of the entity that a hostage is following.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user