I use precache control by joaquimandrade:
https://forums.alliedmods.net/showpo...3&postcount=41 to block some useless precached files.
For some reason this code causes problems:
PHP Code:
new iEntity = create_entity( "info_target" )
entity_set_string( iEntity, EV_SZ_classname, "tossed_knife" )
new Float: fVecAngles[ 3 ]
entity_get_vector( id, EV_VEC_angles, fVecAngles )
new Float: fVAngles[ 3 ], Float: fVecVelocity[ 3 ]
entity_get_vector( id, EV_VEC_v_angle, fVAngles )
engfunc( EngFunc_MakeVectors, fVAngles )
global_get( glb_v_forward, fVAngles )
fVecVelocity[0] = fVAngles[ 0 ] * 350
fVecVelocity[1] = fVAngles[ 1 ] * 350
fVecVelocity[2] = fVAngles[ 2 ] * 350
new Float: fVecOrigin[ 3 ]
entity_get_vector( id, EV_VEC_origin, fVecOrigin )
entity_set_origin( iEntity, fVecOrigin )
entity_set_vector( iEntity, EV_VEC_velocity, fVecVelocity )
entity_set_string( iEntity, EV_SZ_model, DEFAULT_WMODEL )
entity_set_int( iEntity, EV_INT_iuser1, iCurrentKnife )
DispatchSpawn( iEntity )
It tries to precache c4 files (DispatchSpawn to be exact), which causes crash because they're unprecached. If I precache them, the entity doesn't get spawned anyway or at least I can't see it.
Am I doing anything wrong? That code is mainly by ot_207, I'm trying to create an entity for my knife API but it won't work :/
DEFAULT_WMODEL is models/w_backpack.mdl and it's precached.