| HoLLyWooD |
12-08-2011 03:44 |
Re: Set es problem
i try create invisible entity with modelindex - but isn`t work
PHP Code:
#include <amxmodx> #include <engine> #include <fakemeta>
#define PLUGIN "New Plug-In" #define VERSION "1.0.0" #define AUTHOR "HoLLyWooD"
#define smodel "models/winebottle.mdl" #define ent_class "present_spawn_point"
new bool:show = false; new modelindex;
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_forward(FM_AddToFullPack, "addToFullPackPre", 0); register_clcmd("say new", "create_ent"); register_clcmd("say show", "cmd_show"); }
public plugin_precache() modelindex = engfunc(EngFunc_PrecacheModel, smodel); //precache_model(smodel);
public cmd_show(id){ show = (show) ? false : true; client_print(id, print_chat, (show) ? "You can show entities" : "You can`t show entities"); }
public create_ent(id){ new Float:origin[3], ent, classname[32], bool:is_ent = false; entity_get_vector(id, EV_VEC_origin, origin); while( (ent = find_ent_in_sphere(ent, origin, 100.0)) != 0 ){ entity_get_string(ent,EV_SZ_classname,classname,charsmax(classname)); if(equali(classname,ent_class)){ is_ent = true; break; } } if(is_ent){ client_print(id, print_center, "Some entity is in 100 radius"); return; } ent = create_entity("info_target"); entity_set_string(ent,EV_SZ_classname, ent_class); //entity_set_int(ent, EV_INT_modelindex, modelindex); //entity_set_model(ent,smodel); entity_get_vector(id, EV_VEC_origin, origin); entity_set_origin(ent,origin); entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER); set_rendering(ent, kRenderFxGlowShell, 0,255, 0, kRenderNormal, 16 ); //entity_set_int(ent, EV_INT_effects, entity_get_int(ent, EV_INT_effects) | EF_NODRAW); drop_to_floor(ent); client_print(id, print_chat, "Invisible entity created!"); }
public addToFullPackPre(es, e, ent, host, hostflags, player, pSet){ if(!show || !is_valid_ent(ent)) return FMRES_IGNORED; new classname[32]; entity_get_string(ent, EV_SZ_classname, classname, 31); if(equali(classname, ent_class)){ set_es(es, ES_ModelIndex, modelindex); //set_es(es, ES_Effects, 0); return FMRES_SUPERCEDE; } return FMRES_IGNORED; }
|