I'm trying to create an animated sprite entity which can freely move around the map.
I've come up with something, but there is a problem: the sprite's
animation doesn't play.
Setting
pev_framerate seems to have no effect. Any ideas?
Code:
#include <amxmodx>
#include <fakemeta>
new const g_firesprite[] = "sprites/flame.spr"
public plugin_precache()
{
precache_model( g_firesprite )
}
public plugin_init()
{
register_plugin( "Animated Sprite Entity", "0.0", "Test" )
register_clcmd( "say test", "clcmd_say_test" )
}
public clcmd_say_test( id )
{
// Retrieve player's origin
new origin[3]
pev( id, pev_origin, origin )
// Create entity at player's position
new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) )
set_pev( ent, pev_origin, origin)
// Set sprite on entity
engfunc( EngFunc_SetModel, ent, g_firesprite )
// Set proper rendering
set_pev( ent, pev_rendermode, kRenderTransAdd)
set_pev( ent, pev_renderamt, 200.0)
// Set the animation's framerate
set_pev( ent, pev_framerate, 1.0) // doesn't work!
}
__________________