Raised This Month: $ Target: $400
 0% 

get player hold key time in sec.


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

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 #2

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
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-21-2009 , 19:18   Re: get player hold key time in sec.
Reply With Quote #3

nop i wannt IN_FORWARD
IN_BACK

i wannt to add sound

for example :

if player hold the forward key >= 1 && <= 10. play the engine sound 1.

if hold the forward >= 10.1 && <= 20, play the engine sound 2.

like a real engine sound.
but when the player less the key for 0.00001 sec. & press this again the sound willbe played again.

omg its realy complicated (
__________________
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:21   Re: get player hold key time in sec.
Reply With Quote #4

Quote:
Originally Posted by One View Post
nop i wannt IN_FORWARD
IN_BACK

i wannt to add sound

for example :

if player hold the forward key >= 1 && <= 10. play the engine sound 1.

if hold the forward >= 10.1 && <= 20, play the engine sound 2.

like a real engine sound.
but when the player less the key for 0.00001 sec. & press this again the sound willbe played again.

omg its realy complicated (
1.Replace in what I've posted IN_USE with IN_FORWARD. Normally it should work! I told you, I wrote it in a hurry without testing it! So you need to make the proper corrections!
2. For >= 1 && <= 10 then you need to change the conditions!
__________________
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:23   Re: get player hold key time in sec.
Reply With Quote #5

sure i know how to change the key. i have another problem.

PHP Code:
speed vector_length(velocity)
        
        new 
Float:real_drehzahl
        
if( speed == 0.0)
        {
            
//emit_sound( 0 ,CHAN_ITEM, "rally/drehzahl.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH);
            
client_cmd(0,"spk rally/drehzahl")
            
gang 0
            drehzahl 
1000.0 
            
if(g_y >= 5.0)
            {
                
real_drehzahl 1000.0 g_y
            
}
            else
            {
                
real_drehzahl 1000.0 g_y
            
}
        }
        if( 
speed >= 0.1 && speed <= 100.0)
        {
            
gang 1
            drehzahl 
1000.0 
            
            
if(speed >= 1.0 && speed <= 10.0)
            {
                
real_drehzahl drehzahl 130
            
}
            else if(
speed >=11.0 && speed <= 20.0)
            {
                
real_drehzahl drehzahl 260
            
}
            else if(
speed >=21.0 && speed <= 30.0)
            {
                
real_drehzahl drehzahl 308
            
}
            else if(
speed >=31.0 && speed <= 40.0)
            {
                
real_drehzahl drehzahl 405
            
}
            else if(
speed >=41.0 && speed <= 50.0)
            {
                
real_drehzahl drehzahl 540
            
}
            else if(
speed >=51.0 && speed <= 60.0)
            {
                
real_drehzahl drehzahl 680
            
}
            else if(
speed >=61.0 && speed <= 70.0)
            {
                
real_drehzahl drehzahl 701
            
}
            else if(
speed >=71.0 && speed <= 80.0)
            {
                
real_drehzahl drehzahl 803
            
}
            else if(
speed >=81.0 && speed <= 90.0)
            {
                
real_drehzahl drehzahl 909
            
}
            else if(
speed >=91.0 && speed <= 100.0)
            {
                
real_drehzahl drehzahl 1050
            
}
        }
        else if( 
speed >= 101.0 && speed <= 200.0)
        {
            
gang 2
            drehzahl 
2000.0
            
if(g_y >= 5.0)
            {
                
real_drehzahl 2000.0 g_y
            
}
            else
            {
                
real_drehzahl 2000.0 g_y
            
}
            if(
speed >= 101.0 && speed <= 100.0)
            {
                
real_drehzahl drehzahl 130
            
}
            else if(
speed >=110.0 && speed <= 120.0)
            {
                
real_drehzahl drehzahl 260
            
}
            else if(
speed >=121.0 && speed <= 130.0)
            {
                
real_drehzahl drehzahl 308
            
}
            else if(
speed >=131.0 && speed <= 140.0)
            {
                
real_drehzahl drehzahl 405
            
}
            else if(
speed >=141.0 && speed <= 150.0)
            {
                
real_drehzahl drehzahl 540
            
}
            else if(
speed >=151.0 && speed <= 160.0)
            {
                
real_drehzahl drehzahl 680
            
}
            else if(
speed >=161.0 && speed <= 170.0)
            {
                
real_drehzahl drehzahl 701
            
}
            else if(
speed >=171.0 && speed <= 180.0)
            {
                
real_drehzahl drehzahl 803
            
}
            else if(
speed >=181.0 && speed <= 190.0)
            {
                
real_drehzahl drehzahl 909
            
}
            else if(
speed >=191.0 && speed <= 200.0)
            {
                
real_drehzahl drehzahl 1050
            
}
        }
        else if( 
speed >= 201.0 && speed <= 300.0)
        {
            
gang 3
            drehzahl 
3000.0
            
if(g_y >= 5.0)
            {
                
real_drehzahl 3000.0 g_y
            
}
            else
            {
                
real_drehzahl 3000.0 g_y
            
}
            if(
speed >= 201.0 && speed <= 210.0)
            {
                
real_drehzahl drehzahl 130
            
}
            else if(
speed >=211.0 && speed <= 220.0)
            {
                
real_drehzahl drehzahl 260
            
}
            else if(
speed >=221.0 && speed <= 230.0)
            {
                
real_drehzahl drehzahl 308
            
}
            else if(
speed >=231.0 && speed <= 240.0)
            {
                
real_drehzahl drehzahl 405
            
}
            else if(
speed >=241.0 && speed <= 250.0)
            {
                
real_drehzahl drehzahl 540
            
}
            else if(
speed >=251.0 && speed <= 260.0)
            {
                
real_drehzahl drehzahl 680
            
}
            else if(
speed >=261.0 && speed <= 270.0)
            {
                
real_drehzahl drehzahl 701
            
}
            else if(
speed >=271.0 && speed <= 280.0)
            {
                
real_drehzahl drehzahl 803
            
}
            else if(
speed >=281.0 && speed <= 290.0)
            {
                
real_drehzahl drehzahl 909
            
}
            else if(
speed >=291.0 && speed <= 300.0)
            {
                
real_drehzahl drehzahl 1050
            
}
        }
        else if( 
speed >= 301.0 && speed <= 400.0)
        {
            
gang 4
            drehzahl 
4000.0
            
if(g_y >= 5.0)
            {
                
real_drehzahl 4000.0 g_y
            
}
            else
            {
                
real_drehzahl 4000.0 g_y
            
}
            if(
speed >= 301.0 && speed <= 310.0)
            {
                
real_drehzahl drehzahl 130
            
}
            else if(
speed >=311.0 && speed <= 320.0)
            {
                
real_drehzahl drehzahl 260
            
}
            else if(
speed >=321.0 && speed <= 330.0)
            {
                
real_drehzahl drehzahl 308
            
}
            else if(
speed >=331.0 && speed <= 340.0)
            {
                
real_drehzahl drehzahl 405
            
}
            else if(
speed >=341.0 && speed <= 350.0)
            {
                
real_drehzahl drehzahl 540
            
}
            else if(
speed >=351.0 && speed <= 360.0)
            {
                
real_drehzahl drehzahl 680
            
}
            else if(
speed >=361.0 && speed <= 370.0)
            {
                
real_drehzahl drehzahl 701
            
}
            else if(
speed >=371.0 && speed <= 380.0)
            {
                
real_drehzahl drehzahl 803
            
}
            else if(
speed >=381.0 && speed <= 390.0)
            {
                
real_drehzahl drehzahl 909
            
}
            else if(
speed >=391.0 && speed <= 400.0)
            {
                
real_drehzahl drehzahl 1050
            
}
        }
        else if( 
speed >= 401.0 && speed <= 600.0)
        {
            
gang 5
            drehzahl 
5000.0
            
if(g_y >= 5.0)
            {
                
real_drehzahl 5000.0 g_y
            
}
            else
            {
                
real_drehzahl 5000.0 g_y
            
}
            if(
speed >= 401.0 && speed <= 420.0)
            {
                
real_drehzahl drehzahl 130
            
}
            else if(
speed >=421.0 && speed <= 440.0)
            {
                
real_drehzahl drehzahl 260
            
}
            else if(
speed >=441.0 && speed <= 460.0)
            {
                
real_drehzahl drehzahl 308
            
}
            else if(
speed >=461.0 && speed <= 480.0)
            {
                
real_drehzahl drehzahl 405
            
}
            else if(
speed >=481.0 && speed <= 500.0)
            {
                
real_drehzahl drehzahl 540
            
}
            else if(
speed >=501.0 && speed <= 520.0)
            {
                
real_drehzahl drehzahl 680
            
}
            else if(
speed >=521.0 && speed <= 540.0)
            {
                
real_drehzahl drehzahl 701
            
}
            else if(
speed >=541.0 && speed <= 560.0)
            {
                
real_drehzahl drehzahl 803
            
}
            else if(
speed >=561.0 && speed <= 480.0)
            {
                
real_drehzahl drehzahl 909
            
}
            else if(
speed >=581.0 && speed <= 600.0)
            {
                
real_drehzahl drehzahl 1050
            
}
        }
        else if( 
speed >= 601.0 )
        {
            
gang 6
            drehzahl 
6000.0
            
if(g_y >= 5.0)
            {
                
real_drehzahl 6000.0 g_y
            
}
            else
            {
                
real_drehzahl 6000.0 g_y
            
}
            if(
speed >= 601.0 && speed <= 620.0)
            {
                
real_drehzahl drehzahl 130
            
}
            else if(
speed >=621.0 && speed <= 640.0)
            {
                
real_drehzahl drehzahl 260
            
}
            else if(
speed >=641.0 && speed <= 660.0)
            {
                
real_drehzahl drehzahl 308
            
}
            else if(
speed >=661.0 && speed <= 680.0)
            {
                
real_drehzahl drehzahl 405
            
}
            else if(
speed >=681.0 && speed <= 700.0)
            {
                
real_drehzahl drehzahl 540
            
}
            else if(
speed >=701.0 && speed <= 720.0)
            {
                
real_drehzahl drehzahl 680
            
}
            else if(
speed >=721.0 && speed <= 740.0)
            {
                
real_drehzahl drehzahl 701
            
}
            else if(
speed >=741.0 && speed <= 760.0)
            {
                
real_drehzahl drehzahl 803
            
}
            else if(
speed >=761.0 && speed <= 780.0)
            {
                
real_drehzahl drehzahl 909
            
}
            else if(
speed >=781.0 && speed <= 800.0)
            {
                
real_drehzahl drehzahl 1050
            
}
            else if(
speed >= 801)
            {
                
real_drehzahl drehzahl 1203
            
}
            
            
        }
        
set_hudmessage(255255255, -1.00.700.0FREQ0.010.0)
        
speed speed 5.5
        ShowSyncHudMsg
(iSyncHud"%2.1f KMH^n%d^n %3.1f DREHZAHL"speedgang,real_drehzahl)
        
set_user_health(ifloatroundspeed ) + 1)
        
        
set_user_armor(igang); 
    }

the sound must be changed every sec. / by every speed up & in my code by every rehzahl up.
__________________

Last edited by One; 05-21-2009 at 20:38.
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 01:29.


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