I'm trying to write a plugin that involves giving a player noclip while attack2 is held. Here is the gist of what I have:
Code:
public OnPluginStart() {
AddCommandListener(Lst_Noclip, "+attack2");
AddCommandListener(Lst_Noclip, "-attack2");
}
public Action:Lst_Noclip(client, const String:command[], argc) {
if (command[0] == '+') {
SetEntityMoveType(client, MOVETYPE_NOCLIP);
} else {
SetEntityMoveType(client, MOVETYPE_WALK);
}
return Plugin_Continue;
}
(in the actual code, I have all the check that player is alive/in-game/etc. This is a simplified version)
As far as I can tell, the listener is not even getting called at all. I've tried putting PrintToChat debug lines in there, typing +attack2 in console rather than pressing the button, just about anything I could think of.
I came up with an alternate version that involves checking each usercmd for attack2 using OnPlayerRunCmd, but that seemed a bit expensive and I was hoping to avoid it. Is what I'm trying to do possible with the method I'm using?
__________________
Missile ponies aren't everything in life, you know. But I have three, so I still win.