OnStartRound never being called

I am writing a script to be used server side on a deathrun server.

One of my hooks uses OnStartRound to initiate a function but for some reason it is never called. I even used a simple:

[lua]hook.Add( “OnRoundStart”,“Reset”, function() PrintMessage(HUD_PRINTTALK,“Round has started, test”) end)[/lua]

I don’t think it is my syntax as all of my other hooks seem to be working fine. I isolated this particular hook in a seperate file to see if other lua errors were causing it but nothing.

Has anyone else encountered this problem?

If anyone could shed anylight on how I could fix this (or a workaround) I would be grateful.


I don’t think deathrun has OnRoundStart, most of the fretta stuff is taken out.

This deathrun gamemode is derived from fretta :S. I took a look at the deathrun shared file and tried to hook onto something specifically had a function for.

I used OnRoundResult since that acually posted something on screen so I knew the moment it had been active. Still nothing.

Anyone able to shed any more light on the situation?

Fretta doesn’t use hooks. It’s retarded.

Wow, so will I have just have to try and determine myself when the round starts in a local function?

Either convert fretta to use hooks, it’s not all that hard, or hard code it into fretta. Those are your only options.

How would I go about converting fretta to use hooks?

Here’s an example, http://luabin.overvprojects.nl/?path=/gamemodes/fretta/gamemode/round_controller.lua on line 134 you replace it with this…

[lua]hook.Call( “OnPreRoundStart”, GAMEMODE, GetGlobalInt( “RoundNumber” ) ) – Custom hook[/lua]

Just do that for every anything you want hooked. It’s pretty easy if you know what you are doing. Why garry refused to use this method is beyond me, but in recent events it doesn’t surprise me.

That completely makes sense! But why should you replace that OnRoundStart function? Shouldn’t you just put the hook.Call after the function on line 134?

It calls the gamemodes base function also.