diff --git a/dlls/cstrike/cstrike.cpp b/dlls/cstrike/cstrike.cpp index d28ee63c..6a9ed8f2 100755 --- a/dlls/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike.cpp @@ -537,17 +537,31 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_u if (model != 0) *((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: + strcpy(teaminfo, "TERRORIST"); + break; case TEAM_CT: + strcpy(teaminfo, "CT"); + break; case TEAM_SPECTATOR: - (int)*((int *)pPlayer->pvPrivateData + OFFSET_TEAM) = params[2]; + strcpy(teaminfo, "SPECTATOR"); break; default: - AMX_RAISEERROR(amx, AMX_ERR_NATIVE); - return 0; + sprintf(teaminfo, "TEAM_%d", params[2]); } - */ + MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "TeamInfo", NULL)); + WRITE_BYTE(params[1]); + WRITE_STRING(teaminfo); + MESSAGE_END(); return 1; } diff --git a/dlls/cstrike/cstrike.h b/dlls/cstrike/cstrike.h index 0a7b503e..aee857ac 100755 --- a/dlls/cstrike/cstrike.h +++ b/dlls/cstrike/cstrike.h @@ -199,6 +199,7 @@ pfnmodule_engine_g* g_engModuleFunc; #define PLAYER_IS_VIP (1<<8) +#define TEAM_UNASSIGNED 0 #define TEAM_T 1 #define TEAM_CT 2 #define TEAM_SPECTATOR 3 diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 46be557f..2a72813e 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -118,10 +118,8 @@ enum CsTeams { }; native cs_get_user_team(index); -/* Set user team without killing player (so you can move hostages, plant bomb etc as terrorist). - * Note: Effect may vary between different versions of CS. - * If model is anything other than 0, that will be set as player's model. - * Model updates when player spawns. +/* Set user team without killing player. + * If model is anything other than CS_DONTCHANGE, that will be set as player's model. */ enum CsInternalModel { CS_DONTCHANGE = 0,