AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find out if a player is "stuck" (https://forums.alliedmods.net/showthread.php?t=47434)

Ramono 11-17-2006 18:26

Find out if a player is "stuck"
 
How to find out if a player is stuck into another (solid) entity

maybe get the size of the entity and see if the player is in it?
get_distance ??
entity_get_vector(ent,EV_VEC_mins,mins)
entity_get_vector(ent,EV_VEC_maxs,maxs)

i'm not sure of how to do this.

Thanks,
Ramon.

XxAvalanchexX 11-17-2006 19:29

Re: Find out if a player is "stuck"
 
The hull tracing code from VEN's teleport smoke grenade plugin may help you: http://forums.alliedmods.net/showthread.php?t=47245

Ramono 11-18-2006 05:57

Re: Find out if a player is "stuck"
 
That code is a bit hard to understand. :o

schnitzelmaker 11-18-2006 06:03

Re: Find out if a player is "stuck"
 
I write an example,in engine:
Code:
//point_hull=0, human_hull=1, large_hull=2, head_hull=3 }; //trace_hull ( Float:origin[3], hull, [ ignoredent=0, ignoremonsters=0 ] ) if ( trace_hull(origin, HULL_HUMAN, idtoskip) == 0 )   client_print(id,print_chat,"you are NOT stucked") else client_print(id,print_chat,"you are stucked")

Trace hull return a value of the object which is touched by trace hull:walls,ids,...

and for fakemeta:
Code:

enum
{
        TR_AllSolid,                        // (int) if true, plane is not valid
        TR_StartSolid,                // (int) if true, the initial point was in a solid area
        TR_InOpen,                // (int)
        TR_InWater,        // (int)
        TR_Fraction,                        // (float) time completed, 1.0 = didn't hit anything
        TR_EndPos,                        // (vector) final position
        TR_PlaneDist,                // (float)
        TR_PlaneNormal,                // (vector) surface normal at impact
        TR_Hit,                                // (entity) entity the surface is on
        TR_Hitgroup                        // (int) 0 == generic, non zero is specific body part
};

Code:
new tr = 0 //EngFunc_TraceHull,(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); engfunc(EngFunc_TraceHull, origin, origin, 0, hull, idtoskip, tr) if (!get_tr2(tr, TR_StartSolid) && !get_tr2(tr, TR_AllSolid) && get_tr2(tr, TR_InOpen))     return true return false

Ramono 11-19-2006 11:40

Re: Find out if a player is "stuck"
 
When u duck it says your stuck, and there are some other bugs, i only want to check it a player is stuck in a other player.

Thanks,
Ramon.


Edit: by looking into the smoke teleport plugin i found out how to fix it,
Change to hull_head if ducking.

Simon Logic 11-21-2006 07:37

Re: Find out if a player is "stuck"
 
HLSDK:cbase.cpp

Code:

int        CBaseEntity :: Intersects( CBaseEntity *pOther )
{
        if ( pOther->pev->absmin.x > pev->absmax.x ||
                pOther->pev->absmin.y > pev->absmax.y ||
                pOther->pev->absmin.z > pev->absmax.z ||
                pOther->pev->absmax.x < pev->absmin.x ||
                pOther->pev->absmax.y < pev->absmin.y ||
                pOther->pev->absmax.z < pev->absmin.z )
                return 0;
        return 1;
}


Ramono 12-14-2006 16:00

Re: Find out if a player is "stuck"
 
Can you/somone translate that to pawn please?

dutchmeat 12-14-2006 16:24

Re: Find out if a player is "stuck"
 
I think this is the correct translation, well you can always try.

Code:
public Intersects( ent ) //whatever the hell that means {  new mins[3],maxs[3]  entity_get_vector(ent,EV_VEC_mins,mins)  entity_get_vector(ent,EV_VEC_maxs,maxs)  if ( mins[0] > maxs[0] ||    mins[1] > maxs[1] ||    mins[2] > maxs[2] ||    maxs[0] < mins[0] ||    maxs[1] < mins[1] ||    maxs[2] < mins[2] )    return 0;  return 1; }

p3tsin 12-14-2006 17:14

Re: Find out if a player is "stuck"
 
Quote:

Originally Posted by Ramono (Post 415386)
Can you/somone translate that to pawn please?


Code:
stock intersects(ent1,ent2) {     static Float:minsa[3], Float:maxsa[3]     static Float:minsb[3], Float:maxsb[3]     pev(ent1,pev_absmin, minsa)     pev(ent1,pev_absmax, maxsa)     pev(ent2,pev_absmin, minsb)     pev(ent2,pev_absmax, maxsb)     if(minsb[0] > maxsa[0] ||         minsb[1] > maxsa[1] ||         minsb[2] > maxsa[2] ||         maxsb[0] < minsa[0] ||         maxsb[1] < minsa[1] ||         maxsb[2] < minsa[2])         return 0     return 1 }
didnt test, but it looks fine to me :wink:


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

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