View Single Post
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 07-27-2009 , 12:24   Re: Place model\image\sprite in constant position on screen
Reply With Quote #30

I'm having a problem. Maybe connor or arkshine can help. An attached model is not visible for the person to who it is attached. That's why we don't see the p_model of our weapon but only the v_model.

Edit:

here is the code:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

new Model[] = "models/nihilanth.mdl"
new Entity

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_AddToFullPack,"addToFullPack",1)
}

public 
plugin_precache()
{
    
precache_model(Model)
}

public 
plugin_cfg()
{
    
Entity createEntity(Model)
}

public 
addToFullPack(eseenthosthostflagsplayerpSet)
{
    if((
ent == Entity) && (<= host <= 32))
    {
        static 
Float:origin[3]
        
pev(host,pev_origin,origin)
        
entity_set_origin(ent,origin)
        
        
set_es(es,ES_AimEnt,host)
        
set_es(es,ES_RenderMode,kRenderNormal)
        
set_es(es,ES_RenderAmt,100)
    }
}

createEntity(model[])
{
    new 
ent create_entity("info_target")
    
    
assert ent;
    
    
set_pev(ent,pev_takedamage,0.0)
    
set_pev(ent,pev_solid,SOLID_NOT);
    
set_pev(ent,pev_movetype,MOVETYPE_FOLLOW)
    
    
fm_set_rendering(ent,.render=kRenderTransAlpha,.amount=0)
    
    
entity_set_model(ent,model)
    
    return 
ent

I'm sure it "works" because if you make it set_es(es,ES_AimEnt,host) to set_es(es,ES_AimEnt,2) and add a bot you will see the model on the bot
__________________

Last edited by joaquimandrade; 07-27-2009 at 12:35.
joaquimandrade is offline