Raised This Month: $ Target: $400
 0% 

[HELP] How I can do to make a sprite follow a player?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Nax0ne
Senior Member
Join Date: Jul 2011
Location: Chile
Old 05-05-2016 , 15:20   [HELP] How I can do to make a sprite follow a player?
Reply With Quote #1

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( ); }
__________________

Last edited by Nax0ne; 05-06-2016 at 14:04.
Nax0ne is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode