ai giúp em cái này với nó chỉ chạy 1 lần xong là dừng


Code:
local self = Open;

local Open	= Map.Open or {};
Map.Open		= Open;

local loadNAT = 0;
local nTimerId2 = 0;

local szCmd = [=[
	Map.Open:RuongVSVSwitch();
]=];

function Open:RuongVSVSwitch()
	if loadNAT == 0 then
		loadNAT = 1;
		UiManager:OpenWindow("UI_INFOBOARD", "<bclr=Black><color=Yellow>Chế độ tự mở rương VSV <color>");
		me.Msg("<color=yellow>Mở NAT rương<color>");
		nTimerId2 = Ui.tbLogic.tbTimer:Register(13 * Env.GAME_FPS,self.Run,self);
	else
		loadNAT = 0;
		UiManager:OpenWindow("UI_INFOBOARD", "<bclr=Black><color=white>Stop Here <color>");
		me.Msg("<color=yellow>Tắt mở NAT rương<color>");
		Ui.tbLogic.tbTimer:Close(nTimerId2);
		nTimerId2 = 0;
	end
end

function Open:RunCotNAT()
	local nDangCo = me.GetItemCountInBags(18,1,1,12);
	local nPlanNum = 48; 
	local nFreeNum = 12; 
	local nCountFree = me.CountFreeBagCell(); 
	if (nPlanNum + nFreeNum) > nCountFree then
		nPlanNum = nCountFree - nFreeNum; 
	end	
		if nDangCo < 1 then
			local tbItem = me.FindItemInBags(18,1,530,1)[1]
			if UiManager:WindowVisible(Ui.UI_TEXTINPUT) == 1 then
			me.CallServerScript({ "DlgCmd", "InputNum", nPlanNum });
			UiManager:CloseWindow(Ui.UI_TEXTINPUT);
			end
			if tbItem then
				me.UseItem(tbItem.pItem);
				--else
				--Open:StopCotNAT();
			end
		end
--return
end


function Open:StartCotNAT()
if loadNAT == 0 then
Open:RuongVSVSwitch();
end
end

function Open:StopCotNAT()
if loadNAT == 1 then
Open:RuongVSVSwitch();
end
end

local tCmd={"Map.Open:RuongVSVSwitch()", "cNAT", "", "Alt+P", "Alt+P", "cNAT"};
	AddCommand(tCmd[4], tCmd[3], tCmd[2], tCmd[7] or UiShortcutAlias.emKSTATE_INGAME);
	UiShortcutAlias:AddAlias(tCmd[2], tCmd[1]);