Quote:
Originally Posted by Dr.Doctor
@zipcore
You forgot
PHP Code:
GetEntPropVector(client, Prop_Data, "m_vecOrigin", clientVecOrigin);
|
thank you but i getting warning
// D:\SteamLibrary\steamapps\common\Team Fortress 2\tf\addons\sourcemod\scripting\afk_bot.sp(26 07) : warning 217: loose indentation
// D:\SteamLibrary\steamapps\common\Team Fortress 2\tf\addons\sourcemod\scripting\afk_bot.sp(26 10) : warning 217: loose indentation
// Code size: 88212 bytes
// Data size: 13036 bytes
// Stack/heap size: 16384 bytes
// Total requirements: 117632 bytes
//
// 2 Warnings.
//
// Compilation Time: 0,66 sec
// ----------------------------------------
Press enter to exit ...
PHP Code:
public int GetNearestEntity(int client, char[] classname)
{
int nearestEntity = -1;
float clientVecOrigin[3], entityVecOrigin[3];
GetEntPropVector(client, Prop_Data, "m_vecOrigin", clientVecOrigin); // Line 2607
//Get the distance between the first entity and client
float distance, nearestDistance = -1.0;
//Find all the entity and compare the distances
int entity = -1;
while ((entity = FindEntityByClassname(entity, classname)) != -1)
{
GetEntPropVector(entity, Prop_Data, "m_vecOrigin", entityVecOrigin); // Line 2610
distance = GetVectorDistance(clientVecOrigin, entityVecOrigin);
if (distance < nearestDistance || nearestDistance == -1.0)
{
nearestEntity = entity;
nearestDistance = distance;
}
}
return nearestEntity;
}