Raised This Month: $ Target: $400
 0% 

Need Some Help I Got A problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 08-11-2009 , 09:32   Need Some Help I Got A problem
Reply With Quote #1

I Made A plugin unlock_baseballbat for gunxpmod first time compiled i bought it model was baseball bat but when hit it zombie doesn't knock back when zombie hited me i get knock back help pls :/ Its For Zombie Swarm Humans Can Only use This Baseball bat can some Correct this ?

Code:

Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <gunxpmod>
#include <xs>

new PLUGIN_NAME[]     = "Unlock : BaseBall Bat"
new PLUGIN_AUTHOR[]     = "DoviuX"
new PLUGIN_VERSION[]     = "1.0"

new g_pCvarKnockBack

new const BAT_MDL[] =     "models/UmbrellaSwarm/v_BaseBallBat.mdl";

new damage_baseballbat
new g_maxplayers
new bool:g_BASEBALLBAT[33] 

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    register_gxm_item("BaseBall Bat", "Big KnockBack", 80)

    g_pCvarKnockBack = register_cvar("baseball_knockback", "15")

    damage_baseballbat = register_cvar("gxm_damage_bat","2.0"); // damage multiplier
    register_event("CurWeapon",    "Event_CurWeaponbat", "be", "1=1")

    RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage", 1)
    RegisterHam(Ham_TakeDamage, "player", "Ham_Damagebat");

    g_maxplayers = get_maxplayers();
}
public plugin_precache()  
{
    engfunc(EngFunc_PrecacheModel, BAT_MDL);
}
public gxm_item_enabled(id) {
    g_BASEBALLBAT[id] = true
}
public client_connect(id) 
{
    g_BASEBALLBAT[id] = false
}
public Ham_DamageEL(id, inflictor, attacker, Float:damage, damagebits) 
{
    if ( !(1 <= attacker <= g_maxplayers) || !g_BASEBALLBAT[attacker])
            return HAM_IGNORED; 

    new weapon2 = get_user_weapon(attacker, _, _);
    if( weapon2 == CSW_KNIFE)
    {
        SetHamParamFloat(4, damage * get_pcvar_float(damage_baseballbat)); //Ellt damage
        return HAM_HANDLED;
    }
    return HAM_IGNORED;
}
public Event_CurWeaponbat(id) 
{
    if (!g_BASEBALLBAT[id])
    return PLUGIN_CONTINUE;

    new Gun = read_data(2) 
    
    if( Gun == CSW_KNIFE)
    {
        set_pev(id, pev_viewmodel2, BAT_MDL)
    }
    return PLUGIN_CONTINUE;
}
public Player_TakeDamage(id, idinflictor, idattacker, Float:flDamage, damagebits)
{
    if(    !idattacker
    ||    id == idattacker
    ||    idinflictor != idattacker//    )
    ||    get_user_weapon(idattacker) != g_BASEBALLBAT    )
    {
        return
    }

    new Float:fDir[3], Float:fOrigin[3], Float:fVelocity[3]

    pev(id, pev_origin, fDir)
    pev(idattacker, pev_origin, fOrigin)

    xs_vec_sub(fDir, fOrigin, fDir)
    xs_vec_normalize(fDir, fDir)

    flDamage *= get_pcvar_num(g_pCvarKnockBack)
    if( flDamage > 1500.0 )
        flDamage = 1500.0

    pev(id, pev_velocity, fVelocity)
    xs_vec_mul_scalar(fDir, flDamage, fDir)
    xs_vec_add(fVelocity, fDir, fVelocity)
    set_pev(id, pev_velocity, fVelocity)
}

Last edited by DoviuX; 08-11-2009 at 09:36.
DoviuX is offline
Send a message via Skype™ to DoviuX
 



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:28.


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