Page 1 of 1
Pause/Unpause feature for custom mod
Posted: Tue Jul 15, 2008 6:50 pm
by nexus024
What I am trying to do is code something very similar to what OSP has in the way of pauseing/unpausing a game when teams get jacked. Does anyone know where in the source code this feature could be added in? Thanks!
Re: Pause/Unpause feature for custom mod
Posted: Tue Jul 15, 2008 7:26 pm
by ^misantropia^
sv_paused / cl_paused?
Re: Pause/Unpause feature for custom mod
Posted: Tue Jul 15, 2008 7:48 pm
by nexus024
Well I'm only able to work with sourc/cgame, source/game/ source/ui, and source/q3_ui in my mod.
Re: Pause/Unpause feature for custom mod
Posted: Wed Jul 16, 2008 6:46 am
by dutchmeat
I've created a pause/unpause command for RTCW,
http://www.s4ndmod.com/phpBB2/viewtopic.php?t=1144
You might want to check who can or can't use the pause command. Or just make it a servercommand.
Re: Pause/Unpause feature for custom mod
Posted: Wed Jul 16, 2008 2:44 pm
by nexus024
Yes, I am looking to code this for admin's only. This looks like some good stuff dutchmeat. I think I can work with this...
Re: Pause/Unpause feature for custom mod
Posted: Wed Jul 16, 2008 2:49 pm
by nexus024
Any idea how/if I can add in the sound that is made in OSP when the game is paused?
Re: Pause/Unpause feature for custom mod
Posted: Wed Jul 16, 2008 3:31 pm
by jkoder
Take a look at this tutorial.
http://www.quake3hut.co.uk/q3coding/mor ... sounds.htm
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 1:46 am
by nexus024
Ok, I am coming across some errors I need help with. I am thinking the last two might be RTCW specific?!
g_cmds.c: In function UnPauseGame: 'G_ExplodeMissle' undeclared (first use in this function)
g_cmds.c: structure has no member named 'effect1Time'
g_cmds.c: structure has no member named 'frozen'
Any help would really be appreciated!
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 7:09 am
by dutchmeat
scroll down at the topic, and you'll find myself correcting the code.
as for:
g_cmds.c: structure has no member named 'effect1Time'
remove:
grenades->s.effect1Time = level.time;
and before the UnPause function, add this:
extern void G_ExplodeMissile (gentity_t *ent);
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 11:18 am
by nexus024
Ok that fixed those errors, however I am still getting this one:
g_cmds.c: structure has no member named 'frozen'
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 3:26 pm
by dutchmeat
Leftover from a freezetag gameplay, remove these lines:
if (who->client)
who->client->sess.frozen = 0;
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 8:04 pm
by nexus024
Ok, I will give that a try when I get off work.
To pause/unpause the game with your code would you just issue rcon Pause to pause and rcon UnPause to unpause?
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 9:22 pm
by jkoder
nexus024 wrote:Ok, I will give that a try when I get off work.
To pause/unpause the game with your code would you just issue rcon Pause to pause and rcon UnPause to unpause?
Well if you don't want just about anyone who knows the command to pause the game it would make sense to make it a server only command.
Re: Pause/Unpause feature for custom mod
Posted: Fri Jul 18, 2008 11:00 pm
by nexus024
Ok, I'm now getting g_active.c:850 structure has no member named 'paused'
I added this line in g_local.h thinking it might fix the problem but it didn't...
int paused;
Any ideas?
Re: Pause/Unpause feature for custom mod
Posted: Sat Jul 19, 2008 1:00 am
by nexus024
Ok, I managed to figure it out... next is getting sound.

Re: Pause/Unpause feature for custom mod
Posted: Sat Jul 19, 2008 1:17 pm
by nexus024
Thanks for all your help guys... I was able to get the feature added with the sounds!
One more question though... What I would like to do is when the unpause cmd is called for the game to broadcast to everyone:
"Prepare to fight!"
"Three"
"Two"
"One"
"Fight!"
I was able to code it in for the sounds, however the problem is that I don't know how to code in a delay between playing each sound. As it stands now, it plays all the sounds almost simultaneously which isn't any good. Any suggestions?
Re: Pause/Unpause feature for custom mod
Posted: Sun Jul 20, 2008 6:59 pm
by jkoder
Hi,
If you take a look at how the warm up is implemented in cgame/cg_draw that should put you on the right
track. Take a look specifically at the method "static void CG_DrawWarmup( void )". Another useful function
for timed tasks is in game/g_active called ClientTimerActions. The comment states "Actions that happen once a second".