Yep there we go fully optimized:
Note that with only 2 cases there is not any major performance gain as it should be almost exactly the same as an if else but as soon as there is more than 2 this method is better and is thus preferred. Also it can make things easier to read.Code:public OnAbilityCommand( client, ability, bool:pressed ) { if(War3_GetRace(client) == thisRaceID && IsPlayerAlive(client)) { if(pressed) { switch (ability) { //Plant case 0: { new skill_level = skill_level_item[client]; if(skill_level > 0 && !Silenced(client)) { } } //Activate case 1: { new skill_level = skill_level_item[client]; if(skill_level > 0 && !Silenced(client)) { } } } } } }







Register To Reply