Raised This Month: $ Target: $400
 0% 

FakeMeta Trace_Line help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 09-24-2007 , 19:54   FakeMeta Trace_Line help
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_forward(FM_PlayerPreThink"forward_prethink")
}

public 
forward_prethink(id)
{
    if(
pevidpev_button ) & IN_USE && !(pevidpev_oldbuttons ) & IN_USE ))
    {
        new 
Index,Body
        get_user_aiming
(id,Index,Body,200)
        
        if(!
Index || !is_user_alive(Index))
            return;
        new 
Float:v1[3]
        new 
Float:v2[3]
        new 
monster
        engfunc
(EngFunc_TraceLine,v1,v2,Index,monster)
        
client_print(idprint_chat"[AMXX TEST] V1: %f-%f-%f V2:%f-%f-%f M:%s"v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], monster)
    }

The line is always 0.000000 0.0000000 0.00000 is alwayas the results. Why?

Note: This is my first Try at this. I followed what was seen in the file.
Code:
EngFunc_TraceLine,					// void )			(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
Thank You

Last edited by Styles; 09-24-2007 at 19:57.
Styles is offline
Send a message via AIM to Styles
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 09-24-2007 , 20:58   Re: FakeMeta Trace_Line help
Reply With Quote #2

In fakemeta_const.inc, the first variable type after the EngFunc and DLLFunc commands is the return variable type, which is in this case "void". That tells you that EngFunc_TraceLine does not return anything at all.

What you need to do to get results from TraceLine is to hook FM_TraceLine. Use the parameters after the word "void" to get the parameters of the hook.

(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)

Those are the parameters that are sent, and thus hooked through FM_TraceLine. Use register_forward() to hook it.
Your function will look something like
public hook_traceline( Float:v1[3], Float:v2[3], nomonsters, id, ptr ) {

On a separate note, to actually accomplish anything with the traceline hook, use the TraceResult stuff inside fakemeta_const:


enum TraceResult
{
TR_AllSolid, // int
TR_StartSolid, // int
TR_InOpen, // int
TR_InWater, // int
TR_flFraction, // float
TR_vecEndPos, // float array[3]
TR_flPlaneDist, // float
TR_vecPlaneNormal, // float array[3]
TR_pHit, // int (edict_t*)
TR_iHitgroup, // int
};

Search the forums for any of those and you'll get some code examples.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 09-24-2007 , 21:22   Re: FakeMeta Trace_Line help
Reply With Quote #3

Okay thanks I think i got it
Styles is offline
Send a message via AIM to Styles
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 16:05.


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