New Member
- Joined
- Jan 31, 2003
- Messages
- 135
- Best answers
- 0
Hi everyone,
This past weekend, I've been trying to code my first plugin in pawn. I have not been able to animate my sprite explode02.spr (from half-life sdk) no matter what I do and I'd like some help from those that know how.
here's a code snippet:
Thanks
This past weekend, I've been trying to code my first plugin in pawn. I have not been able to animate my sprite explode02.spr (from half-life sdk) no matter what I do and I'd like some help from those that know how.
here's a code snippet:
Code:
//Called whenever the PS hud appears
//Good for entering water by beam block or swoop
new origin[3], Float:Orig[3];
get_user_origin(id, origin, 0);
Orig[0] = float(origin[0]);
Orig[1] = float(origin[1]);
Orig[2] = float(origin[2]);
//Draw sprite here
new ent = create_entity("env_sprite");
entity_set_string(ent, EV_SZ_model, "sprites/explode02.spr"); //additional info on the entity can be used to match entities
//From Harsens' EFFECTS.CPP & edited to AMX Functions
set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON); //env_sprite
set_pev(ent, pev_solid, SOLID_NOT);
set_pev(ent, pev_movetype, MOVETYPE_NONE);
set_pev(ent, pev_effects, 0); //Produces glaring sprite on EF_LIGHT
set_pev(ent, pev_frame, 0);
engfunc(EngFunc_SetModel, ent, "sprites/explode02.spr");
entity_set_origin(ent, Orig);
//entity_set_float(ent,EV_FL_animtime,1.0);
//set_pev(ent,pev_animtime,10.0);
//entity_set_float(ent,EV_FL_framerate,10.0);
set_pev(ent,pev_framerate,10.0);
//Animate
new maxframes = engfunc(EngFunc_ModelFrames,engfunc(EngFunc_ModelIndex,"sprites/explode02.spr"));
new lasttime = global_get(glb_time);
for(new Float:frame = 0.0; pev(ent,pev_frame) < maxframes; frame += pev(ent,pev_framerate) * (global_get(glb_time)- lasttime))
{
set_pev(ent, pev_frame, frame);
}
//EF_AnimationAutomove(ent, 1.0);
//set_rendering(ent);
//call_think(ent);
//remove_entity(ent);