Raised This Month: $ Target: $400
 0% 

leap dont work


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 11-08-2009 , 14:48   Re: leap dont work
Reply With Quote #3

Quote:
Originally Posted by Akatsuki View Post
Hey when i becoume a hunter leap dont work its on biohazard
Please post code in the php and /php tags

All i changed was the tags no code... its easier to read.


PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <biohazard>

#define PLUGIN "bio_hunterzom"
#define VERSION "1.1"
#define AUTHOR "Akatsuki"
#define STR_T 32
#define MAX_PLAYERS 32
#define D_ZOMBIE_NAME "Hunter"
#define D_ZOMBIE_DESC "Can do leap"

new bool:g_hasLeap[33]
new 
g_class
new Float:g_last_LongJump_time[33]
new 
g_LongJump_forceg_LongJump_heightg_LongJump_cooldown


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
is_biomod_active() ? plugin_init2() : pause("ad")
}

public 
plugin_init2() 
{
    
g_class register_class(D_ZOMBIE_NAMED_ZOMBIE_DESC)
    if(
g_class != -1)
    {
    
set_class_data(g_classDATA_HEALTH260.0)
    
set_class_data(g_classDATA_SPEED350.0)
    
set_class_data(g_classDATA_REGENDLY0.05)
    }
        
    
g_LongJump_force register_cvar("bio_longjump_force""550")
    
g_LongJump_height register_cvar("bio_longjump_height""255")
    
g_LongJump_cooldown register_cvar("bio_longjump_cooldown""5.0")
    
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")

}

public 
event_infect(victimattacker)
{
    if (
g_class != get_user_class(victim))
        
g_hasLeap[victim] = true
        
    
return PLUGIN_CONTINUE
}

    
public 
fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
        
    
if (g_class != get_user_class(id))
    {
        
g_hasLeap[id] = false
    
}
    
    if (
allow_LongJump(id))
    {
        static 
Float:velocity[3]
        
velocity_by_aim(idget_pcvar_num(g_LongJump_force), velocity)
        
        
velocity[2] = get_pcvar_float(g_LongJump_height)
        
        
set_pev(idpev_velocityvelocity)
        
        
g_last_LongJump_time[id] = get_gametime()
    }
    
    return 
FMRES_IGNORED
}

// Check if the player can longjump
allow_LongJump(id)
{
    if (
g_class != get_user_class(id))
        return 
false
    
    
if (!(pev(idpev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
        return 
false
    
    
static buttons
    buttons 
pev(idpev_button)
    
    if (!
is_user_bot(id) && (!(buttons IN_JUMP) || !(buttons IN_DUCK)))
        return 
false
    
    
if (get_gametime() - g_last_LongJump_time[id] < get_pcvar_float(g_LongJump_cooldown))
        return 
false
    
    
return true
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity))

Doc-Holiday 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 17:47.


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