119 |
#include <amxmisc> |
#include <amxmisc> |
120 |
#include <fakemeta> |
#include <fakemeta> |
121 |
|
|
122 |
#define VERSION "1.2b1" |
#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 ) |
220 |
engfunc( EngFunc_GetAimVector, id, 1, ret ) |
engfunc( EngFunc_GetAimVector, id, 1, ret ) |
221 |
for( new i = 0; i < 3; i++ ) ret[i] = orig[i] + ( ret[i] * 9999 ) |
for( new i = 0; i < 3; i++ ) ret[i] = orig[i] + ( ret[i] * 9999 ) |
222 |
|
|
223 |
new tr = 0 |
engfunc( EngFunc_TraceLine, orig, ret, 0, id, 0 ) |
224 |
engfunc( EngFunc_TraceLine, orig, ret, 0, id, tr ) |
new target = get_tr2( 0, TR_pHit ) |
225 |
new target = get_tr2( tr, TR_pHit ) |
get_tr2( 0, TR_vecEndPos, ret ) |
|
get_tr2( tr, TR_vecEndPos, ret ) |
|
226 |
|
|
227 |
if( 0 < target <= MAXPLAYERS ) |
if( 0 < target <= MAXPLAYERS ) |
228 |
{ |
{ |
418 |
set_pev(target, pev_renderfx, kRenderFxGlowShell) |
set_pev(target, pev_renderfx, kRenderFxGlowShell) |
419 |
set_pev(target, pev_rendercolor, color) |
set_pev(target, pev_rendercolor, color) |
420 |
set_pev(target, pev_rendermode, kRenderTransColor) |
set_pev(target, pev_rendermode, kRenderTransColor) |
421 |
set_pev(target, pev_renderamt, get_pcvar_float( p_glow_b ) ) |
set_pev( target, pev_renderamt, get_pcvar_float( p_glow_a ) ) |
422 |
} |
} |
423 |
|
|
424 |
if( 0 < target <= MAXPLAYERS ) |
if( 0 < target <= MAXPLAYERS ) |
575 |
for( i = 0; i < 3; i++ ) |
for( i = 0; i < 3; i++ ) |
576 |
torig[i] = tmpvec[i] + tmpvec2[i] * j |
torig[i] = tmpvec[i] + tmpvec2[i] * j |
577 |
|
|
578 |
new tr = 0 |
engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, 0 ) |
579 |
engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, tr ) |
get_tr2( 0, TR_vecEndPos, trace_ret ) |
|
get_tr2( tr, 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 |
598 |
case 2 : torig[i] = orig[i] - ( i == 2 ? 80 : 40 ) |
case 2 : torig[i] = orig[i] - ( i == 2 ? 80 : 40 ) |
599 |
} |
} |
600 |
|
|
601 |
new tr2 = 0 |
engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, 0 ) |
602 |
engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, tr2 ) |
get_tr2( 0, TR_vecEndPos, trace_ret ) |
|
get_tr2( tr2, 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; |
|
|
} |
|