Raised This Month: $ Target: $400
 0% 

Detecting game start in a listen server?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
semi
Junior Member
Join Date: May 2006
Old 05-04-2006 , 17:03   Detecting game start in a listen server?
Reply With Quote #1

I'm trying to write a small plugin to allow me to run a few commands once the game actually starts on a listen server, but I can't seem to find a method of detecting game start.

I tried hooking client_putinserver and checking the id, but it never runs for host. Hooking the log message might be best, but I'm not sure which would be best to hook. Any ideas/example code would be welcome.
semi is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 05-04-2006 , 18:48  
Reply With Quote #2

Do you mean the start of a new round, or just the start of a map.

For the round:
Code:
register_logevent("event_RoundStarted", 2, "0=World triggered", "1=Round_Start" )

When a new map is started, one of the first functions that is called is plugin_init. Just do this:
Code:
public plugin_init() {     //Do some stuff     //New map has started, so call this func to do some other stuff =)     MyFunction(); }
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
semi
Junior Member
Join Date: May 2006
Old 05-04-2006 , 19:00  
Reply With Quote #3

I didn't even think to use plugin_init, that works (although I had to set task to wait for everything else to finish loading).

Thanks
semi is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-04-2006 , 19:06  
Reply With Quote #4

Wait....you didn't use plugin_init()?

I can't even think of something to say.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 05-04-2006 , 19:08  
Reply With Quote #5

Quote:
Originally Posted by Suicid3
Wait....you didn't use plugin_init()?

I can't even think of something to say.
Halleluja Suicid3!

(;))
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
semi
Junior Member
Join Date: May 2006
Old 05-04-2006 , 19:34  
Reply With Quote #6

Quote:
Originally Posted by Suicid3
Wait....you didn't use plugin_init()?

I can't even think of something to say.
I thought plugin_init ran way too early. I need this after the map loads, and I assumed that was before/during.
semi is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-05-2006 , 04:03  
Reply With Quote #7

plugin_init called after map initialized (all entities spawned etc).
VEN 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:06.


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