Raised This Month: $ Target: $400
 0% 

how to write the code Press button E twice?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2010 , 21:34   Re: how to write the code Press button E twice?
Reply With Quote #1

Quote:
Originally Posted by fysiks View Post
in prethink forward you would have to look for a patter like this:

Code:
(new_buttons & IN_USE) && !(old_buttons & IN_USE)
!(new_buttons & IN_USE) && (old_buttons & IN_USE)
(new_buttons & IN_USE) && !(old_buttons & IN_USE)
!(new_buttons & IN_USE) && (old_buttons & IN_USE)
Search the scripting forum for code that shows you how to detect the +use button then modify it. You will need to put in a time check to see if the two button presses were close together (in time).
Terrible method.

You should hook Ham_ObjectCaps to detect when use key was pressed.
To check if player pressed use key twice, save the gametime of when the player presses the button and compare that to the current gametime to see how long ago it was when player pressed use key.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-24-2010 , 22:39   Re: how to write the code Press button E twice?
Reply With Quote #2

Quote:
Originally Posted by Exolent[jNr] View Post
Terrible method.

You should hook Ham_ObjectCaps to detect when use key was pressed.
To check if player pressed use key twice, save the gametime of when the player presses the button and compare that to the current gametime to see how long ago it was when player pressed use key.
lol, That's what I've seen used all the time. Never seen anyone suggest Ham_ObjectCaps when people ask for 'hooking' +use.
__________________
fysiks is offline
Jacob
Senior Member
Join Date: Oct 2010
Old 11-24-2010 , 23:26   Re: how to write the code Press button E twice?
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
Terrible method.

You should hook Ham_ObjectCaps to detect when use key was pressed.
To check if player pressed use key twice, save the gametime of when the player presses the button and compare that to the current gametime to see how long ago it was when player pressed use key.
Exolent,help me to write the complele code,please.
Jacob is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2010 , 23:36   Re: how to write the code Press button E twice?
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
lol, That's what I've seen used all the time. Never seen anyone suggest Ham_ObjectCaps when people ask for 'hooking' +use.
It's nothing new or anything.
https://forums.alliedmods.net/search...Ham_ObjectCaps

Quote:
Originally Posted by Jacob View Post
Exolent,help me to write the complele code,please.
I will not give the code to copy&paste.
I have told you what to do and since you are in Scripting Help then you are expected to make it yourself.
It's not like I'm telling you how to do something complicated.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 11:20.


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