Raised This Month: $ Target: $400
 0% 

[SOLVED]Bestway to catch +attack2 & -attack2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-25-2011 , 13:06   [SOLVED]Bestway to catch +attack2 & -attack2
Reply With Quote #1

hi,

i tried to catch +attack2 with Ham_Weapon_SecondaryAttack but now i need to catch -attack2

i have 2 functions which willbe called by +attack2 and -attack2.

is there a good way to catch this cmds?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
lazarev
Veteran Member
Join Date: Sep 2008
Old 05-25-2011 , 13:20   Re: bestway to catch +attack2 & -attack2
Reply With Quote #2

m_afButtonPressed [№246] and m_afButtonReleased [№247] offsets would be just fine
lazarev is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-25-2011 , 13:33   Re: bestway to catch +attack2 & -attack2
Reply With Quote #3

ty. this gave me a kick.
with ham i cant do it because i need the hold time.
i did it with CmdStart and it works.

ty
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-25-2011 , 13:43   Re: bestway to catch +attack2 & -attack2
Reply With Quote #4

Quote:
Originally Posted by One View Post
with ham i cant do it because i need the hold time.
Yes you can.

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #define m_afButtonPressed 246 #define m_afButtonReleased 247 public plugin_init() {     RegisterHam(Ham_Player_PreThink, "player", "FwdPlayerPreThink"); } public FwdPlayerPreThink(id) {     static Float:flPressedTime[33];         if(get_pdata_int(id, m_afButtonPressed, 5) & IN_ATTACK2)     {         flPressedTime[id] = get_gametime();     }     else if(get_pdata_int(id, m_afButtonReleased, 5) & IN_ATTACK2)     {         new Float:flHoldTime = get_gametime() - flPressedTime[id];                 // -attack2 and flHoldTime is the time in seconds                 flPressedTime[id] = 0.0;     } }

There are other methods besides those offsets, though.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-25-2011 , 13:55   Re: [SOLVED]Bestway to catch +attack2 & -attack2
Reply With Quote #5

oh thanks but i tought its better to avoid prethink.

is cmdstart not better then prethink?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-25-2011 , 14:07   Re: [SOLVED]Bestway to catch +attack2 & -attack2
Reply With Quote #6

Quote:
Originally Posted by One View Post
oh thanks but i tought its better to avoid prethink.

is cmdstart not better then prethink?
These offsets could be used in PreThink or CmdStart.
I think they would be useless in CmdStart since you could use the UC_Button instead.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-25-2011 , 14:09   Re: [SOLVED]Bestway to catch +attack2 & -attack2
Reply With Quote #7

oh,ok. ty again.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Reply



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 12:36.


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