--- grab_plus.sma 2007/10/30 23:44:10 5 +++ grab_plus.sma 2007/11/02 01:14:09 9 @@ -1,5 +1,5 @@ /* -Grab+ v1.1 +Grab+ v1.2 Copyright (C) 2007 Ian (Juan) Cammarata This program is free software; you can redistribute it and/or modify it under @@ -16,7 +16,7 @@ -------------------------------------------------------------------------------- http://ian.cammarata.us/projects/grab_plus -Oct 16 21:03 +Nov 01 04:16 Description: @@ -63,9 +63,13 @@ gp_choketime <1.5|...> Time frequency for choking. gp_chokedmg <5|...> Amount of damage done with each choke. -gp_glow_r <50|0-255> Sets red amount for glow. -gp_glow_g <0|0-255> Sets green amount for glow. -gp_glow_b <0|0-255> Sets blue amount for glow. +gp_screenfade <1|0> Enables/disables screenfade when grabbing. +gp_glow <1|0> Enables/disables glowing for grabbed objects. + +gp_glow_r <50|0-255> Sets red amount for glow and screenfade. +gp_glow_g <0|0-255> Sets green amount for glow and screenfade. +gp_glow_b <0|0-255> Sets blue amount for glow and screenfade. +gp_glow_a <0|0-255> Sets alpha for glow and screenfade. Notes: @@ -119,7 +123,7 @@ #include #include -#define VERSION "1.2b1" +#define VERSION "1.2b5" #define ADMIN ADMIN_LEVEL_A #define TSK_CHKE 50 @@ -189,6 +193,8 @@ register_event( "DeathMsg", "DeathMsg", "a" ) + register_forward( FM_PlayerPreThink, "fm_player_prethink" ) + register_dictionary( "grab_plus.txt" ) MAXPLAYERS = get_maxplayers() @@ -205,7 +211,7 @@ return PLUGIN_CONTINUE } -public client_PreThink( id ) +public fm_player_prethink( id ) { //Search for a target if ( client_data[id][GRABBED] == -1 ) @@ -215,13 +221,12 @@ pev( id, pev_view_ofs, ret ) for( new i = 0; i < 3; i++ ) orig[i] += ret[i] - engfunc( EngFunc_GetAimVector, id, 1, ret ) + velocity_by_aim( id, 1, ret ) for( new i = 0; i < 3; i++ ) ret[i] = orig[i] + ( ret[i] * 9999 ) - new tr = 0 - engfunc( EngFunc_TraceLine, orig, ret, 0, id, tr ) - new target = get_tr2( tr, TR_pHit ) - get_tr2( tr, TR_vecEndPos, ret ) + engfunc( EngFunc_TraceLine, orig, ret, 0, id, 0 ) + new target = get_tr2( 0, TR_pHit ) + get_tr2( 0, TR_vecEndPos, ret ) if( 0 < target <= MAXPLAYERS ) { @@ -296,7 +301,7 @@ pev( id, pev_origin, dest ) pev( id, pev_view_ofs, tmpvec ) - engfunc(EngFunc_GetAimVector, id, len, tmpvec2) + velocity_by_aim( id, len, tmpvec2 ) torig = get_target_origin_f( target ) new force = get_pcvar_num( p_grabforce ) @@ -368,7 +373,7 @@ if( target > 0 ) { new Float:pVelocity[3] - engfunc( EngFunc_GetAimVector, id, get_pcvar_num( p_throwforce ), pVelocity ) + velocity_by_aim( id, get_pcvar_num(p_throwforce), pVelocity ) set_pev( target, pev_velocity, pVelocity ) unset_grabbed( id ) return PLUGIN_HANDLED @@ -414,10 +419,10 @@ color[0] = get_pcvar_float( p_glow_r ) color[1] = get_pcvar_float( p_glow_g ) color[2] = get_pcvar_float( p_glow_b ) - set_pev(target, pev_renderfx, kRenderFxGlowShell) - set_pev(target, pev_rendercolor, color) - set_pev(target, pev_rendermode, kRenderTransColor) - set_pev(target, pev_renderamt, get_pcvar_float( p_glow_b ) ) + set_pev( target, pev_renderfx, kRenderFxGlowShell ) + set_pev( target, pev_rendercolor, color ) + set_pev( target, pev_rendermode, kRenderTransColor ) + set_pev( target, pev_renderamt, get_pcvar_float( p_glow_a ) ) } if( 0 < target <= MAXPLAYERS ) @@ -567,19 +572,21 @@ pev( id, pev_origin, orig ) pev( id, pev_view_ofs, tmpvec ) for( i = 0; i < 3; i++ ) tmpvec[i] += orig[i] - engfunc( EngFunc_GetAimVector, id, get_pcvar_num( p_mindist ), tmpvec2 ) + velocity_by_aim( id, get_pcvar_num( p_mindist ), tmpvec2 ) for( new j = 1; j < 11 && !safe; j++ ) { for( i = 0; i < 3; i++ ) torig[i] = tmpvec[i] + tmpvec2[i] * j - - new tr = 0 - engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, tr ) - get_tr2( tr, TR_vecEndPos, trace_ret ) + + engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, 0 ) + get_tr2( 0, TR_vecEndPos, trace_ret ) if( get_distance_f( trace_ret, torig ) ) break - if( !_trace_hull( torig, HULL_HUMAN ) ) safe = true + + engfunc( EngFunc_TraceHull, torig, torig, 0, HULL_HUMAN, 0, 0 ) + if ( !get_tr2( 0, TR_StartSolid ) && !get_tr2( 0, TR_AllSolid ) && get_tr2( 0, TR_InOpen ) ) + safe = true } //Still not safe? Then find another safe spot somewhere around the grabber @@ -595,11 +602,12 @@ case 2 : torig[i] = orig[i] - ( i == 2 ? 80 : 40 ) } - new tr2 = 0 - engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, tr2 ) - get_tr2( tr2, TR_vecEndPos, trace_ret ) + engfunc( EngFunc_TraceLine, tmpvec, torig, 0, id, 0 ) + get_tr2( 0, TR_vecEndPos, trace_ret ) - if( !_trace_hull( torig, HULL_HUMAN ) && !get_distance_f( trace_ret, torig ) ) safe = true + engfunc( EngFunc_TraceHull, torig, torig, 0, HULL_HUMAN, 0, 0 ) + if ( !get_tr2( 0, TR_StartSolid ) && !get_tr2( 0, TR_AllSolid ) && get_tr2( 0, TR_InOpen ) + && !get_distance_f( trace_ret, torig ) ) safe = true try[0]++ if( try[0] == 3 ) @@ -654,19 +662,3 @@ else if( client_data[id][GRABBER] ) unset_grabbed( client_data[id][GRABBER] ) } - -//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; -}