dont understand this should work> but
PHP Code:
public fw_HamTakeDamage( iVictim , iInflictor , iAttacker , Float:fDamage , iBitDamage )
{
if ( IsPlayer( iAttacker ) && fDamage > 80 )
teleport_behind( iAttacker, iVictim )
}
public teleport_behind(id, target){
new Float:vec[3], Float:origin[3], Float:fraction, Float:ftmp[3], Float:ftmp2[3], Float:ftmp3[3], Float:ftmp4[3], Float:len2, tr, i, j
velocity_by_aim(target, 1, vec)
new Float:len = floatsqroot(vec[0]*vec[0]+vec[1]*vec[1])
pev(target, pev_origin, origin)
ftmp3[0] = origin[0]-vec[0]*50.0/len
ftmp3[1] = origin[1]-vec[1]*50.0/len
ftmp3[2] = origin[2]+5.0
ftmp4[0] = origin[0]-vec[0]*10.0/len
ftmp4[1] = origin[1]-vec[1]*10.0/len
ftmp4[2] = origin[2]+91.0
for(j=0; j<20; j++){
if(j<15){
_Vec3Set(ftmp, ftmp3)
}else{
_Vec3Set(ftmp, ftmp4)
}
for(i=0; i<100; i++){
engfunc(EngFunc_TraceHull, ftmp, ftmp, 0, HULL_HUMAN, 0, tr)
if(get_tr2(tr, TR_StartSolid) || get_tr2(tr, TR_AllSolid)){
_Vec3AddScalar(ftmp, random_float(-10.0, 10.0))
continue
}
engfunc(EngFunc_TraceLine, origin, ftmp, IGNORE_MONSTERS, 0, tr)
get_tr2(tr, TR_flFraction, fraction)
break
}
if(fraction == 1.0){
_Vec3Set(ftmp2, ftmp)
_Vec3Add(ftmp2, -origin)
len2 = len*floatsqroot(ftmp2[0]*ftmp2[0]+ftmp2[1]*ftmp2[1]+ftmp2[2]*ftmp2[2])
if(len2 > 100.0 || (ftmp2[0]*vec[0]+ftmp2[1]*vec[1])/len2 > 0.1){
fraction = 0.0
continue
}
break
}
}
if(fraction !=1.0){
//failed to find correct position behind target
return
}
set_pev(id, pev_origin, ftmp)
_Vec3Set(ftmp, -ftmp)
_Vec3Add(ftmp, origin)
_Vec3ToAngles(ftmp, ftmp)
set_pev(id, pev_angles, ftmp)
set_pev(id, pev_fixangle, 1)
}
I did as in your example just without console command
id = iAttacker , traget = iVictim
but its not working.
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc