I'm trying create a sprite follow the player, but I have not succeeded.
For example, i have a zombie class named "Zombie Heal" (from CSO), and i want when the zombie is healing, the sprite follow the player (in the case if the zombie is moving)
The only idea I have in mind is to detect the velocity of the player, if the player is in moving the sprite follow him. or am I wrong? Please help !
Code:
effect_restore_health( const index )
{
if ( !is_user_alive( index ) || !zbs_is_zombie( index ) ) return;
new Float:flOrigin[ 3 ];
pev( index, pev_origin, flOrigin );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SPRITE );
engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] + 30.0 ),
write_short( g_iHealSpr );
write_byte( 10 );
write_byte( 192 ),
message_end( );
}
effect_restore_team_health( const index )
{
if ( !is_user_alive( index ) || !zbs_is_zombie( index ) ) return;
new Float:flOrigin[ 3 ];
pev( index, pev_origin, flOrigin );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SPRITE );
engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] + 30.0 ),
write_short( g_iHealTeamSpr );
write_byte( 10 );
write_byte( 192 ),
message_end( );
}
__________________