Raised This Month: $32 Target: $400
 8% 

Knife Distance by SchlumPF


Post New Thread Reply   
 
Thread Tools Display Modes
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 05-11-2009 , 16:28   Re: Knife Distance by SchlumPF
Reply With Quote #11

Quote:
Originally Posted by arkshine View Post
Yeah. When you look the HLSDK, it will give you tr.vecEndPos, whatever tracehull or traceline, just the last trace, that's why you don't need to recalculate. I've checked, you get the same result.
are you sure that it works? i recognized that my fwd name says its pre although i registered a post hook, unfortunately the trace_hull and the following trace_lines (if trace_hull.pHit == 0) did not happen in pre, in post i get distances of 200+ if i use glb_trace_endpos
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-11-2009 , 17:05   Re: Knife Distance by SchlumPF
Reply With Quote #12

Arg. Actually I'm wrong. I mean I have read too fastly your code.

Using TR_vecEndPos from TraceAttack is perfectly fine and it's the last trace. So glb_trace_endpos is stupid.

Now, what I don't understand, why are you recalculated when there is not hitgroup defined ?
Arkshine is offline
lowled
Senior Member
Join Date: Sep 2007
Old 05-11-2009 , 18:58   Re: Knife Distance by SchlumPF
Reply With Quote #13

hi there, is possible to make this plug running with "throwing knife" (http://forums.alliedmods.net/showpost.php?p=824022&postcount=185 )

ty !!

its possible to have chat color in function of distance too ^^
__________________
lowled is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 05-12-2009 , 00:43   Re: Knife Distance by SchlumPF
Reply With Quote #14

Quote:
Originally Posted by arkshine View Post
Arg. Actually I'm wrong. I mean I have read too fastly your code.

Using TR_vecEndPos from TraceAttack is perfectly fine and it's the last trace. So glb_trace_endpos is stupid.

Now, what I don't understand, why are you recalculated when there is not hitgroup defined ?
cuz then the traceline failed and the hook seems to be called after the very first traceline the engine does (=result sometimes wrong). xPaw and me figured that out while testing.
thats also, what makes this interesting for me and why i tried to create this plugin and even released it (never released a plugin here so far, most plugin i found usefull were posted at xtreme-jumps.eu)

Quote:
Originally Posted by lowled View Post
hi there, is possible to make this plug running with "throwing knife" (http://forums.alliedmods.net/showpost.php?p=824022&postcount=185 )

ty !!

its possible to have chat color in function of distance too ^^
i may try to fix my plugin so both can run together but im not sure
the color message will be added for attacks which have a distance of range-2 (stab = 30, slash = 46) to avoid spamming the chat. else youll see some deathmsg or sth, ill see ^^
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
dorin2oo7
Senior Member
Join Date: Jun 2008
Location: Sibiu, Romania
Old 05-12-2009 , 01:13   Re: Knife Distance by SchlumPF
Reply With Quote #15

Awesome

+karma

How far will scripting go?
__________________
dorin2oo7 is offline
DeepBlueSea
Junior Member
Join Date: Jul 2007
Old 05-12-2009 , 04:48   Re: Knife Distance by SchlumPF
Reply With Quote #16

Well good job in comprehend and reconstruct the hit-trace.
But i still for the life of me can't understand why you just don't TAKE the values the engine already calculated.
This is what i do:
On attack the engine conducts a hit-trace, resulting in values. I simply TAKE these values and display.
This is what you do:
On PreAttack you emulate the whole hit-trace and after returning from prehook, the engine conducts its own hit-trace AGAIN. What a redundancy, don't you think?

greets,
neotracer

//x-post xtreme-jumps.eu
DeepBlueSea is offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 05-12-2009 , 05:12   Re: Knife Distance by SchlumPF
Reply With Quote #17

#include <colorchat> where...
Fr33m@n is offline
CuLLi
BANNED
Join Date: Apr 2009
Location: Romania (piratebay) C
Old 05-12-2009 , 08:49   Re: Knife Distance by SchlumPF
Reply With Quote #18

deapseablue's KD plugin is better and more precise ;)

1 suggestion: show the distance in meters next to the units

Last edited by CuLLi; 05-12-2009 at 08:58.
CuLLi is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 05-12-2009 , 14:44   Re: Knife Distance by SchlumPF
Reply With Quote #19

Quote:
Originally Posted by DeepBlueSea View Post
Well good job in comprehend and reconstruct the hit-trace.
But i still for the life of me can't understand why you just don't TAKE the values the engine already calculated.
This is what i do:
On attack the engine conducts a hit-trace, resulting in values. I simply TAKE these values and display.
This is what you do:
On PreAttack you emulate the whole hit-trace and after returning from prehook, the engine conducts its own hit-trace AGAIN. What a redundancy, don't you think?

greets,
neotracer

//x-post xtreme-jumps.eu
ofc i dont like that way either but i tried a lot way which would have been a lot better but they have always the same bug, sometimes i hit a ent but the distance == attack range

just look at this
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#pragma semicolon 1

new g_bAlive[33];
new 
g_szNickname[33][32];

public 
plugin_init( )
{
    
register_plugin"Knife Distance""0.1""SchlumPF" );
    
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_knife""hamKnifePrimaryAttack_Post");    
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_knife""hamKnifeSecondaryAttack_Post");    
        
    
RegisterHamHam_Killed"player""hamKilledPlayer_Post");
    
RegisterHamHam_Spawn"player""hamSpawnPlayer_Post");
}

public 
hamKnifePrimaryAttack_Postent )
{
    static 
attacker;
    
attacker peventpev_owner );
    
    static 
victim;
    
victim global_getglb_trace_ent );
    
    static 
Float:origin[3], Float:view_ofs[3], Float:vecSrc[3];
    
pevattackerpev_originorigin );
    
pevattackerpev_view_ofsview_ofs );
    
xs_vec_addoriginview_ofsvecSrc );
    
    static 
Float:vecEndPos[3];
    
global_getglb_trace_endposvecEndPos );
    
    
client_print0print_chat"slashed %i %.6f"victimget_distance_fvecSrcvecEndPos ) );
}

public 
hamKnifeSecondaryAttack_Postent )
{
    static 
attacker;
    
attacker peventpev_owner );
    
    static 
victim;
    
victim global_getglb_trace_ent );
    
    static 
Float:origin[3], Float:view_ofs[3], Float:vecSrc[3];
    
pevattackerpev_originorigin );
    
pevattackerpev_view_ofsview_ofs );
    
xs_vec_addoriginview_ofsvecSrc );
    
    static 
Float:vecEndPos[3];
    
global_getglb_trace_endposvecEndPos );
    
    
client_print0print_chat"stabbed %i %.6f"victimget_distance_fvecSrcvecEndPos ) );
}

public 
client_connectplr )
{
    
get_user_nameplrg_szNickname[plr], 31 );
}

public 
client_infochangedplr )
{
    static 
curName[32], newName[32];
    
get_user_nameplrcurName31 );
    
get_user_infoplr"name"newName31 );

    if( !
equalnewNamecurName ) )
    {
               
copyg_szNickname[plr], 31newName );
    }
}

public 
hamKilledPlayer_Postplr )
{
    
g_bAlive[plr] = false;
}

public 
hamSpawnPlayer_Postplr )
{
    if( 
is_user_aliveplr ) && get_user_teamplr ) )
    {
        
g_bAlive[plr] = true;
    }

__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
DeepBlueSea
Junior Member
Join Date: Jul 2007
Old 05-12-2009 , 16:09   Re: Knife Distance by SchlumPF
Reply With Quote #20

This way you are catching a trace that doesn't necessarily have anything to do with the real hit-trace.

Quote:
distance == attack range
This would be the failed TraceLine Call you are getting, when in reality already TraceHull is used.

All you need is FakeMeta (hook TraceLine and TraceHull) and filter out all non related traces. It's pretty easy actually. You can look at every single trace and just have to think about all criterias that the trace has to match to filter the right ones out.
DeepBlueSea is offline
Reply



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


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