cs_set_user_vip - changes to VIP model + updates scoreboard when appropriate

This commit is contained in:
Johnny Bergström 2004-04-22 12:38:57 +00:00
parent f508690552
commit de3dbd8a1d
3 changed files with 60 additions and 5 deletions

View File

@ -475,11 +475,44 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
return 0; return 0;
} }
if (params[2]) if (params[2] == 1) {
// Set to "be" vip.
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP; *((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP;
else
// Set vip model
*((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.
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL));
WRITE_BYTE(params[1]);
WRITE_BYTE(SCOREATTRIB_VIP);
MESSAGE_END();
}
else {
// 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.
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)];
*((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.
int scoreattrib;
if (pPlayer->v.deadflag == DEAD_NO && pPlayer->v.health > 0)
scoreattrib = SCOREATTRIB_NOTHING; // cts can't have bombs anyway
else
scoreattrib = SCOREATTRIB_DEAD;
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreAttrib", NULL));
WRITE_BYTE(params[1]);
WRITE_BYTE(scoreattrib);
MESSAGE_END();
}
return 1; return 1;
} }
@ -504,7 +537,7 @@ static cell AMX_NATIVE_CALL cs_get_user_team(AMX *amx, cell *params) // cs_get_u
return 0; return 0;
} }
return (int)*((int *)pPlayer->pvPrivateData + OFFSET_TEAM); return *((int *)pPlayer->pvPrivateData + OFFSET_TEAM);
} }
static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_user_team(index, team, model = 0); = 3 params static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_user_team(index, team, model = 0); = 3 params

View File

@ -212,6 +212,24 @@ pfnmodule_engine_g* g_engModuleFunc;
#define DEFUSER_COLOUR_B 0 #define DEFUSER_COLOUR_B 0
#define HAS_NVGOGGLES (1<<0) #define HAS_NVGOGGLES (1<<0)
#define SCOREATTRIB_NOTHING 0
#define SCOREATTRIB_DEAD 1
#define SCOREATTRIB_BOMB 2 // t only
#define SCOREATTRIB_VIP 4 // ct only
enum CS_Internal_Models {
CS_DONTCHANGE = 0,
CS_CT_URBAN = 1,
CS_T_TERROR = 2,
CS_T_LEET = 3,
CS_T_ARCTIC = 4,
CS_CT_GSG9 = 5,
CS_CT_GIGN = 6,
CS_CT_SAS = 7,
CS_T_GUERILLA = 8,
CS_CT_VIP = 9
};
// cstrike-specific defines above // cstrike-specific defines above
// Globals below // Globals below

View File

@ -139,8 +139,12 @@ native cs_set_user_team(index, team, model = CS_DONTCHANGE);
*/ */
native cs_get_user_vip(index); native cs_get_user_vip(index);
/* If vip = 1, user is set to vip. Note that this is useful to unset vips, so they can change teams properly. /* If vip = 1, user is set to vip.
* This will not change the player's model to/from vip, or add/remove the "VIP" text in scoreboard. * Model will be changed to VIP model if 1, else it will be changed to a random CT model.
* This shouldn't be used for players on teams other than CT.
* NOTE: this is mostly useful for unsetting vips, so they can change teams and/or buy items properly.
* It does not alter game play; the one being VIP at start of round will retain internal status as VIP; terrorists
* can terminate him and accomplish their objective, etc.
*/ */
native cs_set_user_vip(index, vip = 1); native cs_set_user_vip(index, vip = 1);