Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <engine>
#include <fakemeta>
#define PLUGIN "Create Entity"
#define VERSION "1.0"
#define AUTHOR "colossus"
new const gEntityModel[] = "models/w_medkit.mdl";
new const gEntName[] = "Ent"; // Classname
public plugin_precache()
{
register_plugin(PLUGIN, VERSION, AUTHOR); //....
// Start properties
register_clcmd("say /test", "CreateEntity"); //...
precache_model(gEntityModel); // precache model
}
public CreateEntity(id)
{
new ent = create_entity("info_target");
if(!is_valid_ent(ent))
return PLUGIN_HANDLED;
static Float:origin [ 3 ], Float:angle [ 3 ], Float:fVelocity[3];
entity_set_string(ent, EV_SZ_classname, gEntName);
entity_set_model(ent, gEntityModel);
engfunc(EngFunc_GetAttachment, id , 2 , origin, angle );
VelocityByAim( id , 250 , fVelocity );
entity_set_size(ent , Float: {-8.0,-8.0,-8.0} , Float: { 0.0 , 0.0 , 0.0} );
entity_set_vector ( ent , EV_VEC_velocity, fVelocity );
entity_set_vector(ent, EV_VEC_rendercolor, Float:{ 255.0, 255.0, 255.0 });
entity_set_vector(ent, EV_VEC_origin, origin);
entity_set_int(ent, EV_INT_renderfx, kRenderFxGlowShell);
entity_set_int(ent,EV_INT_movetype, MOVETYPE_TOSS);
entity_set_int(ent, EV_INT_solid, 1);
client_print(id, print_chat, "You dropped entity");
return PLUGIN_HANDLED;
}
public pfn_touch(gEntityDrop, gEntityToco)
{
if(!is_valid_ent(gEntityDrop) || !(get_entity_flags(gEntityDrop) & FL_ONGROUND))
return PLUGIN_HANDLED;
static szClassName[32];
entity_get_string(gEntityDrop, EV_SZ_classname, szClassName,charsmax(szClassName));
if(equal(szClassName, gEntName))
{
client_print(gEntityToco, print_chat, "You touch entity"); //....
/* Remove entity??? uncomment this line*/
//remove_entity(gEntityDrop);
}
return PLUGIN_CONTINUE;
}