Solved
Done by creating arrays and and saving the solidity in them, then make the hit entity non-solid and if once the traceline reached it's end putting back the solidity to the normal. Who would have thought lmao
This is a snippet from my lasermine plugin:
Code:
static Float:lEnd[3], Float:lOrigin[3]
entity_get_vector(laserMine, EV_VEC_origin, lOrigin)
entity_get_vector(laserMine, EV_VEC_beamendpoint, lEnd)
static Float: fFraction
static lHit
static lTraceHandle
lTraceHandle = create_tr2();
static entityName[32]
static Array:entitiesHit
static Array:entitiesSolidity
entitiesHit = ArrayCreate(1)
entitiesSolidity = ArrayCreate(1)
while(engfunc(EngFunc_TraceLine, lOrigin, lEnd, DONT_IGNORE_MONSTERS, laserMine, lTraceHandle)) // will always return 1, see engfunc.cpp
{
lHit = get_tr2(lTraceHandle, TR_pHit) // getting hitted entity
get_tr2(lTraceHandle, TR_flFraction, fFraction)
if(lHit == -1 || fFraction >= 1.0) // the traceline finished at the original end position, so we will stop here
{
new Float:lEndP[3], Float:lNormal[3]
new Float:EntVector[3]
entity_get_vector(laserMine, EV_VEC_origin, lOrigin)
trace_line(-1, lOrigin, lEnd, lNormal)
lNormal[0] -= lOrigin[0]
lNormal[1] -= lOrigin[1]
lNormal[2] -= lOrigin[2]
EntVector[0] = lNormal[0]*8
EntVector[1] = lNormal[1]*8
EntVector[2] = lNormal[2]*8
EntVector[0] += lOrigin[0]
EntVector[1] += lOrigin[1]
EntVector[2] += lOrigin[2]
engfunc(EngFunc_TraceLine, lOrigin, EntVector, IGNORE_MONSTERS, -1, lTraceHandle)
get_tr2(lTraceHandle, TR_vecEndPos, lEndP)
entity_set_vector(laserMine, EV_VEC_beamendpoint, lEndP)
break
}
entity_get_string(lHit, EV_SZ_classname, entityName, charsmax(entityName))
if(!equal(entityName, "player") || !is_user_alive(lHit))
{
ArrayPushCell(entitiesSolidity, entity_get_int(lHit, EV_INT_solid))
ArrayPushCell(entitiesHit, lHit)
entity_set_int(lHit, EV_INT_solid, SOLID_NOT)
continue
}
createLaserDamage(laserMine, lHit)
ArrayPushCell(entitiesSolidity, pev(lHit, pev_solid))
ArrayPushCell(entitiesHit, lHit)
entity_set_int(lHit, EV_INT_solid, SOLID_NOT)
}
free_tr2(lTraceHandle) // freeing the tracehandle
static entHit, entSolidity
for(new i; i < ArraySize(entitiesHit); i++)
{
entHit = ArrayGetCell(entitiesHit, i)
entSolidity = ArrayGetCell(entitiesSolidity, i)
if(pev_valid(entHit))
entity_set_int(entHit, EV_INT_solid, entSolidity)
}
ArrayDestroy(entitiesHit)
ArrayDestroy(entitiesSolidity)