View Single Post
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 04-07-2005 , 18:20  
Reply With Quote #93

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).
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline