Two extra params in cs_set_user_vip for determining whether or not model and scoreboard are updated at28699

Version bumpage
This commit is contained in:
Scott Ehlert 2006-05-02 21:49:17 +00:00
parent 6733ef9a79
commit 6cc239c66f
2 changed files with 55 additions and 29 deletions

View File

@ -414,11 +414,13 @@ static cell AMX_NATIVE_CALL cs_get_user_vip(AMX *amx, cell *params) // cs_get_us
return 0; return 0;
} }
static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_user_vip(index, vip = 1); = 2 params static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1); = 4 params
{ {
// Set user vip // Set user vip
// params[1] = user index // params[1] = user index
// params[2] = if 1, activate vip, else deactivate vip. // params[2] = if 1, activate vip, else deactivate vip.
// params[3] = if 1, update model
// params[4] = if 1, update scoreboard with vip information
// Valid entity should be within range // Valid entity should be within range
CHECK_PLAYER(params[1]); CHECK_PLAYER(params[1]);
@ -426,42 +428,66 @@ 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]);
if (params[2] == 1) { // Backwards compatibility with older version of native that only took two params
if (params[0] / sizeof(cell) == 2)
{
// Default last two params to 1 to give same functionality as older native
params[3] = 1;
params[4] = 1;
}
if (params[2] == 1)
{
// Set to "be" vip. // Set to "be" vip.
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP; *((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP;
// Set vip model if (params[3] == 1)
*((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = CS_CT_VIP; {
// This makes the model get updated right away. // Set vip model
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds. *((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = CS_CT_VIP;
// This makes the model get updated right away.
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds.
}
// Set VIP on scoreboard. Probably doesn't work for terrorist team. if (params[4] == 1)
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL)); {
WRITE_BYTE(params[1]); // Set VIP on scoreboard. Probably doesn't work for terrorist team.
WRITE_BYTE(SCOREATTRIB_VIP); MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL));
MESSAGE_END(); WRITE_BYTE(params[1]);
WRITE_BYTE(SCOREATTRIB_VIP);
MESSAGE_END();
}
} }
else { else
{
// 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;
// Set a random CT model. if (params[3] == 1)
CS_Internal_Models CTmodels[4] = {CS_CT_URBAN, CS_CT_GSG9, CS_CT_GIGN, CS_CT_SAS}; {
CS_Internal_Models ct_model = CTmodels[RANDOM_LONG(0, 3)]; // Set a random CT model.
*((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = ct_model; CS_Internal_Models CTmodels[4] = {CS_CT_URBAN, CS_CT_GSG9, CS_CT_GIGN, CS_CT_SAS};
// This makes the model get updated right away. CS_Internal_Models ct_model = CTmodels[RANDOM_LONG(0, 3)];
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds. *((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = ct_model;
// This makes the model get updated right away.
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); // If this causes any problems for WON, do this line only in STEAM builds.
}
// Set nothing/dead on scoreboard. if (params[4] == 1)
int scoreattrib; {
if (pPlayer->v.deadflag == DEAD_NO && pPlayer->v.health > 0) // Set nothing/dead on scoreboard.
scoreattrib = SCOREATTRIB_NOTHING; // cts can't have bombs anyway int scoreattrib;
else
scoreattrib = SCOREATTRIB_DEAD; if (pPlayer->v.deadflag == DEAD_NO && pPlayer->v.health > 0)
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL)); scoreattrib = SCOREATTRIB_NOTHING; // cts can't have bombs anyway
WRITE_BYTE(params[1]); else
WRITE_BYTE(scoreattrib); scoreattrib = SCOREATTRIB_DEAD;
MESSAGE_END();
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL));
WRITE_BYTE(params[1]);
WRITE_BYTE(scoreattrib);
MESSAGE_END();
}
} }
return 1; return 1;

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "CStrike" #define MODULE_NAME "CStrike"
#define MODULE_VERSION "1.71" #define MODULE_VERSION "1.72"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "CSTRIKE" #define MODULE_LOGTAG "CSTRIKE"