AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detecting game start in a listen server? (https://forums.alliedmods.net/showthread.php?t=28000)

semi 05-04-2006 17:03

Detecting game start in a listen server?
 
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.

MaximusBrood 05-04-2006 18:48

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(); }

semi 05-04-2006 19:00

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

Xanimos 05-04-2006 19:06

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

I can't even think of something to say.

MaximusBrood 05-04-2006 19:08

Quote:

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

I can't even think of something to say.

Halleluja Suicid3!

(;))

semi 05-04-2006 19:34

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.

VEN 05-05-2006 04:03

plugin_init called after map initialized (all entities spawned etc).


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

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