AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP]extra classes adding leap cooldown (https://forums.alliedmods.net/showthread.php?t=95527)

Osviux 06-24-2009 13:18

[ZP]extra classes adding leap cooldown
 
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;
}


xPaw 06-24-2009 13:26

Re: [ZP]extra classes adding leap cooldown
 
Indent code for start.

Osviux 06-24-2009 13:50

Re: [ZP]extra classes adding leap cooldown
 
what do you mean? :(

TitANious 06-24-2009 13:51

Re: [ZP]extra classes adding leap cooldown
 
Use tabs, the thing on your keyboard with keys in 2 directions

Osviux 06-24-2009 14:26

Re: [ZP]extra classes adding leap cooldown
 
i wrote the plugin code what else do you need?

TitANious 06-24-2009 14:27

Re: [ZP]extra classes adding leap cooldown
 
Quote:

/ by Fry

Osviux 06-24-2009 15:35

Re: [ZP]extra classes adding leap cooldown
 
by fry soo? This is not helping i am just asking for someone to add a leap cooldown and you are writing bullshit

TitANious 06-24-2009 15:47

Re: [ZP]extra classes adding leap cooldown
 
Quote:

Originally Posted by Osviux (Post 856054)
i wrote the plugin code what else do you need?

You said you wrote the plugin. I said it was by Fry

Osviux 06-25-2009 01:54

Re: [ZP]extra classes adding leap cooldown
 
i didnt make this plugin ;DDD i said that i wrote the code of this plugin here :D


All times are GMT -4. The time now is 15:42.

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