A couple of things I'd suggest:
- Instead of enabling cheats in order to force the round to win, just strip the flag from it instead.
- Instead of using server commands to create the weapons for the player, I'd use TF2Items to just manually do that.
- If you hook Spawn instead of SpawnPost for ammo packs and just return stop on it, that'll do the same thing as killing them after they've spawned already.
- I'd move the server commands which you execute OnMapStart to OnConfigsExecuted instead and use ConVar functions instead to set them.
Code:
stock void TF2_ForceWin(TFTeam team = TFTeam_Unassigned)
{
int iFlags = GetCommandFlags("mp_forcewin");
SetCommandFlags("mp_forcewin", iFlags &= ~FCVAR_CHEAT);
ServerCommand("mp_forcewin %i", view_as<int>(team));
SetCommandFlags("mp_forcewin", iFlags);
}
https://github.com/Drixevel/sourcemo...c-tf.inc#L2659