I have created a simple textbox code, but whenever I use the code, it works for about 3 times and then freezes the game. Any ideas? Here is the code:

Code:
function check_line_text()
{
	
	checking_string_var = str_cmp(chat_text_line1, clean_checking); //checks the string line against the clean string to see if it is used already (1 is a yes  0 is a no)
	if(checking_string_var == 1)
	{
		chat_line_number = 1;
		str_cpy(chat_text_line1, chat_text);
		make_playername_string(1);
	}
	if((checking_string_var = str_cmp(chat_text_line2, clean_checking)) == 1)
	{
		chat_line_number = 2;
		str_cpy(chat_text_line2, chat_text);
		make_playername_string(2);
	}
	if((checking_string_var = str_cmp(chat_text_line3, clean_checking)) == 1)
	{
		chat_line_number = 3;
		str_cpy(chat_text_line3, chat_text);
		make_playername_string(3);
	}
	if((checking_string_var = str_cmp(chat_text_line4, clean_checking)) == 1)
	{
		chat_line_number = 4;
		str_cpy(chat_text_line4, chat_text);
		make_playername_string(4);
	}
	if((checking_string_var = str_cmp(chat_text_line5, clean_checking)) == 1)
	{
		chat_line_number = 5;
		str_cpy(chat_text_line5, chat_text);
		make_playername_string(5);
	}
	if((checking_string_var = str_cmp(chat_text_line6, clean_checking)) == 1)
	{
		chat_line_number = 6;
		str_cpy(chat_text_line6, chat_text);
		make_playername_string(6);
	}
	if((checking_string_var = str_cmp(chat_text_line7, clean_checking)) == 1)
	{
		chat_line_number = 7;
		str_cpy(chat_text_line7, chat_text);
		make_playername_string(7);
	}
	if((checking_string_var = str_cmp(chat_text_line8, clean_checking)) == 1)
	{
		chat_line_number = 8;
		str_cpy(chat_text_line8, chat_text);
		make_playername_string(8);
	}
}

function init_textbox()
{
	
	if(is(show_chat, SHOW))//if the main chat is shown
	{
	toggle(show_chat,SHOW);//turns off the main chat text box (if it is visible)
	}
	
//	make_playername_string(); 
	
	set(text_box, SHOW);//shows the type in chat box
	
	inkey_value = inkey(text); //gets the chat text
	
	str_cpy(chat_text, text);//copies the chat text for the main chat text box
	
	blank_chat_text = str_cmp(chat_text, chat_text_plain);//checks to see if the chat_text is blank in case pressed esc or something returns 1 if it is blank 0 if it is different
	
	
	//str_cpy(chat_text_line1, chat_text);//sends the chat line to the 1st line display on the chat_text panel
	
	toggle(text_box,SHOW); //hides the type in chat text box
	
	if (blank_chat_text != 1 && inkey_value != 27)//if the chat_Text is empty dont show a blank text
	{
	check_line_text();
	set(show_chat, SHOW);//unhides the main text box
	}
	
	str_cpy(text, clean);
	
	//pan_setdigits(show_chat, 0, value_x, value_y, "%.f", courier, 1, 0);
	//value_y += 18;
}




"Pow! You are dead! Not big suprise!" -Heavy