Hi, i have a problem with
EngFunc_FindEntityInSphere . It works but when i try to calculate distance between different types of entities, they all give different distances.
Im trying to achieve protection for my basebuilder server where players will not be able to block each other builds.
Since my english is bad, i recorded a video which explains it better:
https://www.youtube.com/watch?v=ULKLUhf79k0
PHP Code:
while( ( entity = engfunc( EngFunc_FindEntityInSphere, entity, origin, radius ) ) > 0 )
{
new classname[64]
pev( entity, pev_classname, classname, charsmax( classname ) )
new Float:entityOrigin[3]
pev( entity, pev_origin, entityOrigin )
new Float:distance = vector_distance( origin, entityOrigin )
if( g_EntOwner[entity] != 0 )
{
color_chat( 0, "[Ent id: %i] [Classname: %s] [Distance: %f] [g_EntOwner: %d]", entity, classname, distance, g_EntOwner[entity] )
if(g_EntOwner[ent] != g_EntOwner[entity] && distance <= block_radius)
{
color_chat( 0, "[G_ENTOWNER MISMATCH]")
engfunc( EngFunc_SetOrigin, ent, Float:{ 0.0, 0.0, 0.0 } );
g_EntOwner[ent] = 0;
g_EntBlokovana[ent] = 0;
}
}
}
What im doing wrong?
Thanks!