Hi all,
I've been writing a plugin to do Heavy weapons guy Melee only sudden death in SM - ala Beetlesmod.
It works like a dream except I can't seem to block the player_changeclass event from firing.
Here's an example of my code (simplified):
Code:
public OnPluginStart() {
HookEvent("player_changeclass", EventPlayerChangeClass_Pre, EventHookMode_Pre);
}
public Action:EventPlayerChangeClass_Pre(Handle:event, const String:name[], bool:dontBroadcast){
return Plugin_Handled;
}
Couldn't be simpler in theory, however the above code does not block the event as I would hope (effectively preventing the change of class).
Am I misunderstanding? I had assumed that this code would basically fire before the event and by returning Plugin_Handled, the engine assumes that the event has been handled by the code in the handler. However, in TF2, this isn't the case, the change in class happens regardless.
I would love for someone to tell me I've got the wrong end of the stick and that there's an easy way to do this!
Any help appreciated.
Cheers
joev