30.10.2013, 16:20
Hello. Can we use 2 same keys under OnPlayerKeyStateChange? For example, i have to seperate ifs or keys, or however i can clal it, for entering a door and exiting it. Both are 'F'.
new
bool: PlayerEntered[ MAX_PLAYERS char ]
;
// OnPlayerConnect:
PlayerEntered{ playerid } = false;
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
if( ( newkeys & KEY_SECONDARY_ATTACK ) && !( oldkeys & KEY_SECONDARY_ATTACK ) )
{
if( !PlayerEntered{ playerid } )
{
// enter..
PlayerEntered{ playerid } = true;
}
else
{
// exit..
PlayerEntered{ playerid } = false;
}
}
return 1;
}
if(test == 0) { test=2; } //if this isnt called
else if(test == 2) {} //this is - however, even if we set the test var to 2, this wont be called if the first if is
else {} //if above isnt called, this is
if(test == 2) {} //after that check above, this block comes next
else { test=2;} //if above isn't true, this is called (which it is, so this wont be called)