hi ,
I do not have much knowledge about modding and scripting, so I will trying until something works.
I had put this part within the Callback_PlayerDamage,
PHP Code:
//call in Callback_PlayerDamage(): (self == victim)
if( checkSilentAim( sMeansOfDeath , self , attacker ) )
iDamage = 0;
and this just below the end of Callback_PlayerDamage ( )
PHP Code:
checkSilentAim( sMeansOfDeath , victim , attacker )
{
// check only bullet weapons
if( sMeansOfDeath != "MOD_HEAD_SHOT" && !isSubStr( sMeansOfDeath , "BULLET" ) )
return false;
attackerViewDir = anglesToForward( attacker getPlayerAngles() );
attackerToVictimDir = vectorToAngles( victim.origin - attacker.origin ); // maybe change the origins here
angleBetweenDirs = vectorDot( attackerViewDir , attackerToVictimDir ); // returns acos of angle
maxAngle = aCos( 5 ); // 5 degrees
if( angleBetweenDirs <= maxAngle )
return false;
return true;
}
vectorDot( v1 , v2 )
{
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
}
thus resulted in this error:
PHP Code:
******* Script compile error *******
uninitialised variable ' attacker ' : ( file ' maps / mp / gametypes / sd.gsc ' , line 433 )
*if ( checkSilentAim ( sMeansOfDeath , self , Attacker ) )
*****************************************
I changed the first "atracker" by "eAttacker" , and server runs. I have no idea if it has any difference.
I did right?
thank you very much for your help, sorry that I can not verify if it worked in practice, because I have no hacks to test.
I think everyone should use it on their servers, it has much of this "silent aim" in cod2 and cod4.