Quote:
Originally Posted by scorpius2k1
Here is an example
PHP Code:
stock void SpawnEntity(int client) { float fOrigin[3]; GetClientAbsOrigin(client, fOrigin);
int iEntity = CreateEntityByName("prop_physics");
if(IsValidEntity()) { GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fOrigin);
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR) // Sometimes 'fPosition' is getting console errors // ==> Bad SetLocalOrigin(nan,nan,nan) on prop_physics } }
|
Well first of all, you need to spawn the prop before getting its location (unless that's just part of your example?), also you're getting the location before the prop really has an origin. So you need to teleport the entity/set its origin before retrieving its location.
For the stock, I'm not sure but I presume null vectors were to be 0.00000 for x, y, and z. So maybe
PHP Code:
stock bool IsValidVector(float fVec[3])
{
int iCheck;
for (int i = 0; i < 3; ++i)
{
if (fVec[i] == 0.0000)
++iCheck;
else
break;
}
return view_as<bool>(iCheck != 3);
}
__________________