Raised This Month: $ Target: $400
 0% 

TraceLine


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-15-2004 , 20:09   TraceLine
Reply With Quote #1

Ok having a bit of difficulty in understanding traceline.
I need to get the user im looking at while firing and the hitzone im firing at.

Code:
register_forward(FM_TraceLine, "traceline",1)

Code:
public traceline(Float:v1[3], Float:v2[3], noMonsters, pentToSkip, Trace:ptr) {     new entity1 = pentToSkip;     new entity2 = get_tr(ptr,TR_pHit); // victim     new hitzone = (1<<get_tr(ptr,TR_iHitgroup));     if(is_user_alive(entity1) && pev(entity1,pev_button)&IN_ATTACK && is_user_alive(entity2) && hitzone > (1<<0) && entity1 != entity2)     {
Freecode is offline
BAILOPAN
Join Date: Jan 2004
Old 09-15-2004 , 20:17  
Reply With Quote #2

Code:
public traceline(Float:v1[3], Float:v2[3], noMonsters, pentToSkip) {     new entity1 = pentToSkip;     new entity2 = get_tr(TR_pHit); // victim     new hitzone = (1<<get_tr(ptr,TR_iHitgroup));     if(is_user_alive(entity1) && pev(entity1,pev_button)&IN_ATTACK && is_user_alive(entity2) && hitzone > (1<<0) && entity1 != entity2)     {

mahnsawce has changed the function to use a global traceresult. Use this code instead.
__________________
egg
BAILOPAN is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-15-2004 , 20:25  
Reply With Quote #3

tnx alot
Freecode is offline
Trp. Jed
Member
Join Date: Aug 2004
Old 09-15-2004 , 23:25  
Reply With Quote #4

Actually, sorry to add to your thread but what does traceline do exactly? Im interested in finding a function that can non-visually trace a line from a given coord/angle and measure the distance before it hits a surface and I didnt know if traceline could do this.
Trp. Jed is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-16-2004 , 00:14  
Reply With Quote #5

TraceLine returns 2 positions the starting point of the trace and the ending point of a trace. Its a forward so it returns some stuff in it. Like if your looking at a player u can find the index of a player and what hitzone your aiming at. And some other stuff.
Freecode is offline
Trp. Jed
Member
Join Date: Aug 2004
Old 09-16-2004 , 00:53  
Reply With Quote #6

Ah, so its not actually possible to initiate a trace from withing AMXX?
Trp. Jed is offline
BAILOPAN
Join Date: Jan 2004
Old 09-16-2004 , 01:35  
Reply With Quote #7

it's possible with fakemeta module:

engfunc(EngFunc_TraceLine ...
<get/set>_tr()

see fakemeta_const and fakemeta includes
__________________
egg
BAILOPAN is offline
Trp. Jed
Member
Join Date: Aug 2004
Old 09-16-2004 , 05:03  
Reply With Quote #8

Hmm I'll take a look. I did look earlier but it was a bit spartan.
Trp. Jed 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 17:27.


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