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?
__________________