Raised This Month: $ Target: $400
 0% 

make moving entity stop before going back


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mammapappa
Member
Join Date: Nov 2008
Old 10-28-2013 , 14:47   make moving entity stop before going back
Reply With Quote #1

hello when i create a moving entity thats going betwen two points i want so after it has moved from point A to point B it stops for one second and then go back from point B to point A and the same when going back again from A to B

this is the code i use to move the entity that is created
Code:
public ThinkBlock(ent) {     if(is_valid_ent(ent))     {         new Float:fLen = vector_length(fVelo[ent]);                 if(fLen >= 24.5)         {             set_pev(ent, pev_velocity, fVelo[ent]);                         new Float:fOri[3];             entity_get_vector(ent, EV_VEC_origin, fOri);             for(new i = 0 ; i < 3 ; i ++){                 if(fVelo[ent][i]){                     if((fOri[i] - 5.5) > (g_fOrigin[ent][i] + g_iFlyDistance[ent]) && fVelo[ent][i] >= 0.0 || (fOri[i] + 5.5) < g_fOrigin[ent][i] && fVelo[ent][i] < 0.0){                         fVelo[ent][i] *=  -1.0;                     }                 }             }                             new iPlayers[32], iNum;             get_players(iPlayers, iNum);                         for(new i = 0 ; i < iNum ; i ++){                 new iFlags = pev(iPlayers[i], pev_flags);                                 if(fVelo[ent][2] >= 24.5){                     if((iFlags & FL_ONGROUND) && pev(iPlayers[i], pev_groundentity) == ent)                     {                         new Float:fOrigin[3];                         entity_get_vector(iPlayers[i], EV_VEC_origin, fOrigin);                                                 fOrigin[2] += 1.0;                         entity_set_vector(iPlayers[i], EV_VEC_origin, fOrigin);                                         }                 }             }         }         set_pev(ent, pev_nextthink, get_gametime() + 0,005);     } }

tell me if you need more info on what i want if you did not understand
mammapappa is offline
Reply



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 23:13.


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