Enemy range problem?

I want to know how to make a enemy whith a certain fire range in the script editor.
I got this code from a demo
if(x<player.x)
{xvelocity = attackmode;animation=1;}
if(x>player.x)
{xvelocity = -attackmode;animation=0;}
if(x>player.x-300)
{if(x<player.x+300)
{if(animation==1)
{CreateActor("bullet", "icon", "(none)", "(none)", 0, 0, false);}
if(animation==0)
CreateActor("bullet", "icon", "(none)", "(none)", 0, 0, false);}}
I want someone to make it work only in certain areas.Like +300 thru +200 and -300 thru -200.
I got this code from a demo
if(x<player.x)
{xvelocity = attackmode;animation=1;}
if(x>player.x)
{xvelocity = -attackmode;animation=0;}
if(x>player.x-300)
{if(x<player.x+300)
{if(animation==1)
{CreateActor("bullet", "icon", "(none)", "(none)", 0, 0, false);}
if(animation==0)
CreateActor("bullet", "icon", "(none)", "(none)", 0, 0, false);}}
I want someone to make it work only in certain areas.Like +300 thru +200 and -300 thru -200.