Thread: changelevel
View Single Post
WaLkMaN
Senior Member
Join Date: Oct 2010
Location: Varna, Bulgaria
Old 05-06-2023 , 09:53   Re: changelevel
Reply With Quote #6

Quote:
Originally Posted by hornet View Post
There's no return for that forward. It's called afterwards.


You can't actually hook CGameRules::ChangeLevel, use GoToIntermission instead. The advantage of this is that it will not be called when a server admin changes the map via amxmodmenu or amx_map:

Code:
#include <amxmodx> #include <orpheu> #include <orpheu_stocks> new g_pGameRules; public plugin_precache() {     OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "On_InstallGameRules", OrpheuHookPost ); } public plugin_init() {     OrpheuRegisterHookFromObject( g_pGameRules, "GoToIntermission", "CGameRules", "On_GoToIntermission" ); } public On_InstallGameRules() {     g_pGameRules = OrpheuGetReturn(); } public OrpheuHookReturn: On_GoToIntermission() {     /* Change level / set short task to change level here / change amx_nextmap */ }
With ReAPI:

Code:
#include <amxmodx> #include <reapi> public plugin_init() {     RegisterHookChain( RG_CSGameRules_GoToIntermission, "On_GoToIntermission", true ); } public On_GoToIntermission() {     /* Change level / set short task to change level here / change amx_nextmap */ }
__________________
WaLkMaN is offline