AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   (OLD) Bug Reports (https://forums.alliedmods.net/forumdisplay.php?f=24)
-   -   [FM] get_tr2 TR_pHit loves the fun module (https://forums.alliedmods.net/showthread.php?t=42623)

VEN 08-04-2006 13:05

[FM] get_tr2 TR_pHit loves the fun module
 
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 }

BAILOPAN 08-04-2006 13:12

Re: [FM] get_tr2 TR_pHit loves the fun module
 
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 ;)

teame06 08-04-2006 13:14

Re: [FM] get_tr2 TR_pHit loves the fun module
 
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)

BAILOPAN 08-04-2006 13:23

Re: [FM] get_tr2 TR_pHit loves the fun module
 
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.

VEN 08-04-2006 13:30

Re: [FM] get_tr2 TR_pHit loves the fun module
 
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.


All times are GMT -4. The time now is 21:22.

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