AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   TraceLine (https://forums.alliedmods.net/showthread.php?t=5895)

Freecode 09-15-2004 20:09

TraceLine
 
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)     {

BAILOPAN 09-15-2004 20:17

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.

Freecode 09-15-2004 20:25

tnx alot :)

Trp. Jed 09-15-2004 23:25

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.

Freecode 09-16-2004 00:14

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.

Trp. Jed 09-16-2004 00:53

Ah, so its not actually possible to initiate a trace from withing AMXX?

BAILOPAN 09-16-2004 01:35

it's possible with fakemeta module:

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

see fakemeta_const and fakemeta includes

Trp. Jed 09-16-2004 05:03

Hmm I'll take a look. I did look earlier but it was a bit spartan.


All times are GMT -4. The time now is 17:27.

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