AlliedModders (
-   Snippets and Tutorials (
-   -   [TF2]Editing Round Timer (

Halt 08-21-2019 13:48

[TF2]Editing Round Timer
Not entirely sure if this has been shared yet, but in my latest zombie mod we moved to an entity based timer created through the zombie mod itself. But for some reason it didn't work no matter what method we tried. Other entities worked just fine. But team_round_timer acted differently. And yes, I removed all other timers OnMapStart.

Thought I'd share my discoveries. So simply put, if you wish to have a plugin control teamplay_round_timer you must create the entity AFTER teamplay_round_start event. It removes/resets any timer entity when it fires. Now I'll share my script.

PHP Code:

#include <sourcemod>
#include <tf2>

int g_iGameTimer;

void OnPluginStart()

TeamPlay_Round_Start(Handle eventm const char[] namebool dontBroadcast)
g_iGameTimer CreateEntityByName("team_round_timer");
//Dispatch Key Value/Inputs/Spawn Here

//Also you may want to remove this entity at end of round, or make it repeatable and re-use it.
//Note this allows you to completely control tf2 gameplay through the mod. You can add/remove time at any given point etc. 

As far as I know this is the only entity that acts this way. Also consider deleting all other team_round_timers that might be included in the map to prevent interference between the two.

Hope this helped anyone.

Powerlord 09-11-2019 17:15

Re: [TF2]Editing Round Timer
For TF2 Prop Hunt, I actually hooked my team_round_timer spawning to the SDKHook_SpawnPost of the team_control_point_master entity. As a failsafe, I check in teamplay_round_start to see if a TCPM entity exists on the map and spawn one if it doesn't. (Side note: Don't do this in CTF maps)

Granted, this was on the arena game mode, so in OnClientPutInServer, I used SendConVarValue to fake the tf_arena_round_time value to force the client UI to draw the timer background as it won't if this cvar is set to 0 (the default).

All times are GMT -4. The time now is 10:54.

Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.