• Murder Hooks, adding a round timer...
    8 replies, posted
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.
[url]https://github.com/mechanicalmind/murder/search?utf8=%E2%9C%93&q=hook.call[/url] [code] "PlayerPickupLoot" "OnStartRound" "PlayerLoadout" "PlayerSetModel" "OnStartRound" "OnChangeMap" "OnEndRound" [/code] Looks like they are all serverside.
[QUOTE=YourStalker;47943818][url]https://github.com/mechanicalmind/murder/search?utf8=%E2%9C%93&q=hook.call[/url] [code] "PlayerPickupLoot" "OnStartRound" "PlayerLoadout" "PlayerSetModel" "OnStartRound" "OnChangeMap" "OnEndRound" [/code] Looks like they are all serverside.[/QUOTE] Oh cool thanks ill try putting everything together and ill post back the result :D [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 :D
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: [lua] if SERVER then util.AddNetworkString( "startTheTimer" ) whatDoIDo = "I eat the whole ass" hook.Add( "OnStartRound", "theRoundStarted", function() net.Send( "startTheTimer" ) net.WriteString( whatDoIDo ) net.Broadcast() end ) end if CLIENT then net.Receive( "startTheTimer", function() whatIDoIsThat = net.ReadString() chat.AddText( Color( 255, 255, 255), whatIDoIsThat ) end ) end [/lua] The output would print to chat "I eat the whole ass". I included a little example of how you can also send data. The [url=http://wiki.garrysmod.com/page/Main_Page]Gmod Wiki[/url] and this [url=http://wiki.garrysmod.com/page/Net_Library_Usage]Net Library[/url] 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 :P 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. :D
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... [code] if SERVER then util.AddNetworkString( "PlayerConnectmsg" ) hook.Add( "PlayerConnect", "doSayOnConnect", onConnect ) net.Send( "PlayerConnectmsg" ) net.Broadcast() end if CLIENT then net.Receive( "startTheTimer", function() chat.AddText( Color( 255, 255, 255), "Player " .. ply:Nick() .. "(" .. ply:SteamID() .. ") has joined the game." ) end ) end [/code]
Sorry ill make a new thread thanks :D
Sorry, you need to Log In to post a reply to this thread.