AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Double Jump Not Working (https://forums.alliedmods.net/showthread.php?t=236785)

proffs 03-11-2014 05:17

Double Jump Not Working
 
I want to have Double Jump only when I start a "Game" on the server.

PHP Code:

public client_putinserver(id)
{
     if( 
GAME_FURIEN == g_iCurrentGame )
     {
        
g_doublejump[id] = true
     
}
}

public 
fw_PlayerPreThink(id)
{
    if (
g_iCurrentGame != GAME_FURIEN)
        return 
FMRES_IGNORED
    
if(!is_user_alive(id) || !g_doublejump[id]) return FMRES_IGNORED
    
new nbut pev(id,pev_button);
    new 
obut pev(id,pev_oldbuttons);
    if((
nbut IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut IN_JUMP))
    {
        if(
jumpnum[id] < 1)
        {
            
dojump[id] = true;
            
jumpnum[id]++;
            return 
FMRES_IGNORED
        
}
    }
    if((
nbut IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
    {
        
jumpnum[id] = 0;
        return 
FMRES_IGNORED
    
}
    return 
FMRES_IGNORED
}

public 
fw_PlayerPostThink(id)
{
    if (
g_iCurrentGame != GAME_FURIEN)
        return 
FMRES_IGNORED
    
if(!is_user_alive(id) || !g_doublejump[id]) return FMRES_IGNORED
    
if(dojump[id] == true)
    {
        new 
Float:velocity[3];
        
pev(id,pev_velocity,velocity);
        
velocity[2] = random_float(265.0,285.0);
        
set_pev(id,pev_velocity,velocity)
        
dojump[id] = false
        
return FMRES_IGNORED
    
}
    return 
FMRES_IGNORED


Doesn't work, You can only jump 1 time.

I took it from this: https://forums.alliedmods.net/showthread.php?t=90430


All times are GMT -4. The time now is 05:58.

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