[Half-Life AMXX] / grab_plus.sma Repository:
ViewVC logotype

Diff of /grab_plus.sma

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7, Thu Nov 1 05:52:30 2007 UTC revision 8, Thu Nov 1 11:15:08 2007 UTC
# Line 119  Line 119 
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
# Line 189  Line 189 
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()
# Line 205  Line 207 
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 )
# Line 577  Line 579 
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
# Line 596  Line 601 
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 )
# Line 651  Line 658 
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;  
 }  

Legend:
Removed from v.7  
changed lines
  Added in v.8

Contact
ViewVC Help
Powered by ViewVC 1.0.4