|
Member
Join Date: Sep 2013
Location: Russian Federation, Bela
|

10-12-2014
, 07:33
Re: Sometimes it throws sometimes not!!
|
#5
|
Quote:
Originally Posted by HamletEagle
Again, give us the full code or a simple one that has the same problem.
|
Here you go
PHP Code:
public UpdateClientData_Post( id, sendweapons, cd_handle )
{
if ( !is_user_alive(id) )
return FMRES_IGNORED;
if( get_user_weapon( id ) != CSW_KNIFE )
return FMRES_IGNORED;
set_cd(cd_handle, CD_flNextAttack, get_gametime( ) + 0.1 );
return FMRES_HANDLED;
}
public fwd_CmdStart(id, uc_handle, seed)
{
if(!is_user_alive(id))
return FMRES_IGNORED
if( get_user_weapon( id ) != CSW_KNIFE )
return FMRES_IGNORED;
static iButton;
iButton = get_uc( uc_handle, UC_Buttons );
if( iButton & IN_ATTACK )
{
set_uc( uc_handle, UC_Buttons, iButton & ~IN_ATTACK );
if( !g_bRoundStarted )
return FMRES_HANDLED;
ThrowKnife( id );
}
if( iButton & IN_ATTACK2 )
{
set_uc( uc_handle, UC_Buttons, iButton & ~IN_ATTACK2 );
}
return FMRES_HANDLED
}
public ThrowKnife( iIndex )
{
new Float:flGametime;
flGametime = get_gametime( );
if( g_flDelay[ iIndex ] > flGametime - KNIFE_DELAY )
return;
g_flDelay[ iIndex ] = flGametime;
new Float:flOrigin[ 3 ], Float:flVelocity[ 3 ], Float:flAngles[ 3 ], iEnt;
entity_get_vector( iIndex, EV_VEC_origin, flOrigin );
entity_get_vector( iIndex, EV_VEC_v_angle, flAngles );
iEnt = create_entity( "info_target" );
if( !iEnt )
{
log_amx( "ERROR: Entity isn't valid(%d)!", iEnt );
return;
}
entity_set_string( iEnt, EV_SZ_classname, KNIFE_ENT );
entity_set_model( iEnt, KNIFE_MODEL );
new Float:MinBox[ 3 ] = { -1.0, -7.0, -1.0 };
new Float:MaxBox[ 3 ] = { 1.0, 7.0, 1.0 };
entity_set_size( iEnt, MinBox, MaxBox );
flAngles[ 0 ] -= 90.0;
entity_set_origin( iEnt, flOrigin );
entity_set_vector( iEnt, EV_VEC_angles, flAngles );
entity_set_int( iEnt, EV_INT_effects, 2 );
entity_set_int( iEnt, EV_INT_solid, 1 );
entity_set_int( iEnt, EV_INT_movetype, 6 );
entity_set_edict( iEnt, EV_ENT_owner, iIndex );
set_rendering( iEnt, kRenderFxGlowShell, 0, 250, 0, kRenderNormal, 25 );
VelocityByAim( iIndex, KNIFE_SPEED, flVelocity );
entity_set_vector( iEnt, EV_VEC_velocity, flVelocity );
}
|
|