Raised This Month: $ Target: $400
 0% 

TF2 HookEvent on map start (single time)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Boonie
Member
Join Date: Aug 2015
Old 08-20-2015 , 09:33   TF2 HookEvent on map start (single time)
Reply With Quote #1

Is there a way to hook on map start for TF2? I have tried server_spawn, game_init, game_newmap and game_start to no avail. When I use teamplay_round_start on multi section maps, it will hook on each round start (so 3 times on some maps). Any ideas?
Boonie is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-20-2015 , 09:58   Re: TF2 HookEvent on map start (single time)
Reply With Quote #2

You could just use SourceMod's OnMapStart or OnConfigsExecuted. I recommend the latter as that's after all configuration files have been processed.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Boonie
Member
Join Date: Aug 2015
Old 08-20-2015 , 10:17   Re: TF2 HookEvent on map start (single time)
Reply With Quote #3

I tried OnConfigsExecuted and my plugin loads, but I think it loads before it can add/edit stuff on the map? OnMapStart Didn't work at all.

Last edited by Boonie; 08-20-2015 at 10:20.
Boonie is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 08-20-2015 , 10:52   Re: TF2 HookEvent on map start (single time)
Reply With Quote #4

You can use teamplay_round_start in conjunction with OnMapStart. Set a boolean to true on map start, then on teamplay_round_start, if the boolean is false, terminate the function with a return value. Then after that check, do your remaining code in there, and set the boolean to false.

That way if it fires again it will not run your code again, effectively running only once on the map load.
Potato Uno is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-20-2015 , 11:40   Re: TF2 HookEvent on map start (single time)
Reply With Quote #5

I guess the question is... what exactly are you trying to do?

When OnMapStart and OnConfigsExecuted run, the map is loaded, but no players are currently in the game (they have to rejoin after map changes).
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 08-20-2015 , 11:46   Re: TF2 HookEvent on map start (single time)
Reply With Quote #6

if you want to create, edit or remove some entities, you need to do it every round.
KissLick is offline
Boonie
Member
Join Date: Aug 2015
Old 08-20-2015 , 23:39   Re: TF2 HookEvent on map start (single time)
Reply With Quote #7

Quote:
Originally Posted by KissLick View Post
if you want to create, edit or remove some entities, you need to do it every round.
This is what I needed to know, I guess I will just stick with teamplay_round_start then.
Boonie is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode