diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc index 1e8d522..37e2f92 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc @@ -679,6 +679,17 @@ native rg_transfer_c4(const index, const receiver = 0); */ native rg_instant_reload_weapons(const index, const weapon = 0); +/* +* Plant a bomb. +* +* @param index Owner index or 0 for worldspawn. +* @param origin The origin of the bomb where it will be planted. +* @param angles The angles of the planted bomb. +* +* @return Index of bomb entity or AMX_NULLENT (-1) otherwise +*/ +native rg_plant_bomb(const index, Float:vecOrigin[3], Float:vecAngles[3] = {0.0,0.0,0.0}); + /* * Sets the amount of reward in the game account for all players. * diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index e2bbfc6..e3af302 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -39,7 +39,7 @@ #include #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 18 +#define REGAMEDLL_API_VERSION_MINOR 20 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -625,6 +625,7 @@ struct ReGameFuncs_t { void (*RemoveEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType); int (*Cmd_Argc)(); const char *(*Cmd_Argv)(int i); + class CGrenade *(*PlantBomb)(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity); }; class IReGameApi { diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 3ce9c96..6003178 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -1600,6 +1600,42 @@ cell AMX_NATIVE_CALL rg_instant_reload_weapons(AMX *amx, cell *params) return TRUE; } +/* +* Plant a bomb. +* +* @param index Owner index or 0 for worldspawn. +* @param origin The origin of the bomb where it will be planted. +* @param angles The angles of the planted bomb. +* +* @return Index of bomb entity or AMX_NULLENT (-1) otherwise +* +* native rg_plant_bomb(const index, Float:vecOrigin[3], Float:vecAngles[3] = {0.0,0.0,0.0}); +*/ +cell AMX_NATIVE_CALL rg_plant_bomb(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_index, arg_origin, arg_angles }; + CAmxArgs args(amx, params); + + entvars_t *pevOwner = nullptr; + + if (params[arg_index] != 0) + { + CHECK_ISPLAYER(arg_index); + + CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); + CHECK_CONNECTED(pPlayer, arg_index); + pevOwner = pPlayer->pev; + } + + CGrenade *pBomb = g_ReGameFuncs->PlantBomb(pevOwner, args[arg_origin], args[arg_angles]); + + // Sanity check anyway + if (pBomb) + return indexOfPDataAmx(pBomb); + + return AMX_NULLENT; +} + /* * Sets the amount of reward in the game account for all players. * @@ -2231,7 +2267,7 @@ cell AMX_NATIVE_CALL rg_initialize_player_counts(AMX *amx, cell *params) cell& numAliveCT = *getAmxAddr(amx, params[arg_num_alive_ct]); cell& numDeadTerrorist = *getAmxAddr(amx, params[arg_num_dead_terrorist]); cell& numDeadCT = *getAmxAddr(amx, params[arg_num_dead_ct]); - + CSGameRules()->InitializePlayerCounts(numAliveTerrorist, numAliveCT, numDeadTerrorist, numDeadCT); return TRUE; } @@ -2371,6 +2407,7 @@ AMX_NATIVE_INFO Misc_Natives_RG[] = { "rg_transfer_c4", rg_transfer_c4 }, { "rg_instant_reload_weapons", rg_instant_reload_weapons }, + { "rg_plant_bomb", rg_plant_bomb }, { "rg_set_account_rules", rg_set_account_rules }, { "rg_get_account_rules", rg_get_account_rules },