This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Duration & Cooldown


Post New Thread Reply   
 
Thread Tools Display Modes
Hn.S Xmix
Member
Join Date: May 2021
Old 05-05-2024 , 16:46   Re: Duration & Cooldown
Reply With Quote #11

Quote:
Originally Posted by v120kaaimcfg View Post
So you want the player to be able to climb for cvar time(10) seconds, the climbing will activate only when you're near a wall and if you release the climbing button/s it goes automatically on cooldown, instead of letting them climb again until the time runs out?
If I haven't understood correctly, correct me and a video would come in handy (probably).
Correct!!
Hn.S Xmix is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-05-2024 , 19:46   Re: Duration & Cooldown
Reply With Quote #12

Quote:
Originally Posted by Hn.S Xmix View Post
Correct!!
Here

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

new const IN_JUMP_DUCK IN_JUMP|IN_DUCK
new g_Climbing[33], Float:g_lasthudtime[33]

new 
Float:g_lastusetime[33]
new 
Float:g_nextuse[33]
new 
Float:g_wallorigin[33][3]
new 
cvar_zp_wallclimbcvar_zp_wallclimb_nemesiscvar_zp_wallclimb_survivorcvar_climb_cooldowncvar_climb_duration
new g_zclass_climb
  
// Climb Zombie Atributes
new const zclass_name[] = { "Climb Zombie" // name
new const zclass_info[] = { "HP-- Speed+ Jump+ Knockback++" // description
new const zclass_model[] = { "sirenzz" // model
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" // claw model
new const zclass_health 1200 // health
new const zclass_speed 220 // speed
new const Float:zclass_gravity 0.8 // gravity
new const Float:zclass_knockback 1.5 // knockback

public plugin_init() 
{
    
register_plugin("[ZP] Wallclimb ""1.0""WallClimb by Python1320/Cheap_Suit, Plagued by Dabbi")
    
register_forward(FM_Touch,         "fwd_touch")
    
register_forward(FM_PlayerPreThink,     "fwd_playerprethink")
    
RegisterHam(Ham_Killed"player""FwdPlayerKilled"1)

    
cvar_zp_wallclimb register_cvar("zp_wallclimb""1")
    
cvar_zp_wallclimb_survivor register_cvar("zp_wallclimb_survivor""0")
    
cvar_zp_wallclimb_nemesis register_cvar("zp_wallclimb_nemesis""0")
    
cvar_climb_cooldown register_cvar("zp_wallclimb_cooldown""10.0"
    
cvar_climb_duration register_cvar("zp_wallclimb_duration""10.0"
}

public 
plugin_precache()
{
    
g_zclass_climb zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}

public 
FwdPlayerKilled(id)
{
    
ResetPlayerData(id)
}

public 
client_putinserver(id)
{
    
ResetPlayerData(id)
}

public 
fwd_touch(idworld)
{
    if(
id && id 33)
    {
        if(~
pev(idpev_flags) & FL_ONGROUND)
        {
            new 
classname[33]
            
pev(worldpev_classnameclassname32)

            if(
equal(classname"worldspawn") || equal(classname"func_wall") || equal(classname"func_breakable"))
            {
                
pev(idpev_origing_wallorigin[id])
            }
        }
        else
        {
            
g_wallorigin[id][2] = 99999.9
        
}
    }
}

public 
fwd_playerprethink(id
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_climb || (zp_is_survivor_round() && get_pcvar_num(cvar_zp_wallclimb_survivor) == 0) || (zp_is_nemesis_round() && get_pcvar_num(cvar_zp_wallclimb_nemesis) == 0))
    {
        return 
FMRES_IGNORED
    
}

    static 
Float:origin[3]
    
pev(idpev_originorigin)
    new 
Float:gametime get_gametime()
    new 
Float:cooldown get_pcvar_float(cvar_climb_cooldown)

    if(
gametime >= g_nextuse[id] && gametime 1.0 g_lasthudtime[id])
    {
        
set_hudmessage(255255255, -1.00.2000.01.00.00.1, -1)
        
show_hudmessage(id"[WallClimb]^nReady to use")
        
g_lasthudtime[id] = gametime
    
}

    if(
get_distance_f(origing_wallorigin[id]) > 25.0)
    {
        if(
g_Climbing[id])
        {
            
g_Climbing[id] = 0
            g_lastusetime
[id] = gametime
            g_nextuse
[id] = gametime cooldown
            set_hudmessage
(255255255, -1.00.2000.00.10.01.0, -1)
            
show_hudmessage(id"[WallClimb]^nCooldown^n> %.1f <"g_nextuse[id] - gametime)
        }
        return 
FMRES_IGNORED
    
}

    new 
button pev(idpev_button)

    if((
get_pcvar_num(cvar_zp_wallclimb) == && button IN_USE) || (get_pcvar_num(cvar_zp_wallclimb) == && button IN_JUMP_DUCK)) // +use OR +jump & +duck = climb
    
{
        if(
gametime >= g_nextuse[id])
        {
            new 
Float:duration get_pcvar_float(cvar_climb_duration)
            
g_nextuse[id] = gametime cooldown duration
            g_lastusetime
[id] = gametime duration
        
}
        else
        {
            if(
gametime >= g_lastusetime[id])
            {
                if(
gametime 0.05 g_lasthudtime[id])
                {
                    
set_hudmessage(255255255, -1.00.2000.00.10.00.0, -1)
                    
show_hudmessage(id"[WallClimb]^nCooldown^n> %.1f <"g_nextuse[id] - gametime)
                    
g_lasthudtime[id] = gametime
                
}
            }
            else
            {
                if(
button IN_FORWARD)
                {
                    static 
Float:velocity[3]
                    
velocity_by_aim(id120velocity)
                    
set_pev(idpev_velocityvelocity)
                    
g_Climbing[id] = 1
                
}
                else if(
button IN_BACK)
                {
                    static 
Float:velocity[3]
                    
velocity_by_aim(id, -120velocity)
                    
set_pev(idpev_velocityvelocity)
                    
g_Climbing[id] = 1
                
}
                if(
gametime 0.05 g_lasthudtime[id])
                {
                    
set_hudmessage(255255255, -1.00.2000.00.10.00.0, -1)
                    
show_hudmessage(id"[WallClimb]^nClimb time left^n> %.1f <"g_lastusetime[id] - gametime)
                    
g_lasthudtime[id] = gametime
                
}
            }
        }
    }
    else if(
g_Climbing[id])
    {
        
g_Climbing[id] = 0
        g_lastusetime
[id] = gametime
        g_nextuse
[id] = gametime cooldown
        set_hudmessage
(255255255, -1.00.2000.00.10.01.0, -1)
        
show_hudmessage(id"[WallClimb]^nCooldown^n> %.1f <"g_nextuse[id] - gametime)
    }

    return 
FMRES_IGNORED
}  

ResetPlayerData(id)
{
    
g_lastusetime[id] = 0.0
    g_nextuse
[id] = 0.0
    g_Climbing
[id] = 0
    g_wallorigin
[id][2] = 99999.9
    g_lasthudtime
[id] = 0.0

v120kaaimcfg is offline
Hn.S Xmix
Member
Join Date: May 2021
Old 05-05-2024 , 20:09   Re: Duration & Cooldown
Reply With Quote #13

@v120kaaimcfg You are absolutely a life saver you just made my whole month, thank you for your amazing help i would like to know who you are so when i count my blessings i count you twice. God bless you men
Hn.S Xmix 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 18:48.


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