Raised This Month: $ Target: $400
 0% 

[ZP]extra classes adding leap cooldown


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Osviux
Senior Member
Join Date: May 2009
Location: Lithuania
Old 06-24-2009 , 13:18   [ZP]extra classes adding leap cooldown
Reply With Quote #1

Hello who could add a leap cooldown for 10 seconds to this plugin?

Code:
/*=========================================================================================                
/                
/                
/                    [ZP] Class : Long Jump Zombie
/                         (new zombie class)
/
/                            by Fry
/
/
/    Description :
/
/            So what can I say? This is usual Zombie class but this zombie will have long jump already. (without delay)
/
/    
/
/    Cvars :
/
/            zp_zclass_longjump_force "250"         - How far zombie will jump
/            zp_zclass_longjump_height "175"        - How heigh zombie will jump
/
/
/ 
/    Changelog :
/
/            04/10/2008 - v1.0 - First release
/            05/10/2008 - v1.1 - fixed bug that cause long jump to all zombie classes...
/            10/10/2008 - v1.2 - fixed again this bug from v1.1 
/            18/10/2008 - v1.2.1 - removed chat message.
/            12/11/2008 - v1.2.2 - changed plugin name.
/            15/11/2008 - v1.3 - added ability that this class can now use how high and how far can jump.
/            18/11/2008 - v1.3.2 - fixed that longjump was given to all zombie classes, removed fun module.
/            19/11/2008 - v1.3.3 - somehow forgat to remove fun module because using fakemeta instead.
/            19/11/2008 - v1.3.4 - possiblity that after few rounds long jump not working anymore so I put back fun module...
/            28/12/2008 - v1.3.6 - completely fixed long jump and removed fun module again.
/
*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

#define PLUGIN "[ZP] Class : Long Jump Zombie"
#define VERSION "1.3.6"
#define AUTHOR "The_Thing aka Fry"

new const zclass6_name[] = { "Vikrusis zombis" }
new const zclass6_info[] = { "HP+ Speed+ Gravity++ Knockback++" }
new const zclass6_model[] = { "Osviux_vikruolis" }
new const zclass6_clawmodel[] = {"v_knife_zombie.mdl" }
const zclass6_health = 1700
const zclass6_speed = 230
const Float:zclass6_gravity = 0.5
const Float:zclass6_knockback = 1.7

new g_zclass6_LongJump, g_LongJump_force, g_LongJump_height

public plugin_init()
{
    register_cvar("zp_zclass_long_jump_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
    g_LongJump_force = register_cvar("zp_zclass_longjump_force", "250")
    g_LongJump_height = register_cvar("zp_zclass_longjump_height", "175")
    
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
}

public plugin_precache()
{
 g_zclass6_LongJump = zp_register_zombie_class(zclass6_name, zclass6_info, zclass6_model, zclass6_clawmodel, zclass6_health, zclass6_speed, zclass6_gravity, zclass6_knockback)
}

public zp_user_infected_post(player, infector)
{
    if (zp_get_user_zombie_class(player) == g_zclass6_LongJump)
    {
        fm_give_item(player, "item_longjump")
    
        return PLUGIN_CONTINUE
        
    }
    return PLUGIN_CONTINUE
}

public fw_PlayerPreThink(id)
{
    if (!is_user_alive(id))
        return FMRES_IGNORED
        
    if (zp_get_user_zombie(id) != g_zclass6_LongJump)
        return PLUGIN_CONTINUE
        
    if (allowed_LongJump(id))
    {
        static Float:velocity[3]
        velocity_by_aim(id, get_pcvar_num(g_LongJump_force), velocity)
        
        velocity[2] = get_pcvar_float(g_LongJump_height)
        
        set_pev(id, pev_velocity, velocity)
    }
    return FMRES_IGNORED
}

allowed_LongJump(id)
{    
    if (zp_get_user_zombie(id) != g_zclass6_LongJump)
        return PLUGIN_CONTINUE
        
    if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
        return false
    
    static buttons
    buttons = pev(id, pev_button)
    
    if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
        return false
        
    return true
}

stock fm_get_speed(entity)
{
    static Float:velocity[3]
    pev(entity, pev_velocity, velocity)
    
    return floatround(vector_length(velocity));
}

stock fm_give_item(index, const item[]) 
{
 if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
        return 0;

    new ent = fm_create_entity(item);
    if (!pev_valid(ent))
        return 0;

    new Float:origin[3];
    pev(index, pev_origin, origin);
    set_pev(ent, pev_origin, origin);
    set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
    dllfunc(DLLFunc_Spawn, ent);

    new save = pev(ent, pev_solid);
    dllfunc(DLLFunc_Touch, ent, index);
    if (pev(ent, pev_solid) != save)
        return ent;

    engfunc(EngFunc_RemoveEntity, ent);

    return -1;
}

Last edited by Exolent[jNr]; 06-25-2009 at 15:04. Reason: Use [code] tags instead of [quote] tags when posting code.
Osviux is offline
Send a message via Skype™ to Osviux
 


Thread Tools
Display Modes

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 15:42.


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