Hi, I successfully made it to block reloading if ammo is 5 or > .
But when it comes to firing a weapon, i can't seem to make it.
I want it to be able to shoot each 1 seccond, and if it hasn't come i just returned
that it was handled by fakemeta( FMRES_HANDLED )
Thing is even THAT doesn't work, and when i shoot its just like a non-stopping 1ms
taking to shoot firing - its very fast, and ACTUALLY don't hit people, glass any other ent's.
So thats why im asking how to fix it, since i wan't the scout to fire each 1 second, not each 1ms...
PHP Code:
public fw_CmdStart( client, uc_handle, seed )
{
// Ignore dead/those who haven't our weapon
new ammo, clip, weapon = get_user_weapon( client, clip, ammo );
if ( !is_user_alive( client ) || !g_has_scout[ client ] || weapon != CSW_SCOUT )
return FMRES_IGNORED;
// Buttons
new buttons = get_uc( uc_handle, UC_Buttons );
if( buttons & IN_RELOAD )
{
if( clip >= 5 )
{
buttons &= ~IN_RELOAD;
set_uc( uc_handle, UC_Buttons, buttons );
return FMRES_HANDLED;
}
}
if( buttons & IN_ATTACK )
{
if( clip >= 1 )
{
if( get_gametime( ) - g_last[ client ] > 1.0 )
{
g_last[ client ] = get_gametime( );
cs_set_weapon_ammo( find_ent_by_owner( -1, "weapon_scout", client ), cs_get_weapon_ammo( client ) - 1 );
buttons &= ~IN_ATTACK;
set_uc( uc_handle, UC_Buttons, buttons );
return FMRES_IGNORED;
}
else
{
buttons &= ~IN_ATTACK;
set_uc( uc_handle, UC_Buttons, buttons );
return FMRES_HANDLED;
}
}
}
return FMRES_IGNORED;
}