Raised This Month: $ Target: $400
 0% 

Help on Vectors/Origins.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 08-30-2007 , 15:38   Help on Vectors/Origins.
Reply With Quote #1

I'm trying to figure out how to convert this piece of code from the HLSDK, to AMX.

Code:
void EntityThink( edict_t *pent ) {     edict_t *pEntity = NULL;     int mynum = ENTINDEX(pent);     pEntity = FIND_ENTITY_BY_STRING( pEntity, "classname", "player" );     while (!FNullEnt(pEntity))     {         Vector vecGo = pent->v.origin - pEntity->v.origin;          if (vecGo.Length() > 200)         {             vecGo = vecGo.Normalize();             pEntity->v.velocity = vecGo * 600;         }         pEntity = FIND_ENTITY_BY_STRING( pEntity, "classname", "player" );     }     entvars_t *pev = VARS( pent );     pev->nextthink = gpGlobals->time + 0.1; }

Here's what i have so far:
Code:
public Forward_Think(ent) {     new player;     while((player = engfunc(EngFunc_FindEntityByString,"classname","player")) != 0 )     {                 new Float:entOrigin[3]         new Float:plOrigin[3];                 pev(player,pev_origin,plOrigin);         pev(ent,pev_origin,entOrigin);                 entOrigin[0] - plOrigin[0]         entOrigin[1] - plOrigin[1]         entOrigin[2] - plOrigin[2]                 if(vector_length(entOrigin) > 200)         {         }             } }

I'm stuck at the part of "Vector vecGo = pent->v.origin - pEntity->v.origin;"
How can i create a 'vector' and subject two origins like that?
And then be able to set the players velocity to it?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
 



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 16:16.


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