i have a spray high code but some times it will just show 000000000000
Code:
public EventSpray ( )
{
new iPlayer = read_data( 2 );
if( !SprayContest || AlreadySprayed[ iPlayer ] )
{
return;
}
new iOrigin[ 3 ];
iOrigin[ 0 ] = read_data( 3 );
iOrigin[ 1 ] = read_data( 4 );
iOrigin[ 2 ] = read_data( 5 );
new Float:vecOrigin[ 3 ];
IVecFVec( iOrigin, vecOrigin );
new Float:vecDirection[ 3 ];
velocity_by_aim( iPlayer, 5, vecDirection );
new Float:vecStop[ 3 ];
xs_vec_add( vecOrigin, vecDirection, vecStop );
xs_vec_mul_scalar( vecDirection, -1.0, vecDirection );
new Float:vecStart[ 3 ];
xs_vec_add( vecOrigin, vecDirection, vecStart );
engfunc( EngFunc_TraceLine, vecStart, vecStop, IGNORE_MONSTERS, -1, 0 );
get_tr2( 0, TR_vecPlaneNormal, vecDirection );
vecDirection[ 2 ] = 0.0;
xs_vec_normalize( vecDirection, vecDirection );
xs_vec_mul_scalar( vecDirection, 5.0, vecDirection );
xs_vec_add( vecOrigin, vecDirection, vecStart );
xs_vec_copy( vecStart, vecStop );
vecStop[ 2 ] -= 9999.0;
engfunc( EngFunc_TraceLine, vecStart, vecStop, IGNORE_MONSTERS, -1, 0 );
get_tr2( 0, TR_vecEndPos, vecStop );
new Float:FinalMeters;
FinalMeters = (vecStart[ 2 ] - vecStop[ 2 ]) * 0.0254;
SprayContestMeters[ iPlayer] = FinalMeters;
AlreadySprayed[ iPlayer ] = true;
ColorChat( 0 , "^3%s ^1Sprayed ^4%f ^1Meters from the ground" , UserName( iPlayer ) , FinalMeters )
}
and also how can i check if player using any button and if he is what button