Well to me, the button handling seen very complicated but maybe you should add wait 0.01 somwhere in the for loop? Perhaps that it's looping so fast that the game can't recognise the player's button presses.
Code:
buttonHandler()
{
self endon( "disconnect" );
self endon( "death" );
buttons = "N|+actionslot 1,5|+actionslot 2,3|+actionslot 3,4|+actionslot 4,F|+activate,R|+reload,E|+melee,1|weapnext,SPACE|+gostand,Q|+smoke,G|+frag,W|+forward,S|+back,A|+moveleft,D|+moveright,RM|+toggleads_throw";
buttonArray = strTok( buttons, "," );
self notifyOnPlayerCommand( "N", "+actionslot 1" );
self notifyOnPlayerCommand( "5", "+actionslot 2" );
self notifyOnPlayerCommand( "3", "+actionslot 3" );
self notifyOnPlayerCommand( "4", "+actionslot 4" );
self notifyOnPlayerCommand( "F", "+activate" );
self notifyOnPlayerCommand( "R", "+reload" );
self notifyOnPlayerCommand( "E", "+melee" );
self notifyOnPlayerCommand( "1", "weapnext" );
self notifyOnPlayerCommand( "SPACE", "+gostand" );
self notifyOnPlayerCommand( "Q", "+smoke" );
self notifyOnPlayerCommand( "G", "+frag" );
self notifyOnPlayerCommand( "RM", "+toggleads_throw" );
self notifyOnPlayerCommand( "W", "+forward" );
self notifyOnPlayerCommand( "S", "+back" );
self notifyOnPlayerCommand( "A", "+moveleft" );
self notifyOnPlayerCommand( "D", "+moveright" );
for(;;)
{
ent = spawnstruct();
foreach ( button in buttonArray )
{
array = strTok( button, "|" );
self thread waittill_string( array[0], ent );
}
ent waittill( "returned", result );
ent notify( "die" );
self notify( "buttonPress", result );
// combo section
if( isDefined(self.verified) && !self.verified ) continue;// no combos if unverified
if( isDefined(self.inMenu) && !self.inMenu ) continue; // or if in a menu
if( getTime() - self.buttonTimeCombo[self.buttonTimeCombo.size-1] > 2000 ) // 2 secs since last press == too slow :]
{
self.buttonListCombo = [];
self.buttonTimeCombo = [];
}
if( getTime() - self.buttonTimePress[self.buttonTimePress.size-1] > 550 )
{
self.buttonListPress = [];
self.buttonTimePress = [];
}
self.buttonListCombo[self.buttonListCombo.size] = result;
self.buttonTimeCombo[self.buttonTimeCombo.size] = getTime();
self.buttonListPress[self.buttonListPress.size] = result;
self.buttonTimePress[self.buttonTimePress.size] = getTime();
for( b = 0; b < self.buttonListCombo.size; b++ )
{
combo = "";
for ( c = b; c < self.buttonListCombo.size; c++ ) combo += self.buttonListCombo[c] + ",";
combo = getSubStr( combo, 0, combo.size-1 );
keys = getArrayKeys( level.combos );
foreach ( key in keys )
{
if( key == combo )
{
self thread [[level.combos[key]]]();
self.buttonListCombo = [];
self.buttonTimeCombo = [];
break;
}
}
}
wait 0.01;
}
}
/marked as solved