Because of some reason the below part of code with forward_traceline crashes my both CS - 1.5 and 1.6 (bad entity - IndexOfEdict() - whatever it means.
Below function forward_transline there is an AMX function (commented out) to show what it should be supposed to do.
Code:
/* HITZONES DATA */
public forward_traceline(Float:v1[3], Float:v2[3], noMonsters, pentToSkip)
{
new entity1 = pentToSkip
new entity2 = get_tr(TR_pHit) // victim
new hitzone = (1<<get_tr(TR_iHitgroup))
if (!is_valid_ent(entity1) || !is_valid_ent(entity2))
{
return FMRES_IGNORED
}
if (entity1 != entity2 && is_user_alive(entity1) && is_user_alive(entity2))
{
if(UserFlags[entity2])
{
if(hitzone != 64 && hitzone != 128)
{
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
return FMRES_IGNORED
}
/* AMX version of traceline() from VexdUM
public traceline(entity1, entity2, hitzone)
{
if(UserFlags[entity2])
{
if(hitzone != 64 && hitzone != 128)
{
return 3
}
}
return PLUGIN_CONTINUE
}*/
After few tests I narrowed the line causing the crash.
It's this one:
Code:
new entity2 = get_tr(TR_pHit) // victim
If everything else is commented out (except the last return FMRES_SUPERCEDE and this line above) - then server crashes.
If I leave only the last return FMRES_IGNORED - the server doesn't crash.
Dunno if it's something wrong in this code. The info in includes is again much helpful and useful and leting me understand all
//only use this with functions that pass a Trace
// get: zero extra params - return int, one extra param = byref float or vector
// set: use anything
native get_tr(TraceResult:tr_member, {Float,_}:...);
Or maybe there is a bug in fakemeta module. Using latest AMX MOD X 1.01 with metamod 1.17.3 (someone told me 1.17.4 isn't so good).
__________________