Raised This Month: $51 Target: $400
 12% 

Solved Add "waiting time" to multijump


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oops9499
Junior Member
Join Date: Dec 2017
Old 03-06-2019 , 13:56   Add "waiting time" to multijump
Reply With Quote #1

Hi!
I've been having problems to achieve the following. I've got a zombie class that can jump twice in the air (multijump style). The problem is that if you use the mouse wheel to jump (as many players do), then the multijump thing gets bugged because it is like you did your second jump way too fast. So I tried to make it so you should wait some time to be able to use your next jump and avoid such issue (couldn't think of another way to fix it yet). I haven't found anything related to this... I'd appreciate any help.

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <zombieplague>

new _gJumpCount[33]
new 
cvar_multi_jump_amount
new g_zclass_jumper
new g_canjump[33]

new const 
zclass_name[] = {"Tight"
new const 
zclass_info[] = {"Doble Salto"
new const 
zclass_model[] = {"zombie_tight"
new const 
zclass_clawmodel[] = {"v_knife_tight.mdl"}
const 
zclass_health 1500 
const zclass_speed 200 
const Float:zclass_gravity 1.0 
const Float:zclass_knockback 1.0 

public plugin_init() 
{
    
register_plugin("[ZP] Zombie Class: Jumper""1.0""zmd94")
    
RegisterHam(Ham_Player_Jump"player""fw_PlayerJump"0)
    
    
cvar_multi_jump_amount register_cvar("zp_multi_jump_amount""1")
}

public 
plugin_precache()
{
    
g_zclass_jumper zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}

public 
fw_PlayerJump(id
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_nemesis(id))
    {
        return 
HAM_IGNORED
    
}  
    if(
zp_get_user_zombie_class(id) == g_zclass_jumper
    {
        new 
Flags pev(idpev_flags)
        
        if( 
Flags FL_WATERJUMP || pev(idpev_waterlevel) >= || !(get_pdata_int(id246) & IN_JUMP) )
        {
            return 
HAM_IGNORED
        
}
        if(
Flags FL_ONGROUND
        {
            
_gJumpCount[id] = 0
            
return HAM_IGNORED
        
}
        if (!
_gJumpCount[id]) // this is what I added
            
set_task(2.0"can_jump"id)
        
        if(
get_pcvar_num(cvar_multi_jump_amount)) 
        {
            if( 
get_pdata_float(id251) < 500 && ++_gJumpCount[id] <= get_pcvar_num(cvar_multi_jump_amount)) 
            {
                if (
g_canjump[id]) // and this check
                
{                
                    new 
Float:fVelocity[3]
                    
pev(idpev_velocityfVelocity)
                    
fVelocity[2] = 268.328157
                    set_pev
(idpev_velocityfVelocity)
                    
                    
g_canjump[id] = false // and this
                    
                    
return HAM_HANDLED
                
}    
            }
        }
    }
    return 
HAM_IGNORED
}
public 
can_jump(idg_canjump[id] = true 

Last edited by Oops9499; 03-06-2019 at 22:46.
Oops9499 is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 03-06-2019 , 16:01   Re: Add "waiting time" to multijump
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=312395 there you can find the fix.
__________________
eat1k is offline
Oops9499
Junior Member
Join Date: Dec 2017
Old 03-06-2019 , 22:45   Re: Add "waiting time" to multijump
Reply With Quote #3

Quote:
Originally Posted by eat1k View Post
Finally I could fix it. Thanks a lot for your help!
Oops9499 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-08-2019 , 02:13   Re: Add "waiting time" to multijump
Reply With Quote #4

The fix is easy change this

>>fVelocity[2] = 268.328157 into fVelocity[2] += 268.328157

no need to add delaying time.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 02:49.


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