View Single Post
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 09-23-2017 , 12:46   Re: [Help] Create Ent that always in front of player
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Edit :- check out this example

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

#define SPRITE "sprites/test.spr"

new user_ent[33];

public 
plugin_precache()
{
    
precache_model(SPRITE)
}

public 
plugin_init()
{
    
register_clcmd("say /test""Create_Slash_Ent")
}

public 
Create_Slash_Ent(id)
{
    new 
ent;
    if((
user_ent[id] = ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"))) > 0)
    {
    
// Set sprite on entity
    
engfuncEngFunc_SetModelentSPRITE )

    
// Set proper rendering
    
set_peventpev_rendermodekRenderTransAdd )
    
set_peventpev_renderamt200.0 )
    
    
// Set the animation's framerate
    
set_peventpev_framerate1.0 // doesn't work!
    
set_peventpev_spawnflagsSF_SPRITE_STARTON )
    
dllfuncDLLFunc_Spawnent )
    
user_ent[id] = ent
    set_task
(5.0"remove_ent"id)
    }
}

public 
remove_ent(id)
{
    if(
user_ent[id] > 0remove_entity(user_ent[id]); user_ent[id] = 0;
}

const 
Float:distance 10.0;

public 
client_PreThink(id)
{
    static 
Ent;
    if(!(
Ent user_ent[id]))
        return
    static 
Float:Origin[3], FloatAngles[3], Float:fvDistance[3];
    
pev(idpev_view_ofsAngles)
    
pev(idpev_originOrigin)
    
xs_vec_add(OriginAnglesOrigin)
    
pev(idpev_v_angleAngles)
    
angle_vector(AnglesANGLEVECTOR_FORWARDfvDistance)
    
Origin[0] += (fvDistance[0] * distance)
    
Origin[1] += (fvDistance[1] * distance)
    
Origin[2] += (fvDistance[2] * distance)
    
set_pev(Entpev_originOrigin)
    
Angles[0]*= -1
    Angles
[1]*= -1
    Angles
[2]*= -1
    set_pev
(Entpev_anglesAngles)

Ehh... more specifically, I want to make like a fake viewmodel, not an sprites effect.
- Hide current viewmodel
- make 4 new ent that show 4 different animation at the same time
- remove all 4 ent at the same time and show back the original viewmodel

Quote:
Originally Posted by aron9forever View Post
what's the difference, you also want the model to be "facing" the player all the time?
Sprites will always move with the camera view (env_sprite) but the Model Ent doesn't (info_target).

EDIT: Changed that title, that title make missunderstanding
__________________
My plugin:

Last edited by Celena Luna; 09-23-2017 at 12:49.
Celena Luna is offline