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

[TF2] Entity inside bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoldTreeServers
Senior Member
Join Date: Dec 2012
Old 06-01-2014 , 07:50   [TF2] Entity inside bounds
Reply With Quote #1

Helloo! I have small problem with check is entity inside bounds. Here is my code:

PHP Code:
public bool:EntityInBounds(entityFloat:minBounds[], Float:maxBounds[])
{
    
decl Float:position[3];
    
GetEntPropVector(entityProp_Send"m_vecOrigin"position);
    
    for (new 
03i++)
    {
        if (!(
minBounds[i] <= position[i] && position[i] <= maxBounds[i]))
        {
            return 
false;
        }
    }
    
    return 
true;

I check blue team sticky is close red team spawn door and it works but if red team sticky is close blue team spawn door it not work.

PHP Code:
        if (GetEntProp(iStickyProp_Send"m_iTeamNum") == 3)
        {
            
decl Float:minBoundsRed[] = {-645.0, -200.00.0};
            
decl Float:maxBoundsRed[] = {-550.0230.0215.0};
            
            if (
EntityInBounds(iStickyminBoundsRedmaxBoundsRed))
            {
                
AcceptEntityInput(iSticky"Kill");
                
                new 
owner GetEntPropEnt(iStickyProp_Send"m_hThrower");
                
                if (
owner && owner <= MaxClients)
                    
PrintHintText(owner"Please do not sticky camp spawnroom!");
            }
        }
        else if (
GetEntProp(iStickyProp_Send"m_iTeamNum") == 2)
        {
            
decl Float:minBoundsBlue[] = {645.0200.00.0};
            
decl Float:maxBoundsBlue[] = {550.0, -230.0215.0};
            
            if (
EntityInBounds(iStickyminBoundsBluemaxBoundsBlue))
            {
                
AcceptEntityInput(iSticky"Kill");
                
                new 
owner GetEntPropEnt(iStickyProp_Send"m_hThrower");
                
                if (
owner && owner <= MaxClients)
                    
PrintHintText(owner"Please do not sticky camp spawnroom!");
            }
        } 
__________________
GoldTreeServers is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 06-01-2014 , 23:41   Re: [TF2] Entity inside bounds
Reply With Quote #2

Might be easier to hook starttouch the spawnrooms or make a trigger that can touch physics ents, and then remove them ontouch
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
GoldTreeServers
Senior Member
Join Date: Dec 2012
Old 06-02-2014 , 01:34   Re: [TF2] Entity inside bounds
Reply With Quote #3

Quote:
Originally Posted by friagram View Post
Might be easier to hook starttouch the spawnrooms or make a trigger that can touch physics ents, and then remove them ontouch
Yeah but i use coordinates because i want you can't put stickys outside door and not inside

My EntityInBounds code fails somehow

EDIT: I made bit tests with C# and problem is negative and positive. IDK how to resolve it...
__________________

Last edited by GoldTreeServers; 06-02-2014 at 02:17.
GoldTreeServers 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 03:16.


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