Raised This Month: $ Target: $400
 0% 

Solved Detect firing for x seconds?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 05-12-2018 , 18:21   Re: Detect firing for x seconds?
Reply With Quote #1

Quote:
Originally Posted by KliPPy View Post
In that case you should post the solution, for the benefit of the community.
Sure!

PHP Code:
new buttons pev(idpev_button);
new 
oldbuttons pev(idpev_oldbuttons);

if(
buttons IN_ATTACK)
{
    
// Executed when you start holding IN_ATTACK
    
set_task(2.0"function"id); // Here you can set the amount of seconds you need to hold IN_ATTACK
}

if( 
oldbuttons IN_ATTACK && !( buttons IN_ATTACK ) )
{
    
// Executed when you release IN_ATTACK
    
remove_task(id);
    
boolean[id] = false;
}

public function(
id) {
    
boolean[id] = true// This boolean will only be true while holding IN_ATTACK for 2 seconds
}

// Then you can use that boolean in your code. 
Here is what I have done with it: Negev from CS:GO
sekac is offline
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 04:37.


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