From abd47009fbfc7d51d2d3754672bccde80939fd0e Mon Sep 17 00:00:00 2001 From: fant1kua Date: Thu, 29 Aug 2019 22:08:24 +0300 Subject: [PATCH] Fix bug with change team if player is die Closes #142 (#143) * Fix bug with change team if player is die #142 * Add check_win_conditions argument to rg_set_user_team --- .../amxmodx/scripting/include/reapi_gamedll.inc | 5 +++-- reapi/src/natives/natives_misc.cpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc index 20dd580..cfc8fba 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc @@ -590,11 +590,12 @@ native rg_set_user_armor(const index, armorvalue, ArmorType:armortype); * @param team Team id * @param model Internal model, use MODEL_AUTO for a random appearance or MODEL_UNASSIGNED to not update it * -* @param send_teaminfo If true, a TeamInfo message will be sent +* @param send_teaminfo If true, a TeamInfo message will be sent +* @param check_win_conditions If true, a CheckWinConditions will be call * * @return 1 on success, 0 otherwise */ -native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MODEL_AUTO, const bool:send_teaminfo = true); +native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MODEL_AUTO, const bool:send_teaminfo = true, const bool:check_win_conditions = false); /* * Sets the client's player model. diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 080e561..bbc3403 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -1297,15 +1297,16 @@ cell AMX_NATIVE_CALL rg_set_user_armor(AMX *amx, cell *params) * @param team Team id * @param model Internal model, use MODEL_AUTO for a random appearance or MODEL_UNASSIGNED to not update it * -* @param send_teaminfo If true, a TeamInfo message will be sent +* @param send_teaminfo If true, a TeamInfo message will be sent +* @param check_win_conditions If true, a CheckWinConditions will be call * * @return 1 on success, 0 otherwise * -* native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MODEL_AUTO, const bool:send_teaminfo = true); +* native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MODEL_AUTO, const bool:send_teaminfo = true, const bool:check_win_conditions = false); */ cell AMX_NATIVE_CALL rg_set_user_team(AMX *amx, cell *params) { - enum args_e { arg_count, arg_index, arg_team, arg_model, arg_sendinfo }; + enum args_e { arg_count, arg_index, arg_team, arg_model, arg_sendinfo, arg_check_win_conditions }; CHECK_GAMERULES(); CHECK_ISPLAYER(arg_index); @@ -1387,6 +1388,11 @@ cell AMX_NATIVE_CALL rg_set_user_team(AMX *amx, cell *params) if (args[arg_team] == SPECTATOR && !pPlayer->IsAlive()) { pPlayer->CSPlayer()->StartDeathCam(); } + + if (PARAMS_COUNT >= 5 && args[arg_check_win_conditions]) { + CSGameRules()->CheckWinConditions(); + } + return TRUE; }