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

Player between a Rectangle


Post New Thread Reply   
 
Thread Tools Display Modes
DarkEnergy
SourceMod Donor
Join Date: Apr 2008
Location: Georgia Tech, MSECE
Old 11-03-2010 , 20:07   Re: Player between a Rectangle
Reply With Quote #11

it should note it uses abs-origin, not eye-pos

nice job, if only it can be used to detect player stuck *cough check hull doesnt capture everything*?
__________________
War3:Source Developer
"Your CPU is just a bunch of Muxes"
DarkEnergy is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 11-04-2010 , 08:59   Re: Player between a Rectangle
Reply With Quote #12

PHP Code:
stock bool:IsPlayerInside(const client, const Float:mins[3], const Float:maxs[3])
{
    
//Check if client is connected, in game, has origin
    
decl Float:pos[3];
    
GetClientAbsOrigin(clientpos);
    return 
IsPositionInside(posminsmaxs);
}

stock bool:IsPositionInside(const Float:pos[3], const Float:mins[3], const Float:maxs[3])
{
    if ((
pos[0] > mins[0]) && (pos[0] < maxs[0]) && (pos[1] > mins[1]) && (pos[1] < maxs[1]) && (pos[2] > mins[2]) && (pos[2] < maxs[2]))
    {
        return 
true;
    }
    return 
false;

__________________
FaTony is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 11-10-2010 , 09:48   Re: Player between a Rectangle
Reply With Quote #13

This uses too big assumptions to be useful.
It assumes that the cube is parallel with the axis in every direction.
2 points is not enough to define a cube without those assumptions, though.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 11-10-2010 , 23:59   Re: Player between a Rectangle
Reply With Quote #14

Quote:
Originally Posted by Monkeys View Post
This uses too big assumptions to be useful.
It assumes that the cube is parallel with the axis in every direction.
2 points is not enough to define a cube without those assumptions, though.
That is an optimization of the initial code.
__________________
FaTony is offline
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 11-16-2010 , 18:28   Re: Player between a Rectangle
Reply With Quote #15

This is awesome. Lets modders set up special areas in a map without trigger_multiple.
NatalyaAF is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 11-17-2010 , 03:01   Re: Player between a Rectangle
Reply With Quote #16

...but trigger_multiple will save many CPU cycles.
__________________
FaTony 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 15:35.


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