PDA

View Full Version : player_hurt and mres_supercede


Rogean
09-21-2005, 21:51
Heyas.

Iv been playing around with the SourceMM A bit. I did the usual playing with FireEvent First. I decided to stick a MRES_SUPERCEDE on any player_hurt events to see if I could stop a player from being hurt (Strictly testing, wanted to see if I could get it to work).

For some reason, its not working.

bool SamplePlugin::FireEvent_Handler(IGameEvent *event, bool bDontBroadcast)
{
if (!event || !event->GetName())
RETURN_META_VALUE(MRES_IGNORED, false);

const char *name = event->GetName();

if (FStrEq(name, "player_hurt")) {
META_LOG(g_PLAPI, "player_hurt found, superceding");
RETURN_META_VALUE(MRES_SUPERCEDE, false);
} else RETURN_META_VALUE(MRES_IGNORED, true);
}

But for some reason, its not doing anything to prevent the damage. Tested with bots (Not sure if the bots would have been the problem, but I believe I took damage as well).

The META_LOG message does appear in the console.

Any suggestions?

Thanks,
-Rogean

L. Duke
09-22-2005, 20:38
You're blocking the FireEvent, not the actual damage.

I believe you have to hook TraceAttack to block damage, but I don't know for sure.

Rogean
09-22-2005, 21:07
ahh k, I see. That would require editing the server.dll though, wouldn't it?

I know theres a way to do it in the mod, as fysh has done it with nemod. Anyone able to point me in the right direction?

Thanks,
-Rogean