Raised This Month: $51 Target: $400
 12% 

Different entities have different distance calculation? (EngFunc_FindEntityInSphere)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TFZMistery
Junior Member
Join Date: Jul 2013
Old 11-09-2020 , 07:59   Different entities have different distance calculation? (EngFunc_FindEntityInSphere)
Reply With Quote #1

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!
TFZMistery is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:18.


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