119 |
#include <amxmisc> |
#include <amxmisc> |
120 |
#include <fakemeta> |
#include <fakemeta> |
121 |
|
|
122 |
#define VERSION "1.2b3" |
#define VERSION "1.2b4" |
123 |
#define ADMIN ADMIN_LEVEL_A |
#define ADMIN ADMIN_LEVEL_A |
124 |
|
|
125 |
#define TSK_CHKE 50 |
#define TSK_CHKE 50 |
189 |
|
|
190 |
register_event( "DeathMsg", "DeathMsg", "a" ) |
register_event( "DeathMsg", "DeathMsg", "a" ) |
191 |
|
|
192 |
|
register_forward( FM_PlayerPreThink, "fm_player_prethink" ) |
193 |
|
|
194 |
register_dictionary( "grab_plus.txt" ) |
register_dictionary( "grab_plus.txt" ) |
195 |
|
|
196 |
MAXPLAYERS = get_maxplayers() |
MAXPLAYERS = get_maxplayers() |
207 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
208 |
} |
} |
209 |
|
|
210 |
public client_PreThink( id ) |
public fm_player_prethink( id ) |
211 |
{ |
{ |
212 |
//Search for a target |
//Search for a target |
213 |
if ( client_data[id][GRABBED] == -1 ) |
if ( client_data[id][GRABBED] == -1 ) |
579 |
get_tr2( 0, TR_vecEndPos, trace_ret ) |
get_tr2( 0, TR_vecEndPos, trace_ret ) |
580 |
|
|
581 |
if( get_distance_f( trace_ret, torig ) ) break |
if( get_distance_f( trace_ret, torig ) ) break |
582 |
if( !_trace_hull( torig, HULL_HUMAN ) ) safe = true |
|
583 |
|
engfunc( EngFunc_TraceHull, torig, torig, 0, HULL_HUMAN, 0, 0 ) |
584 |
|
if ( !get_tr2( 0, TR_StartSolid ) && !get_tr2( 0, TR_AllSolid ) && get_tr2( 0, TR_InOpen ) ) |
585 |
|
safe = true |
586 |
} |
} |
587 |
|
|
588 |
//Still not safe? Then find another safe spot somewhere around the grabber |
//Still not safe? Then find another safe spot somewhere around the grabber |
601 |
engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, 0 ) |
engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, 0 ) |
602 |
get_tr2( 0, TR_vecEndPos, trace_ret ) |
get_tr2( 0, TR_vecEndPos, trace_ret ) |
603 |
|
|
604 |
if( !_trace_hull( torig, HULL_HUMAN ) && !get_distance_f( trace_ret, torig ) ) safe = true |
engfunc( EngFunc_TraceHull, torig, torig, 0, HULL_HUMAN, 0, 0 ) |
605 |
|
if ( !get_tr2( 0, TR_StartSolid ) && !get_tr2( 0, TR_AllSolid ) && get_tr2( 0, TR_InOpen ) |
606 |
|
&& !get_distance_f( trace_ret, torig ) ) safe = true |
607 |
|
|
608 |
try[0]++ |
try[0]++ |
609 |
if( try[0] == 3 ) |
if( try[0] == 3 ) |
658 |
else if( client_data[id][GRABBER] ) |
else if( client_data[id][GRABBER] ) |
659 |
unset_grabbed( client_data[id][GRABBER] ) |
unset_grabbed( client_data[id][GRABBER] ) |
660 |
} |
} |
|
|
|
|
//Complements of vittu |
|
|
//Complements of fakemeta_util, cause i was too lazy to add this in as not a function |
|
|
_trace_hull(const Float:origin[3], hull, ignoredent = 0, ignoremonsters = 0) { |
|
|
new result = 0; |
|
|
engfunc(EngFunc_TraceHull, origin, origin, ignoremonsters, hull, ignoredent > 0 ? ignoredent : 0, 0); |
|
|
|
|
|
if (get_tr2(0, TR_StartSolid)) |
|
|
result += 1; |
|
|
if (get_tr2(0, TR_AllSolid)) |
|
|
result += 2; |
|
|
if (!get_tr2(0, TR_InOpen)) |
|
|
result += 4; |
|
|
|
|
|
return result; |
|
|
} |
|