Creating entity doesn't work
Hi all. I'm trying to make an entity but it doesn't work
here's the code:
PHP Code:
#include <amxmodx> #include <engine>
new const model_1[] = "models/modelA.mdl";
public plugin_init() { register_clcmd("say /create", "create"); register_clcmd("say_team /create", "create"); }
public plugin_precache() precache_model(model_1);
SetEntitySize(ent, size) { new Float: flSize = 32.0 * size; new Float: VecFlMax[3]; VecFlMax[0] = flSize, VecFlMax[1] = flSize, VecFlMax[2] = 9.0; new Float: VecFlMin[3]; VecFlMin[0] = -flSize, VecFlMin[1] = -flSize, VecFlMin[2] = -9.0; entity_set_size(ent, VecFlMin, VecFlMax); }
SetEntityRendering(id, Fx, Float:R, Float:G, Float:B, Render, Float:Amount) { new Float:fVecColor[3]; fVecColor[0] = R; fVecColor[1] = G; fVecColor[2] = B;
entity_set_int(id, EV_INT_renderfx, Fx); entity_set_vector(id, EV_VEC_rendercolor, fVecColor); entity_set_int(id, EV_INT_rendermode, Render); entity_set_float(id, EV_FL_renderamt, Amount); }
public create(id) { new Float:EntityOrigin[3]; entity_get_vector(id, EV_VEC_view_ofs, EntityOrigin); EntityOrigin[2]+=18.0; new ent = create_entity("info_target"); entity_set_string(ent, EV_SZ_classname, "sth"); // What is this for ? Can someone tell me, please entity_set_vector(ent, EV_VEC_origin, EntityOrigin); entity_set_int(ent, EV_INT_solid, 2); SetEntitySize(ent, 1); SetEntityRendering(id, kRenderFxNone, 255.0, 255.0, 255.0, kRenderNormal, 0.0); entity_set_model(ent, model_1); entity_set_int(ent, EV_INT_sequence, 0); entity_set_float(ent, EV_FL_animtime, 2.0); entity_set_float(ent, EV_FL_framerate, 1.0); }
BTW, can the problem comes from the model sizes ?
|