From 72a0a37f745b384d04c3829da47c2cf9f0cc30f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 22 Apr 2004 09:38:30 +0000 Subject: [PATCH] cs_set_user_team - should now update model+scoreboard right away --- dlls/cstrike/cstrike.cpp | 24 +++++++++++++++++++----- dlls/cstrike/cstrike.h | 1 + plugins/include/cstrike.inc | 6 ++---- 3 files changed, 22 insertions(+), 9 deletions(-) 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,