AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Different entities have different distance calculation? (EngFunc_FindEntityInSphere) (https://forums.alliedmods.net/showthread.php?t=328439)

TFZMistery 11-09-2020 07:59

Different entities have different distance calculation? (EngFunc_FindEntityInSphere)
 
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 engfuncEngFunc_FindEntityInSphereentityoriginradius ) ) > )
    {
        
        new 
classname[64]
        
peventitypev_classnameclassnamecharsmaxclassname  ) )
        
        new 
Float:entityOrigin[3]
        
peventitypev_originentityOrigin )

        new 
Float:distance vector_distanceoriginentityOrigin )
        
        if( 
g_EntOwner[entity] != 0  )
        {
            
color_chat0"[Ent id: %i] [Classname: %s] [Distance: %f] [g_EntOwner: %d]"entityclassnamedistanceg_EntOwner[entity] )
            if(
g_EntOwner[ent] != g_EntOwner[entity] && distance <= block_radius)
            {
                
color_chat0"[G_ENTOWNER MISMATCH]")
                
engfuncEngFunc_SetOriginentFloat:{ 0.00.00.0 } );
                
g_EntOwner[ent] = 0;
                
g_EntBlokovana[ent] = 0;
            }
                
        }
    } 

What im doing wrong?
Thanks!


All times are GMT -4. The time now is 14:12.

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