View Single Post
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 10-19-2020 , 22:52   Re: [TF2]Realistic/Campaign mod for TF2 - almost done
Reply With Quote #2

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

Last edited by Drixevel; 10-19-2020 at 22:56.
Drixevel is offline