A little more complete.
Code:
#include <amxmodx>
#include <fakemeta>
#define MAX_CLIENTS 32
new
g_iNormal_trace[ MAX_CLIENTS + 1 ],
g_iMaxClients;
public plugin_init()
{
register_forward( FM_TraceLine, "fwTraceline", 1 );
g_iMaxClients = global_get( glb_maxClients );
}
public client_connect( id )
{
g_iNormal_trace[id] = 0;
}
public client_disconnect( id )
{
g_iNormal_trace[id] = 0;
}
public fwTraceline( Float:start[3], Float:end[3], noMonsters, id, trace )
{
if( !( 1 <= id <= g_iMaxClients ) )
return FMRES_IGNORED;
if( !g_iNormal_trace[id] )
{
g_iNormal_trace[id] = trace;
return FMRES_IGNORED;
}
else if( trace == g_iNormal_trace[id] || !is_user_alive( id ) )
return FMRES_IGNORED;
if( !pev( id, pev_button ) & IN_ATTACK ) )
return FMRES_IGNORED;
// stuff
return FMRES_IGNORED;
}
Also, you can look at this another method :
http://forums.alliedmods.net/showthread.php?t=54887
__________________