cs_set_user_team - should now update model+scoreboard right away

This commit is contained in:
Johnny Bergström 2004-04-22 09:38:30 +00:00
parent 79a87f4cc8
commit 72a0a37f74
3 changed files with 22 additions and 9 deletions

View File

@ -537,17 +537,31 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_u
if (model != 0) if (model != 0)
*((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = model; *((int *)pPlayer->pvPrivateData + OFFSET_INTERNALMODEL) = model;
/*switch (params[2]) { // 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.
// And update scoreboard by sending TeamInfo msg.
char teaminfo[32];
switch (params[2]) {
case TEAM_UNASSIGNED:
strcpy(teaminfo, "UNASSIGNED");
break;
case TEAM_T: case TEAM_T:
strcpy(teaminfo, "TERRORIST");
break;
case TEAM_CT: case TEAM_CT:
strcpy(teaminfo, "CT");
break;
case TEAM_SPECTATOR: case TEAM_SPECTATOR:
(int)*((int *)pPlayer->pvPrivateData + OFFSET_TEAM) = params[2]; strcpy(teaminfo, "SPECTATOR");
break; break;
default: default:
AMX_RAISEERROR(amx, AMX_ERR_NATIVE); sprintf(teaminfo, "TEAM_%d", params[2]);
return 0;
} }
*/ MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "TeamInfo", NULL));
WRITE_BYTE(params[1]);
WRITE_STRING(teaminfo);
MESSAGE_END();
return 1; return 1;
} }

View File

@ -199,6 +199,7 @@ pfnmodule_engine_g* g_engModuleFunc;
#define PLAYER_IS_VIP (1<<8) #define PLAYER_IS_VIP (1<<8)
#define TEAM_UNASSIGNED 0
#define TEAM_T 1 #define TEAM_T 1
#define TEAM_CT 2 #define TEAM_CT 2
#define TEAM_SPECTATOR 3 #define TEAM_SPECTATOR 3

View File

@ -118,10 +118,8 @@ enum CsTeams {
}; };
native cs_get_user_team(index); native cs_get_user_team(index);
/* Set user team without killing player (so you can move hostages, plant bomb etc as terrorist). /* Set user team without killing player.
* Note: Effect may vary between different versions of CS. * If model is anything other than CS_DONTCHANGE, that will be set as player's model.
* If model is anything other than 0, that will be set as player's model.
* Model updates when player spawns.
*/ */
enum CsInternalModel { enum CsInternalModel {
CS_DONTCHANGE = 0, CS_DONTCHANGE = 0,