AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Player between a Rectangle (https://forums.alliedmods.net/showthread.php?t=142126)

DarkEnergy 11-03-2010 20:07

Re: Player between a Rectangle
 
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*?

FaTony 11-04-2010 08:59

Re: Player between a Rectangle
 
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;



Monkeys 11-10-2010 09:48

Re: Player between a Rectangle
 
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.

FaTony 11-10-2010 23:59

Re: Player between a Rectangle
 
Quote:

Originally Posted by Monkeys (Post 1346591)
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.

NatalyaAF 11-16-2010 18:28

Re: Player between a Rectangle
 
This is awesome. Lets modders set up special areas in a map without trigger_multiple.

FaTony 11-17-2010 03:01

Re: Player between a Rectangle
 
...but trigger_multiple will save many CPU cycles.


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

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