Jump to content

Recommended Posts

(Client) I'd probably do something like this personally (Ctrl+P remotely pauses the server). It seems like there are strings for player pauses (and like Godless mentioned before, you'd need admin for this), but I don't know if they are used somehow. Can't tell if in this situation it tells you who pauses the world in  singleplayer.

Spoiler
local _G = GLOBAL
local function SendPauseRemote()
	if not _G.TheInput:IsKeyDown(_G.KEY_CTRL) then return end
	_G.c_remote("SetServerPaused()")
end
_G.TheInput:AddKeyDownHandler(_G.KEY_P, SendPauseRemote)


(Server) Maybe doesn't require admin? Haven't tested

Spoiler
local _G = GLOBAL
local function Pause(player)
	_G.SetServerPaused()
end
AddModRPCHandler("PAUSERPC", "PAUSE", Pause)
local function SendPauseRPC()
	if not _G.TheInput:IsKeyDown(_G.KEY_CTRL) then return end
	SendModRPCToServer(GetModRPC("PAUSERPC", "PAUSE"))
end
_G.TheInput:AddKeyDownHandler(_G.KEY_P, SendPauseRPC)
Edited by oregu

Yes I've commissioned someone last year about a voting pause system for a public anonymous server. The system will set the time scale to 0 when paused, and also hack stategraph to stop players doing anything. But the system is imperfect because the hack is inadequate to prevent every ticking event. Otherwise RPC may break and the server will freeze.

Currently I don't have the code at hand to showcase.

Edited by Rickzzs

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...