AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Creating entity doesn't work (https://forums.alliedmods.net/showthread.php?t=213689)

didoWEE 04-17-2013 15:25

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(entsize)
{
    new 
FloatflSize 32.0 size;
    
    new 
FloatVecFlMax[3];
    
VecFlMax[0] = flSize
    
VecFlMax[1] = flSize
    
VecFlMax[2] = 9.0;
    
    new 
FloatVecFlMin[3];
    
VecFlMin[0] = -flSize
    
VecFlMin[1] = -flSize
    
VecFlMin[2] = -9.0;
    
    
entity_set_size(entVecFlMinVecFlMax);
}

SetEntityRendering(idFxFloat:RFloat:GFloat:BRenderFloat:Amount)
{
    new 
Float:fVecColor[3];
    
fVecColor[0] = R;
    
fVecColor[1] = G;
    
fVecColor[2] = B;

    
entity_set_int(idEV_INT_renderfxFx);
    
entity_set_vector(idEV_VEC_rendercolorfVecColor);
    
entity_set_int(idEV_INT_rendermodeRender);
    
entity_set_float(idEV_FL_renderamtAmount);
}

public 
create(id)
{
    new 
Float:EntityOrigin[3];
    
entity_get_vector(idEV_VEC_view_ofsEntityOrigin);
    
EntityOrigin[2]+=18.0;
    
    new 
ent create_entity("info_target");
    
entity_set_string(entEV_SZ_classname"sth"); // What is this for ? Can someone tell me, please
    
    
entity_set_vector(entEV_VEC_originEntityOrigin);
    
    
entity_set_int(entEV_INT_solid2);
    
    
SetEntitySize(ent1);
    
SetEntityRendering(idkRenderFxNone255.0255.0255.0kRenderNormal0.0);
    
    
entity_set_model(entmodel_1);
    
    
entity_set_int(entEV_INT_sequence0);
    
entity_set_float(entEV_FL_animtime2.0);
    
entity_set_float(entEV_FL_framerate1.0);


BTW, can the problem comes from the model sizes ?

jimaway 04-17-2013 15:50

Re: Creating entity doesn't work
 
did you try spawning the entity?

didoWEE 04-17-2013 16:07

Re: Creating entity doesn't work
 
Hmm, what is EV_VEC_view_ofs doing and how to get the aim position.
I saw a entity when I was walking but it was behind a wall, far far away from the place where I "created" it.


All times are GMT -4. The time now is 10:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.