Raised This Month: $12 Target: $400
 3% 

Knife Range


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AnimalMonster
Senior Member
Join Date: May 2020
Old 07-02-2020 , 04:50   Knife Range
Reply With Quote #1

Hey everyone,
I tried researching for a plugin that should help me make attack range at knifes but all i found was a plugin Knife API but i want to extract a code and bcs there's too much code there i can't figure out what should i extract. If anyone has a code for that i am glad to know it .
AnimalMonster is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-02-2020 , 11:40   Re: Knife Range
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=825597
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
AnimalMonster
Senior Member
Join Date: May 2020
Old 07-02-2020 , 13:14   Re: Knife Range
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
Nope , that s not what i mean, this code from hsk should help me
PHP Code:
#include <amxmodx>
#include <xs>
#include <fakemeta>

#define PLUGIN_NAME     "[Cs] Knife attack distance"
#define PLUGIN_VERSION    "1.0"
#define PLUGIN_AUTHOR    "HsK"

new g_knatt[33];

// Cvars
new cvar_knattdis_scvar_knattdis_b;

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);

    
cvar_knattdis_s register_cvar("amx_knattdis_s""-500");    // »´¤M¶ZÂ÷ (0=¤ŁĹÜ , Ąi§ď¤ń´¶łq CS ¤p¤M§óµuŞş¶ZÂ÷, -xĄiĄ´«á¤č)
    
cvar_knattdis_b register_cvar("amx_knattdis_b""500");    // *«¤M¶ZÂ÷ (0=¤ŁĹÜ , Ąi§ď¤ń´¶łq CS ¤p¤M§óµuŞş¶ZÂ÷, -xĄiĄ´«á¤č)

    
register_forward(FM_TraceLine"fw_TraceLine");
    
register_forward(FM_TraceHull"fw_TraceHull");
}

public 
fw_TraceLine(Float:vecStart[3], Float:vecEnd[3], conditionsidptr)
{
    if (!
is_user_alive(id)) return FMRES_IGNORED;

    static 
Float:flFractionwead_id;
    
wead_id get_user_weapon(id);

    if (
wead_id != CSW_KNIFE) return FMRES_IGNORED;

    static 
Float:vecAngles[3], Float:vecForward[3], attack_modFloat:Distance;
    
pev(idpev_v_anglevecAngles);
    
engfunc(EngFunc_MakeVectorsvecAngles);

    
global_get(glb_v_forwardvecForward);

    
attack_mod floatround((vecStart[0]-vecEnd[0])/vecForward[0]);

    if (
attack_mod == -48Distance get_pcvar_float(cvar_knattdis_s);
    else if (
attack_mod == -32Distance get_pcvar_float(cvar_knattdis_b);
    else
    {
        
g_knatt[id] = 0;
        return 
FMRES_IGNORED;
    }

    if (
Distance == 0) return FMRES_IGNORED;

    if ((
attack_mod == -48 && Distance 48.0) || (attack_mod == -32 && Distance 32.0))
        
g_knatt[id] = 2;
    else 
g_knatt[id] = 1;

    
get_tr2(ptrTR_flFractionflFraction);

    if ((
g_knatt[id] == && flFraction >= 1.0) || g_knatt[id] == 2)
    {
        
xs_vec_mul_scalar(vecForwardDistancevecForward);
        
xs_vec_add(vecStartvecForwardvecEnd);

        
engfunc(EngFunc_TraceLinevecStartvecEndconditionsidptr);
        return 
FMRES_SUPERCEDE;
    }
    else 
g_knatt[id] = 0;

    return 
FMRES_SUPERCEDE;
}

public 
fw_TraceHull(Float:vecStart[3], Float:vecEnd[3], conditionshullidptr)
{
    if (!
is_user_alive(id)) return FMRES_IGNORED;

    if (
g_knatt[id])
    {
        if (
g_knatt[id] == 1) return FMRES_IGNORED;
        else return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;

AnimalMonster is offline
Reply


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 20:57.


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