The library is shared, and yet all the functions that use it seem to be exclusively server side. I found a way to predict fall damage, but it’s a bit hacky. Is there any way I could somehow intercept the creation of new DamageInfo() objects and get the data from there?
Hmm well what’s wrong with letting the server tell clients they received damage? You can’t exactly tell the client he’s going to take damage before he actually does serverside…
Yeah, but I’m just trying to use all the Get methods of it on the client. If doing it on the server was an option for me, I wouldn’t have this issue in the first place.
[editline]03:51PM[/editline]
What I don’t understand is why hooking to AddDeathNotice/DrawDeathNotice doesn’t work. They’re both client side gamemode functions.
If hooking fails, make sure it is actually called in the gamemode. If it is, override the gamemode function and call the old gamemode function after doing what you need to do.
You’re right. I just used hooks.GetTable() and realized it will add whatever you put in hook.Add regardless of whether it exists or not. That probably is what threw me off.
Hmm well if that’s what you’re looking for you probably caught on to that already, but maybe you could hook to the x Killed y usermessages detailed in cl_deathnotice.lua?
Or you could manually hook to it:
[lua]local GAMEMODEAddDeathNotice = GAMEMODE.AddDeathNotice
function GAMEMODE:AddDeathNotice(Victim, team1, Inflictor, Attacker, team2)
– Blah.
GAMEMODEAddDeathNotice(Victim, team1, Inflictor, Attacker, team2)
end[/lua]
[editline]1[/editline]
Of course that would be equivalent to receiving the information from the server, but isn’t it impossible to do otherwise unless you do all of the prediction work yourself?
Those are both serverside so it doesn’t matter. What I meant was that not all gamemodes call the AddDeathNotice function. Most do, but there’s always the remote possibility of one not calling it.
If they don’t they most likely are still sending the usermessages. They could completely override the previously mentionned serverside hooks but it’s very unlikely and as long as they don’t you can hook to the usermessages.
Hooking to usermessages is a cool idea, but there’s could still be extra hooks they use in a custom gamemode. This method isn’t ideal in the first place since it doesn’t give me any damage info, just names.