From d6c3a21dbbc0e34efe2c8b59d848f27ca3d62335 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 15 Jun 2016 20:19:50 +0700 Subject: [PATCH] Added native rg_select_default_team --- .../scripting/include/reapi_gamedll.inc | 8 ++++++++ reapi/include/cssdk/dlls/gamerules.h | 1 + reapi/src/natives/natives_misc.cpp | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc index e6d2286..3c74e20 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc @@ -529,3 +529,11 @@ native rg_switch_team(const index); * */ native rg_switch_weapon(const index, const weapon); + +/* +* To priority autoselect join to team +* +* @return Returns the Team Name +* +*/ +native TeamName:rg_select_default_team(); diff --git a/reapi/include/cssdk/dlls/gamerules.h b/reapi/include/cssdk/dlls/gamerules.h index 16e01d5..f57a3fa 100644 --- a/reapi/include/cssdk/dlls/gamerules.h +++ b/reapi/include/cssdk/dlls/gamerules.h @@ -421,6 +421,7 @@ public: // BOMB MAP FUNCTIONS virtual BOOL IsThereABomber() = 0; virtual BOOL IsThereABomb() = 0; + virtual TeamName SelectDefaultTeam() = 0; virtual bool HasRoundTimeExpired() = 0; virtual bool IsBombPlanted() = 0; diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 1d1381e..7b4cd20 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -1359,6 +1359,23 @@ cell AMX_NATIVE_CALL rg_switch_weapon(AMX *amx, cell *params) return (cell)pPlayer->CSPlayer()->SwitchWeapon(pWeapon); } +/* +* To priority autoselect join to team +* +* @return Returns the Team Name +* +* native TeamName:rg_select_default_team(); +*/ +cell AMX_NATIVE_CALL rg_select_default_team(AMX *amx, cell *params) +{ + if (g_pGameRules == nullptr) { + MF_LogError(amx, AMX_ERR_NATIVE, "%s: gamerules not initialized", __FUNCTION__); + return FALSE; + } + + return CSGameRules()->SelectDefaultTeam(); +} + AMX_NATIVE_INFO Misc_Natives_RG[] = { { "rg_set_animation", rg_set_animation }, @@ -1413,6 +1430,7 @@ AMX_NATIVE_INFO Misc_Natives_RG[] = { "rg_swap_all_players", rg_swap_all_players }, { "rg_switch_team", rg_switch_team }, { "rg_switch_weapon", rg_switch_weapon }, + { "rg_select_default_team", rg_select_default_team }, { nullptr, nullptr } };