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

[FM] get_tr2 TR_pHit loves the fun module


  
 
 
Thread Tools Display Modes
Author Message
VEN
Veteran Member
Join Date: Jan 2005
Old 08-04-2006 , 13:05   [FM] get_tr2 TR_pHit loves the fun module
#1

Disable the fun module and run the script below.
The server will crash with "bad entity in index of edict".
But it will not crash if fun module is enabled.

Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_plugin("tr_phit_bug_part2", "0.1", "VEN")     register_forward(FM_TraceLine, "forward_trace_line") } public forward_trace_line(Float:start[3], Float:dest[3], ignore_monsters, skip_ent, ptr) {     if (!is_user_alive(skip_ent))         return FMRES_IGNORED     new phit = get_tr2(ptr, TR_pHit)     if (!is_user_alive(phit))         return FMRES_IGNORED     return FMRES_IGNORED }
VEN is offline
BAILOPAN
Join Date: Jan 2004
Old 08-04-2006 , 13:12   Re: [FM] get_tr2 TR_pHit loves the fun module
#2

You're not calling the traceline function from the engine yourself. Observe that you're hooking it pre, so the traceresult structure is in fact garbage/unfilled.

You must manually call traceline to ensure that valid data exists, otherwise you are relying on a previous module being in the call chain and having had modified the structure (such as Fun does).

I.e., this isn't a bug, just a misunderstanding of how Metamod pre calls work ;)
__________________
egg
BAILOPAN is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 08-04-2006 , 13:14   Re: [FM] get_tr2 TR_pHit loves the fun module
#3

This is what you must do below if your not going to use the fun module and hooking pre.

Code:
public traceline(const Float:v1[3], const Float:v2[3], noMonsters, pentToSkip, TraceResultPtr) {     engfunc(EngFunc_TraceLine, v1, v2, noMonsters, pentToSkip, TraceResultPtr)
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
BAILOPAN
Join Date: Jan 2004
Old 08-04-2006 , 13:23   Re: [FM] get_tr2 TR_pHit loves the fun module
#4

Note one thing - and this is an annoyance in how MM works - doing this will override the value from Fun. So your script will interfere with other scripts doing hitbox stuff.

There really isn't any nice solution to this except for putting fun down further on the call chain than fakemeta.
__________________
egg
BAILOPAN is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 08-04-2006 , 13:30   Re: [FM] get_tr2 TR_pHit loves the fun module
#5

Of course, and i knew that i had to hook it in post, don't know how did i forgot/not noticed that, this can be locked, sorry.

Last edited by VEN; 08-04-2006 at 13:34.
VEN is offline
 



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 13:16.


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