Quote:
Originally Posted by Scherzo
User origin its not whole user entity.
|
If that's an issue you can use EngFunc_GetBonePosition and check the point-contents of various body parts.
PHP Code:
static Float: fOrigin[ 3 ] , Float: fDummy[ 3 ];
engfunc( EngFunc_GetBonePosition , id , BONE_SPINE1 , fOrigin , fDummy );
Try this:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Check if Stuck"
#define VERSION "1.0"
#define AUTHOR "bugsy"
/*
#define BONE_SPINE1 3 //Spine
#define BONE_SPINE2 4 //Spine
#define BONE_SPINE3 5 //Spine
#define BONE_SPINE4 6 //Spine
#define BONE_HEAD 8 //Head
#define BONE_L_UPPERARM 11 //Left UpperArm
#define BONE_L_HAND 13 //Left Hand
#define BONE_L_SHOULDER 23 //Left shoulder outside
#define BONE_L_KNEE 40 //Left knee
#define BONE_L_FOOT 41 //Left Foot
#define BONE_R_UPPERARM 26 //Right UpperArm
#define BONE_R_HAND 28 //Right Hand
#define BONE_R_SHOULDER 39 //Right shoulder outside
#define BONE_R_KNEE 46 //Left knee
#define BONE_R_FOOT 47 //Left Foot
*/
new const g_Bones[] = { 3 , 4 , 5 , 6 , 8 , 11 , 13 , 23 , 40 , 41 , 26 , 28 , 39 , 46 , 47 };
public plugin_init()
{
register_plugin( PLUGIN , VERSION , AUTHOR );
register_clcmd( "say /start" , "DoStart" );
}
public DoStart( id )
{
set_task( 0.5 , "Stuck" , id , _ ,_, "b" );
}
public Stuck( id )
{
static Float: fOrigin[ 3 ] , Float: fDummy[ 3 ];
for ( new i = 0 ; i < sizeof g_Bones ; i++ )
{
engfunc(EngFunc_GetBonePosition, id , g_Bones[ i ] , fOrigin , fDummy );
if ( engfunc( EngFunc_PointContents , fOrigin ) == CONTENTS_SOLID )
{
client_print( id , print_chat , "Stuck in object" );
return;
}
}
client_print( id , print_chat , "Can move freely" );
}
__________________