Murder Hooks, adding a round timer...

Hey i have been trying to add a round timer for the gamemode murder but i couldn’t find any information on the hooks or a way to check who the murder is or any way to determine the winner at the end of the round… so i really need assistance maybe some references, also by round timer i mean displaying a timer that indicates how much time is remaining before round ends and the bystanders win.


Looks like they are all serverside.

Oh cool thanks ill try putting everything together and ill post back the result :smiley:

[editline]13th June 2015[/editline]

Oh god not so good with the net library than i thought any idea on how to display the countdown timer on the left top corner of the screen on round start then kill the murder on round end? like a start

Lol Okay i have a start but still stupid net library ;( going to take a tutorial on it right now so if you have anything else, reply :smiley:

Net library is necessary if the hooks are serverside – which I don’t know why you would make a round hook serverside only, but it is your only solution.

Here is a basic hint on how to do shit client-side when a serverside hook is called:

if SERVER then
util.AddNetworkString( “startTheTimer” )

whatDoIDo = "I eat the whole ass"

hook.Add( "OnStartRound", "theRoundStarted", function()
	net.Send( "startTheTimer" )
		net.WriteString( whatDoIDo )
end )

if CLIENT then
net.Receive( “startTheTimer”, function()
whatIDoIsThat = net.ReadString()
chat.AddText( Color( 255, 255, 255), whatIDoIsThat )
end )

The output would print to chat “I eat the whole ass”. I included a little example of how you can also send data.
The Gmod Wiki and this Net Library tutorial are both very helpful.
You don’t have to send any data either. You could remove the Write/ReadString and just have it run the client code whenever the net.Receive gets called.

ahahahaha Thank You guys i really do like that example you gave me YourStalker :stuck_out_tongue: now i will keep the thread open for a little and thanks guys i can use this for future not so good with tnet library this will help. :smiley:

Okay well i did it thanks to you guys :D, Especially Your Stalker

[editline]14th June 2015[/editline]

Hey using the net library example tried making a join and leave msg i did this but i get no errors and it doesnt work…

 if SERVER then
	util.AddNetworkString( "PlayerConnectmsg" )

	hook.Add( "PlayerConnect", "doSayOnConnect", onConnect )
		net.Send( "PlayerConnectmsg" )

if CLIENT then
	net.Receive( "startTheTimer", function()
		chat.AddText( Color( 255, 255, 255), "Player " .. ply:Nick() .. "(" .. ply:SteamID() .. ") has joined the game."  )
	end )


Sorry ill make a new thread thanks :smiley: