how to cancel out or ignore other ir signals

How to block out other ir codes so the receiver only accepts one signal but not any other?

i tried using the else statement but it doesn't work for example

} else {
Serial.println("IR signal received but not recognized");

this is my program

#include <IRremote.h>
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(11 * 1, PIN, NEO_GRB + NEO_KHZ800);
IRsend irsend;
SoftwareSerial BT(0, 1); //TX, RX respetively
String readdata;
int vSpeed = 100;
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int speakerPin = 12;

int maxHealth = 5; // Number of times you can get shot before dying
int myHealth = maxHealth;
int deadTime = 1000000000; // Number of ms you stay dead
int deathCount = 0;

int hitState = HIGH;
int lastHitState = HIGH;

void setup() {
BT.begin(9600);
strip.begin();
strip.show();
Serial.begin(9600);
irrecv.enableIRIn();
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(speakerPin, OUTPUT);
colorWipe(strip.Color(204, 0, 204), 10);

}
//-----------------------------------------------------------------------//
void loop(void) {
while (BT.available()) { //Check if there is an available byte to read
delay(10); //Delay added to make thing stable
char c = BT.read(); //Conduct a serial read
readdata += c; //build the string- "forward", "reverse", "left" and "right"
}
if (readdata.length() > 0) {
Serial.println(readdata);

if (readdata == "forward")
{
analogWrite(10, vSpeed);
analogWrite (9, LOW);
analogWrite(5, vSpeed);
analogWrite(4, LOW);
delay(100);
}

else if (readdata == "back")
{
analogWrite(10, LOW);
analogWrite(9, vSpeed);
analogWrite(5, LOW);
analogWrite(4, vSpeed);
delay(100);
}

else if (readdata == "right")
{
analogWrite (10, vSpeed);
analogWrite (9, LOW);
analogWrite (5, LOW);
analogWrite (4, LOW);
delay (100);

}

else if ( readdata == "left")
{
analogWrite (10, LOW);
analogWrite (9, HIGH);
analogWrite (5, vSpeed);
analogWrite (4, LOW);
delay (100);
}

else if ( readdata == "reload")
{
rainbowCycle(5);
}

else if (readdata == "stop")
{
digitalWrite (10, LOW);
digitalWrite (9, LOW);
digitalWrite (5, LOW);
digitalWrite (4, LOW);
delay (100);
}

else if (readdata == "shoot")
{
irsend.sendNEC(0x189710EF, 32);
delay(40);
}
irrecv.enableIRIn();
readdata = "";

}

//Reset the variable
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);

if (results.value == 0xFF30CF) {
Serial.println("HIT");
colorWipe(strip.Color(255, 0, 0), 1); // Red
delay(100);
colorWipe(strip.Color(204, 0, 204), 10);
myHealth--;
if (myHealth <= 0) {
Serial.println("DEAD!");
deathCount++;
colorWipe(strip.Color(255, 0, 0), 1);
delay(deadTime);
myHealth = maxHealth;
Serial.println("Ready again!");

} else {
Serial.println("IR signal received but not recognized");

}

irrecv.resume(); // Receive the next value

}
delay(100);
}
}
void colorWipe(uint32_t c, uint8_t wait) {
for (uint16_t i = 0; i < strip.numPixels(); i++) {
#ifdef DEBUG
Serial.print("set pixel ");
Serial.print(i);
Serial.print(" of ");
Serial.print(strip.numPixels());
#endif
strip.setPixelColor(i, c);
#ifdef DEBUG
Serial.println(" - ok");
#endif
//delay(wait);
}
strip.show();
}

void rainbow(uint8_t wait) {
uint16_t i, j;

for (j = 0; j < 256; j++) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i + j) & 255));
}
strip.show();
delay(wait);
}
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint16_t i, j;

for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait);
}
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
for (int j = 0; j < 10; j++) { //do 10 cycles of chasing
for (int q = 0; q < 3; q++) {
for (int i = 0; i < strip.numPixels(); i = i + 3) {
strip.setPixelColor(i + q, c); //turn every third pixel on
}
strip.show();

delay(wait);

for (int i = 0; i < strip.numPixels(); i = i + 3) {
strip.setPixelColor(i + q, 0); //turn every third pixel off
}
}
}
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
for (int j = 0; j < 256; j++) { // cycle all 256 colors in the wheel
for (int q = 0; q < 3; q++) {
for (int i = 0; i < strip.numPixels(); i = i + 3) {
strip.setPixelColor(i + q, Wheel( (i + j) % 255)); //turn every third pixel on
}
strip.show();

delay(wait);

for (int i = 0; i < strip.numPixels(); i = i + 3) {
strip.setPixelColor(i + q, 0); //turn every third pixel off
}
}
}
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if (WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if (WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}

I SOLVED IT.

Add the irresume code higher up the receive loop

If you had put your code in [­code]...[­/code] tags I might have looked at it sooner, but as it was I could not be bothered to copy and paste the code.

I don't think this is quite what you intended...

    if (results.value == 0xFF30CF) {
    ···
      if (myHealth <= 0) {
    ···
      } else {  // myHeath > 0
        Serial.println("IR signal received but not recognized");
      }
    }
this is my program

#include <IRremote.h>
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(11 * 1, PIN, NEO_GRB + NEO_KHZ800);
IRsend irsend;
SoftwareSerial BT(0, 1); //TX, RX respetively

Still trying to do the impossible, I see. Give it up NOW.