Raised This Month: $ Target: $400
 0% 

get player hold key time in sec.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-18-2009 , 05:34   get player hold key time in sec.
Reply With Quote #1

tittle & how long player dont press the key?!
__________________
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
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-21-2009 , 18:41   Re: get player hold key time in sec.
Reply With Quote #2

mini bump sry but its important.
__________________
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
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 05-21-2009 , 19:00   Re: get player hold key time in sec.
Reply With Quote #3

On a game frame, GetClientButtons, then if a certain one is held down, start a very small timer, and keep doing that til it stops, then return the time.
almcaeobtac is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-21-2009 , 19:01   Re: get player hold key time in sec.
Reply With Quote #4

Quote:
Originally Posted by almcaeobtac View Post
On a game frame, GetClientButtons, then if a certain one is held down, start a very small timer, and keep doing that til it stops, then return the time.
omgggg........ ok. let try
__________________
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
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-21-2009 , 19:08   Re: get player hold key time in sec.
Reply With Quote #5

Witch buttons ?
All buttons ?
One specific button ?

Basically you hook FM_CmdStart.
For a specific button :

For first press : get_uc(uc, UC_Button) & IN_YOURBUTTON && !(entity_get_int(id, EV_INT_oldbutons) & IN_YOURBUTTON)
At this time store get_gametime()

Last press : !(get_uc(uc, UC_Button) & IN_YOURBUTTON) && entity_get_int(id, EV_INT_oldbutons) & IN_YOURBUTTON
Then do get_gametime() - storetime.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-21-2009 at 19:11.
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 19:09   Re: get player hold key time in sec.
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
Witch buttons ?
All buttons ?
One specific button ?
I think he wants a specific example.
Edit: ...
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 19:07   Re: get player hold key time in sec.
Reply With Quote #7

Quote:
Originally Posted by almcaeobtac View Post
On a game frame, GetClientButtons, then if a certain one is held down, start a very small timer, and keep doing that til it stops, then return the time.
Better on cmdstart ;).

PHP Code:
new Float:gametime_when_press[33] = {0.0, ...}
// plugin_init
register_forward(FM_CmdStart"fw_cmdstart")

public 
fw_cmdstart(iduc_handleseed)
{
 if (!
is_user_alive(id))
 {
  
gametime_when_press[id] = 0.0
  
return FMRES_IGNORED
 
}
 
 if (
gametime_when_press[id] != 0.0)
 {
   if (!(
get_uc(uc_handleUC_Buttons) & IN_USE))
   {
     
gametime_when_press[id] = 0.0
     
return FMRES_IGNORED
   
}
   if (
get_gametime() >= gametime_when_press[id] + 1.0)
   {
     
//  WOHOO
   
}
 }
 else
 {
   if (
get_uc(uc_handleUC_Buttons) & IN_USE))
   {
     
gametime_when_press[id] = get_gametime()
   }
 }
 
 return 
FMRES_IGNORED

I wrote it here so it is not tested!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 05-21-2009 at 19:10.
ot_207 is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 19:25   Re: get player hold key time in sec.
Reply With Quote #8

O.O...
What do you want to do?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-21-2009 , 19:26   Re: get player hold key time in sec.
Reply With Quote #9

add engine sound on rally mod?!
__________________
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
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 19:28   Re: get player hold key time in sec.
Reply With Quote #10

Then check the speed in Prethink or Postthink and remember the moment when you emited the engine sound. You don't need to use the buttons here .
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 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 01:29.


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