1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <dhooks>
  4.  
  5. // int CCSGameRules::GoToIntermission(void)
  6. new Handle: hGoToIntermission;
  7. public OnPluginStart()
  8. {
  9. new Handle:temp = LoadGameConfigFile("intermission.games");
  10.  
  11. if(temp == INVALID_HANDLE)
  12. SetFailState("Why you no has gamedata?");
  13.  
  14. new offset = GameConfGetOffset(temp, "GoToIntermission");
  15.  
  16. if(offset == -1)
  17. SetFailState("Failed to get offset");
  18.  
  19. hGoToIntermission = DHookCreate(offset, HookType_GameRules, ReturnType_Int, ThisPointer_Ignore, GoToIntermission);
  20. }
  21. public OnMapStart()
  22. {
  23. //Hook Gamerules function in map start
  24. //Set post to true since we don’t plan to block!
  25. DHookGamerules(hGoToIntermission, true);
  26. }
  27. //Since this is set to ignore remove the this param and since it has no params remove the params param
  28. // public MRESReturn: GoToIntermission (this, Handle:hReturn, Handle:hParams) to like so.
  29. public MRESReturn:GoToIntermission(Handle:hReturn)
  30. {
  31. decl String:sMap[256];
  32. if(!GetNextMap(sMap, sizeof(sMap)))
  33. GetCurrentMap(sMap, sizeof(sMap));
  34. ForceChangeLevel(sMap, "game_end fix");
  35.  
  36. return MRES_Ignored;
  37. }