Raised This Month: $ Target: $400
 0% 

+use Button | 3Sec Boost | 20 Sec Cooldown.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ImXinR
Member
Join Date: Dec 2010
Old 06-27-2011 , 03:45   +use Button | 3Sec Boost | 20 Sec Cooldown.
Reply With Quote #1

How Do I set the user like , By press +use (e button) They can boost for 3 seconds & a 20 second cool down . They just have to press E once , Then they will be able to boost for 3 sec.
I've tried using & reading the method here > [TUT] Using Button Constant but still doesn't work . Its either it doesn't work or the player the moment on spawn , keep walking to the front . Also , I've already read all post / thread regarding to button , but still it didn't helped me in any .

EDIT ;
Can someone just help me edit this code below to the button +use to speed instead of shift key ? But I still need the 3 sec boost & 20 second cool down.
PHP Code:
#include <amxmodx>
#include <fakemeta>

new boolg_sprint[33]
new 
cvar_speed

public plugin_init()
{
    
register_plugin("Sprint""0.1""Mini_Midget");
    
cvar_speed register_cvar("sprint_speed""400");
    
register_forwardFM_CmdStart"FMCmdStart" );
    
register_forwardFM_PlayerPreThink"FMPreThink" );
    
register_forward(FM_UpdateClientData"FMUpdateClientData"1)
    
}

public 
client_putinserver(id)
{
    
g_sprint[id] = false
}

public 
FMCmdStartiduc_handlerandseed )
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
        
    
new Float:fmoveFloat:smove;
    
get_uc(uc_handleUC_ForwardMovefmove);
    
get_uc(uc_handleUC_SideMovesmove );
    
    new 
Float:maxspeed;
    
pev(idpev_maxspeedmaxspeed);
    new 
Float:walkspeed = (maxspeed 0.52); 
    
fmove floatabsfmove );
    
smove floatabssmove );
    
    if(
fmove <= walkspeed && smove <= walkspeed && !(fmove == 0.0 && smove == 0.0))
    { 
        
//client_print( id, print_center, "WALKING" );
        
g_sprint[id] = true
    
}
    else
    {
        
//client_print( id, print_center, "RUNNING" );    
        
g_sprint[id] = false
    
}
    
    return 
FMRES_IGNORED
}

public 
FMPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
static flag flag pev(idpev_flags)
    static 
button button pev(idpev_button)
    
    if ( !(
flag FL_ONGROUND) || (flag FL_DUCKING) || !(button IN_FORWARD) ) //Block not on ground or ducking or left, back, right movement keys
        
return FMRES_IGNORED
        
    
static Floatsprinting[3], Floatnormal[3]
    static 
speed speed get_pcvar_num(cvar_speed)
    
    
velocity_by_aim(idspeedsprinting//Speed
    
pev(idpev_velocitynormal)
    
sprinting[2] = normal[2]
    
    if (
g_sprint[id] == true//Walking
    
{
        
set_pev(idpev_velocitysprinting//Set the speed of sprinting
        
set_pev(idpev_buttonpev(id,pev_button) & ~IN_ATTACK);
        
set_pev(idpev_buttonpev(id,pev_button) & ~IN_ATTACK2 );    
        
engclient_cmd(id"weapon_knife")
        
//set_pev(id, pev_viewmodel2, "")
    
}
    else if (
g_sprint[id] == false//Running
    
{
        
set_pev(idpev_velocitynormal)  //Return to normal speed
    
}
    
    return 
FMRES_IGNORED
}

public 
FMUpdateClientData(idsendweaponscd_handle )
{
    if ( !
is_user_alive(id) || !g_sprint[id])
        return 
FMRES_IGNORED;

    
set_cd(cd_handleCD_ID0);        
        
    return 
FMRES_HANDLED;

Get From Here
__________________
Sometimes , Life Sucks .. Don't You Agree? But ,
Listening To Music Make Us Feel Better

Last edited by ImXinR; 06-27-2011 at 04:37.
ImXinR is offline
 



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 23:29.


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