I'm stuck ...
I put the sprite on the model.
The sprite itself is played when I throw the Entity.
Is it possible to delete a Sprite when the model touches the ground?
While the sprite is removed from the model together, when the model disappears over time
Also
TE_BEAMFOLLOW does not suit me at all
And instantly deleting the model by touching the ground is also not good.
In other words: Remove the sprite from the model when touching the ground, but the model must remain on the ground until its time disappears.
Suddenly, if anything ...
PHP Code:
new Float: fOriginStart[3], Float: fOriginEnd[3], Float: fAngles[3], Float: fVelocity[3], Float: fDist, Float: Aiming[3]
get_data_aim(id, fOriginStart, fOriginEnd, fAngles)
fDist = get_distance_f(fOriginStart, fOriginEnd)
if(fDist > THROW_MIN_DIST)
{
new iEnt = create_entity(DEFAULT_CLASSNAME)
entity_set_string(iEnt, EV_SZ_classname, "throwing_knife")
entity_set_edict(iEnt, EV_ENT_owner, id)
entity_set_vector(iEnt, EV_VEC_origin, fOriginStart)
fAngles[0] -= 90
entity_set_vector(iEnt, EV_VEC_angles, fAngles)
new Float:MinBox[3] = {-1.0, -1.0, -1.0}
new Float:MaxBox[3] = {1.0, 1.0, 1.0}
entity_set_vector(iEnt, EV_VEC_mins, MinBox)
entity_set_vector(iEnt, EV_VEC_maxs, MaxBox)
entity_set_model(iEnt, KNIFE_MODEL)
entity_set_int(iEnt, EV_INT_movetype, 6)
entity_set_int(iEnt, EV_INT_solid, 1)
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + KNIFE_TIME )
knife_fire(iEnt)
for(new i; i < 3; i++)
fVelocity[i] = (fOriginEnd[i] - fOriginStart[i]) * THROW_MUL_VELOCITY / fDist
entity_set_vector(iEnt, EV_VEC_velocity, fVelocity)
Aiming[0] = random_float(-255.0, 255.0)
Aiming[1] = random_float(-255.0, 255.0)
Aiming[2] = random_float(-255.0, 255.0)
set_pev(iEnt, pev_avelocity, Aiming)
}
else
client_print(id, print_center, "Нет пространства для броска Меча")
return PLUGIN_HANDLED
}
public knife_fire(iEnt)
{
if(!is_valid_ent(iEnt))
return;
new Float:flOrigin[3]
pev(iEnt,pev_origin,flOrigin)
engfunc (EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flOrigin, 0)
write_byte (TE_SPRITE)
engfunc (EngFunc_WriteCoord, flOrigin [ 0 ])
engfunc (EngFunc_WriteCoord, flOrigin [ 1 ])
engfunc (EngFunc_WriteCoord, flOrigin [ 2 ] += 15.0)
write_short (g_knife_fire)
write_byte (2)
write_byte (130)
message_end ()
set_task(0.1,"knife_fire",iEnt)
}
__________________