Raised This Month: $ Target: $400
 0% 

Hooking player actions (+reload, +attack2, etc)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
epicoder
Junior Member
Join Date: Oct 2012
Old 04-07-2014 , 14:51   Hooking player actions (+reload, +attack2, etc)
Reply With Quote #1

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.

Last edited by epicoder; 04-07-2014 at 14:55.
epicoder is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode