2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-04-22 22:33:35 +03:00

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
This commit is contained in:
fant1kua 2019-08-29 22:08:24 +03:00 committed by Dmitry Novikov
parent 6988e81d2a
commit abd47009fb
2 changed files with 12 additions and 5 deletions

View File

@ -590,11 +590,12 @@ native rg_set_user_armor(const index, armorvalue, ArmorType:armortype);
* @param team Team id * @param team Team id
* @param model Internal model, use MODEL_AUTO for a random appearance or MODEL_UNASSIGNED to not update it * @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 * @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. * Sets the client's player model.

View File

@ -1297,15 +1297,16 @@ cell AMX_NATIVE_CALL rg_set_user_armor(AMX *amx, cell *params)
* @param team Team id * @param team Team id
* @param model Internal model, use MODEL_AUTO for a random appearance or MODEL_UNASSIGNED to not update it * @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 * @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) 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_GAMERULES();
CHECK_ISPLAYER(arg_index); 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()) { if (args[arg_team] == SPECTATOR && !pPlayer->IsAlive()) {
pPlayer->CSPlayer()->StartDeathCam(); pPlayer->CSPlayer()->StartDeathCam();
} }
if (PARAMS_COUNT >= 5 && args[arg_check_win_conditions]) {
CSGameRules()->CheckWinConditions();
}
return TRUE; return TRUE;
} }