I suspect that this could be optimized more, if I could see more of your code. I'm not sure.
Anyways, I'm not sure if this is compatible with your code. I think it will probably work:
PHP Code:
if( equal( szClassname, "func_button" ) )
{
static szTarget[32];
pev( iEntity, pev_target, szTarget, 31 );
new iNumAssigned = 0
// only if sizeof szCounterStart == sizeof szCounterStop
for( new i = 0; i < sizeof szCounterStart; i++ )
{
if( iNumAssigned == 4 )
break;
if( equal( szTarget, szCounterStart[i] ) )
{
if( !gButtons[START] )
{
gButtons[START] = iEntity;
iNumAssigned++;
}
else
{
gButtons[START2] = iEntity;
iNumAssigned++;
}
}
else if( equal( szTarget, szCounterStop[i] ) )
{
if( !gButtons[STOP] )
{
gButtons[STOP] = iEntity;
iNumAssigned++;
}
else
{
gButtons[STOP2] = iEntity;
iNumAssigned++;
}
}
}
}
__________________