From: divverent Date: Tue, 8 Nov 2011 11:29:00 +0000 (+0000) Subject: allow listen server owner to pause the game (this also allows rcon pause) X-Git-Tag: xonotic-v0.6.0~163^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=28c03f315bdcb6be7b9c3b06a384a1a905ebfa85;p=xonotic%2Fdarkplaces.git allow listen server owner to pause the game (this also allows rcon pause) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11533 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index b8c493b2..f2d6af53 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1698,16 +1698,36 @@ Host_Pause_f */ static void Host_Pause_f (void) { - if (!pausable.integer) - SV_ClientPrint("Pause not allowed.\n"); + if (cmd_source == src_command) + { + // if running a client, try to send over network so the pause is handled by the server + if (cls.state == ca_connected) + { + Cmd_ForwardToServer (); + return; + } + print = Con_Printf; + } else + print = SV_ClientPrintf; + + if (!pausable.integer) { - sv.paused ^= 1; - SV_BroadcastPrintf("%s %spaused the game\n", host_client->name, sv.paused ? "" : "un"); - // send notification to all clients - MSG_WriteByte(&sv.reliable_datagram, svc_setpause); - MSG_WriteByte(&sv.reliable_datagram, sv.paused); + if (cmd_source == src_client) + { + if(cls.state == ca_dedicated || host_client == &svs.clients[0]) // non-admin + { + print("Pause not allowed.\n"); + return; + } + } } + + sv.paused ^= 1; + SV_BroadcastPrintf("%s %spaused the game\n", host_client->name, sv.paused ? "" : "un"); + // send notification to all clients + MSG_WriteByte(&sv.reliable_datagram, svc_setpause); + MSG_WriteByte(&sv.reliable_datagram, sv.paused); } /* @@ -2905,7 +2925,7 @@ void Host_InitCommands (void) Cmd_AddCommand_WithClientCommand ("say_team", Host_Say_Team_f, Host_Say_Team_f, "send a chat message to your team on the server"); Cmd_AddCommand_WithClientCommand ("tell", Host_Tell_f, Host_Tell_f, "send a chat message to only one person on the server"); Cmd_AddCommand_WithClientCommand ("kill", NULL, Host_Kill_f, "die instantly"); - Cmd_AddCommand_WithClientCommand ("pause", NULL, Host_Pause_f, "pause the game (if the server allows pausing)"); + Cmd_AddCommand_WithClientCommand ("pause", Host_Pause_f, Host_Pause_f, "pause the game (if the server allows pausing)"); Cmd_AddCommand ("kick", Host_Kick_f, "kick a player off the server by number or name"); Cmd_AddCommand_WithClientCommand ("ping", Host_Ping_f, Host_Ping_f, "print ping times of all players on the server"); Cmd_AddCommand ("load", Host_Loadgame_f, "load a saved game file");