1 public RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, iClassIgnore, bitsDamageType) 2 { 3 new pEntity; 4 new Float:flAdjustedDamage, Float:falloff; 5 new Float:vecOrigin[3]; 6 new Float:vecTemp[3]; 7 8 if (flRadius) 9 falloff = flDamage / flRadius; 10 else 11 falloff = 1.0; 12 13 new bInWater = engfunc(EngFunc_PointContents, vecSrc); 14 15 vecSrc[2] += 1.0; 16 17 if (!pevAttacker) 18 pevAttacker = pevInflictor; 19 20 while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecSrc, flRadius)) != 0) 21 { 22 if (pev(pEntity, pev_takedamage) == DAMAGE_NO) 23 continue; 24 25 if (iClassIgnore != 0 && ExecuteHam(Ham_Classify, pEntity) == iClassIgnore) 26 continue; 27 28 if (bInWater && !pev(pEntity, pev_waterlevel)) 29 continue; 30 31 if (!bInWater && pev(pEntity, pev_waterlevel) == 3) 32 continue; 33 34 pev(pEntity, pev_origin, vecOrigin); 35 xs_vec_sub(vecSrc, vecOrigin, vecTemp); 36 37 flAdjustedDamage = xs_vec_len(vecTemp) * falloff; 38 flAdjustedDamage = flDamage - flAdjustedDamage; 39 40 ExecuteHamB(Ham_TakeDamage, pEntity, pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType); 41 } 42 }
时间: 2024-10-28 15:36:20