Raised This Month: $ Target: $400
 0% 

Find out if a player is "stuck"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 11-17-2006 , 18:26   Find out if a player is "stuck"
Reply With Quote #1

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.
__________________
Um, hi.
Ramono is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-17-2006 , 19:29   Re: Find out if a player is "stuck"
Reply With Quote #2

The hull tracing code from VEN's teleport smoke grenade plugin may help you: http://forums.alliedmods.net/showthread.php?t=47245
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 11-18-2006 , 05:57   Re: Find out if a player is "stuck"
Reply With Quote #3

That code is a bit hard to understand.
__________________
Um, hi.
Ramono is offline
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 11-18-2006 , 06:03   Re: Find out if a player is "stuck"
Reply With Quote #4

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
__________________

Last edited by schnitzelmaker; 11-18-2006 at 06:12.
schnitzelmaker is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 11-19-2006 , 11:40   Re: Find out if a player is "stuck"
Reply With Quote #5

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.
__________________
Um, hi.

Last edited by Ramono; 11-19-2006 at 11:43.
Ramono is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 11-21-2006 , 07:37   Re: Find out if a player is "stuck"
Reply With Quote #6

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;
}
Simon Logic is offline
Send a message via Skype™ to Simon Logic
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 12-14-2006 , 16:00   Re: Find out if a player is "stuck"
Reply With Quote #7

Can you/somone translate that to pawn please?
__________________
Um, hi.
Ramono is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-14-2006 , 16:24   Re: Find out if a player is "stuck"
Reply With Quote #8

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; }
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 12-14-2006 , 17:14   Re: Find out if a player is "stuck"
Reply With Quote #9

Quote:
Originally Posted by Ramono View Post
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
__________________
plop
p3tsin is offline
Reply


Thread Tools
Display Modes

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:51.


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