Raised This Month: $ Target: $400
 0% 

get player hold key time in sec.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
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 #1

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
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:28.


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