mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Not sure why I decided to potentially crash the server with cs_set_user_vip o_O
Stayed tuned for another episode of "What Was DS Thinking?"
This commit is contained in:
parent
f26d208c38
commit
dc063594de
@ -428,12 +428,18 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
|
|||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
|
bool updateModel, updateScoreboard;
|
||||||
|
|
||||||
// Backwards compatibility with older version of native that only took two params
|
// Backwards compatibility with older version of native that only took two params
|
||||||
if (params[0] / sizeof(cell) == 2)
|
if (params[0] / sizeof(cell) == 2)
|
||||||
{
|
{
|
||||||
// Default last two params to 1 to give same functionality as older native
|
updateModel = true;
|
||||||
params[3] = 1;
|
updateScoreboard = true;
|
||||||
params[4] = 1;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateModel = (params[3] == 1);
|
||||||
|
updateScoreboard = (params[4] == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[2] == 1)
|
if (params[2] == 1)
|
||||||
@ -441,7 +447,7 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
|
|||||||
// Set to "be" vip.
|
// Set to "be" vip.
|
||||||
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP;
|
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP;
|
||||||
|
|
||||||
if (params[3] == 1)
|
if (updateModel)
|
||||||
{
|
{
|
||||||
// Set vip model
|
// Set vip model
|
||||||
*((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = CS_CT_VIP;
|
*((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = CS_CT_VIP;
|
||||||
@ -449,7 +455,7 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
|
|||||||
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds.
|
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[4] == 1)
|
if (updateScoreboard)
|
||||||
{
|
{
|
||||||
// Set VIP on scoreboard. Probably doesn't work for terrorist team.
|
// Set VIP on scoreboard. Probably doesn't work for terrorist team.
|
||||||
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL));
|
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL));
|
||||||
@ -463,7 +469,7 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
|
|||||||
// Set to not be vip.
|
// Set to not be vip.
|
||||||
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) &= ~PLAYER_IS_VIP;
|
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) &= ~PLAYER_IS_VIP;
|
||||||
|
|
||||||
if (params[3] == 1)
|
if (updateModel)
|
||||||
{
|
{
|
||||||
// Set a random CT model.
|
// Set a random CT model.
|
||||||
CS_Internal_Models CTmodels[4] = {CS_CT_URBAN, CS_CT_GSG9, CS_CT_GIGN, CS_CT_SAS};
|
CS_Internal_Models CTmodels[4] = {CS_CT_URBAN, CS_CT_GSG9, CS_CT_GIGN, CS_CT_SAS};
|
||||||
@ -473,7 +479,7 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
|
|||||||
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds.
|
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[4] == 1)
|
if (updateScoreboard)
|
||||||
{
|
{
|
||||||
// Set nothing/dead on scoreboard.
|
// Set nothing/dead on scoreboard.
|
||||||
int scoreattrib;
|
int scoreattrib;
|
||||||
|
Loading…
Reference in New Issue
Block a user