calms1001
11-02-15, 07:42 PM
bạn nào giúp mình việc này với, đã chỉnh tasktime (19,00); TaskInterval (86400), mình muốn chỉnh cho nó chạy suốt nhưng mở lên nó không chạy, giúp mình vụ này với
Include("\\script\\gb_taskfuncs.lua")
greatseed_configtab = {
{340,3,100,"\\settings\\maps\\great_night\\Ī¸ß¿ß.txt","M¹c Cao QuËt"}, --Ī¸ß¿ß
{336,3,100,"\\settings\\maps\\great_night\\·çÁê¶É.txt","Phong L¨ng §é"}, --·çÁê¶É
{322,2,100,"\\settings\\maps\\great_night\\³¤°×ɽ±±¢� �.txt","Trêng B¹ch S¬n B¾c"}, -- ³¤°×ɽ±±¢´
{321,2,100,"\\settings\\maps\\great_night\\³¤°×ɽÄÏ.tx t","Trêng B¹ch S¬n Nam"}, -- ³¤°×ɽÄÏ
{225,2,30,"\\settings\\maps\\great_night\\ɳĮɽ¶´1.t xt","Sa m¹c S¬n §éng 1"}, -- ³¤°×ɽÄÏ
{226,2,30,"\\settings\\maps\\great_night\\ɳĮɽ¶´2.t xt","Sa m¹c S¬n §éng 2"}, -- ³¤°×ɽÄÏ
{227,2,40,"\\settings\\maps\\great_night\\ɳĮɽ¶´3.t xt","Sa m¹c S¬n §éng 3"}, -- ³¤°×ɽÄÏ
{182,1,25,"\\settings\\maps\\great_night\\ÄõÁú¶´ÃÔ¹� �.txt","NghiÖt Long §éng"}, -- ³¤°×ɽÄÏ
{167,1,25,"\\settings\\maps\\great_night\\µã²Ôɽ.txt","§iÓm Th¬ng S¬n"}, -- ³¤°×ɽÄÏ
{200,1,25,"\\settings\\maps\\great_night\\¹ÅÑô¶´ÃÔ¹� �.txt","Cæ D¬ng §éng"}, -- ³¤°×ɽÄÏ
{92,1,25,"\\settings\\maps\\great_night\\Êñ¸Ôɽ.txt","Thôc C¬ng S¬n"}, -- ³¤°×ɽÄÏ
{341, 4, 1, "\\settings\\maps\\great_night\\Ä®±±²ÝÔ.tx t","M¹c B¾c Th¶o Nguyªn"}, -- Ä®±±²ÝÔ
{333, 4, 1, "\\settings\\maps\\great_night\\»ªÉ½ÅÉ.txt","Hoa S¬n Ph¸i"}, -- »ªÉ½ÅÉ
{319, 4, 1, "\\settings\\maps\\great_night\\ÁÙÓå¹Ø.txt","L©m Du Quan"}, -- ÁÙÓå¹Ø
{959, 4, 3, "\\settings\\maps\\great_night\\Ë«Áú¶´.txt","Kháa Lang §éng"}, -- Ë«Áú¶´
{181, 4, 1, "\\settings\\maps\\great_night\\Á½Ë®¶´.txt","Lìng Thñy §éng"}, -- Á½Ë®¶´
};
tblantern_area = {2, 21, 167, 193}
function TaskShedule()
--ÉèÖ÷½°¸Ãû³Æ
TaskName("»Ô»Í¹û")
-- 12µã00·Ö¿ªÊ¼
TaskTime(19 , 00);
--ÉèÖüä¸ôʱ¼ä£¬µ¥Î»Îª·ÖÖÓ
TaskInterval(86400)
--ÉèÖô¥·¢´ÎÊý£¬0±íʾÎÞÏÞ´Î� �ý
TaskCountLimit(0)
OutputMsg("QUA HUY HOANG");
end
function TaskContent()
--ÔÚ19:30µ½20:01·ÖÖмä²ÅÄÜ´¥·¢
local START_TIME = 1200;
local END_TIME = 1230;
if righttime_add() ~= 1 then--Èç¹ûʱ¼ä²»¶Ô
gb_SetTask("HOAT DONG HOA DANG", 1, 0)
gb_SetTask("QUA HUY HOANG", 12, 0); --12ºÅ±äÁ¿ÓÃÀ´´æ´¢NPCµÄÐòºÅ
return
end;
OutputMsg("QUA HUY HOANG")
--±£ÏÕÆð¼û£¬Ôڻ×ʼ½«± äÁ¿ÇåÁã
local nNowTime = tonumber(date("%H%M"))
--µ±·þÎñÆ÷Õý³£ÔËÐÐʱ£¬Ã¿Ìì× ¼Ê±¿ªÊ¼»î¶¯Ê±£¬µÚÒ»³¡Ê±
if nNowTime >= 1200 and nNowTime < 1205 then --
--NPCÐòºÅ = NPCµÄ˳Ðò + ÈÕÆÚ(4)£»ÓÃÒÔÑéÖ¤µã»÷µÄNPCÊÇ ·ñÊôÓڿɱ»ÕªÈ¡µÄ¹ûʵ
gb_SetTask("QUA HUY HOANG", 12, 0); --12ºÅ±äÁ¿ÓÃÀ´´æ´¢NPCµÄÐòºÅ
end
--------------------
--
--------------------
--¼ì²éÊǵڼ¸¸ö5·ÖÖÓ£¬¼´µÚ¼¸� �ú´Î
--Ö´ÐеÄʱºò¸ù¾ÝÅú´ÎµÄÆæżÀ ´È·¶¨ÊÇË¢ÖÖ×Ó»¹Êǹûʵ
local nBatch = floor(mod(nNowTime,100)/5) + 1
--
local nMapCount = getn(greatseed_configtab);
-----
--
-----
for i = 1, nMapCount do
local strExecute = format("dw Global_GreatSeedExecute(%d, %d, %d, [[%s]], [[%s]],%d)", greatseed_configtab[i][1], greatseed_configtab[i][2], greatseed_configtab[i][3], greatseed_configtab[i][4],greatseed_configtab[i][5],nBatch);
GlobalExecute(strExecute);
local szMsg = "";
if (mod(nBatch,2) == 1) and greatseed_configtab[i][2] ~= 4 then
szMsg = "Qu¶ Huy Hoµng"
elseif greatseed_configtab[i][2] == 4 then
szMsg = "Qu¶ Huy Hoµng"
elseif (mod(nBatch,2) == 0) and greatseed_configtab[i][2] ~= 4 then
szMsg = "Qu¶ Huy Hoµng"
elseif greatseed_configtab[i][2] == 4 then
szMsg = "Qu¶ Huy Hoµng"
end;
szMsg = format("HiÖn t¹i <%s> ®· xuÊt hiÖn %s, 5 phót sau sÏ chÝn. C¸c vÞ ®¹i hiÖp chuÈn bÞ h¸i qu¶.",
szMsg,
greatseed_configtab[i][5]);
GlobalExecute(format("dw AddLocalNews([[%s]])",szMsg));
end;
end
function CreateLantern(nDate)
if (gb_GetTask("HOAT DONG HOA DANG 2") == 0 or gb_GetTask("HOAT DONG HOA DANG 2") ~= nDate) then
lantern_area = tblantern_area[ random( getn(tblantern_area) ) ]
gb_SetTask("HOAT DONG HOA DANG 1", lantern_area)
gb_SetTask("HOAT DONG HOA DANG 2", nDate)
end
GlobalExecute("dw GN_Create_Lanterns()")
end
-- LLG_ALLINONE_TODO_20070802
--
function righttime_add()
local nTime = tonumber(date("%H%M"));
if (nTime >= 1200 and nTime < 1230) then
return 1;
end;
return 0;
end
function goldenseedmap() --Ëæ»úÏ¢Ò»´Î»Æ½ðÖÖ×Ó³öÏֵĵ Øͼ£»1´óÀí£¬2ÑïÖÝ£»
local goldcity = random(1, 2);
gb_SetTask("QUA HUY HOANG", 1, goldcity);
local RowIndex = random(2, 41)
gb_SetTask("QUA HUY HOANG", 2, RowIndex);
OutputMsg("HUY HOANG THANH THI"..goldcity);
OutputMsg("goldenseedmap();"..RowIndex);
return goldcity;
end;
function GameSvrConnected(dwGameSvrIP)
end
function GameSvrReady(dwGameSvrIP)
end
Include("\\script\\gb_taskfuncs.lua")
greatseed_configtab = {
{340,3,100,"\\settings\\maps\\great_night\\Ī¸ß¿ß.txt","M¹c Cao QuËt"}, --Ī¸ß¿ß
{336,3,100,"\\settings\\maps\\great_night\\·çÁê¶É.txt","Phong L¨ng §é"}, --·çÁê¶É
{322,2,100,"\\settings\\maps\\great_night\\³¤°×ɽ±±¢� �.txt","Trêng B¹ch S¬n B¾c"}, -- ³¤°×ɽ±±¢´
{321,2,100,"\\settings\\maps\\great_night\\³¤°×ɽÄÏ.tx t","Trêng B¹ch S¬n Nam"}, -- ³¤°×ɽÄÏ
{225,2,30,"\\settings\\maps\\great_night\\ɳĮɽ¶´1.t xt","Sa m¹c S¬n §éng 1"}, -- ³¤°×ɽÄÏ
{226,2,30,"\\settings\\maps\\great_night\\ɳĮɽ¶´2.t xt","Sa m¹c S¬n §éng 2"}, -- ³¤°×ɽÄÏ
{227,2,40,"\\settings\\maps\\great_night\\ɳĮɽ¶´3.t xt","Sa m¹c S¬n §éng 3"}, -- ³¤°×ɽÄÏ
{182,1,25,"\\settings\\maps\\great_night\\ÄõÁú¶´ÃÔ¹� �.txt","NghiÖt Long §éng"}, -- ³¤°×ɽÄÏ
{167,1,25,"\\settings\\maps\\great_night\\µã²Ôɽ.txt","§iÓm Th¬ng S¬n"}, -- ³¤°×ɽÄÏ
{200,1,25,"\\settings\\maps\\great_night\\¹ÅÑô¶´ÃÔ¹� �.txt","Cæ D¬ng §éng"}, -- ³¤°×ɽÄÏ
{92,1,25,"\\settings\\maps\\great_night\\Êñ¸Ôɽ.txt","Thôc C¬ng S¬n"}, -- ³¤°×ɽÄÏ
{341, 4, 1, "\\settings\\maps\\great_night\\Ä®±±²ÝÔ.tx t","M¹c B¾c Th¶o Nguyªn"}, -- Ä®±±²ÝÔ
{333, 4, 1, "\\settings\\maps\\great_night\\»ªÉ½ÅÉ.txt","Hoa S¬n Ph¸i"}, -- »ªÉ½ÅÉ
{319, 4, 1, "\\settings\\maps\\great_night\\ÁÙÓå¹Ø.txt","L©m Du Quan"}, -- ÁÙÓå¹Ø
{959, 4, 3, "\\settings\\maps\\great_night\\Ë«Áú¶´.txt","Kháa Lang §éng"}, -- Ë«Áú¶´
{181, 4, 1, "\\settings\\maps\\great_night\\Á½Ë®¶´.txt","Lìng Thñy §éng"}, -- Á½Ë®¶´
};
tblantern_area = {2, 21, 167, 193}
function TaskShedule()
--ÉèÖ÷½°¸Ãû³Æ
TaskName("»Ô»Í¹û")
-- 12µã00·Ö¿ªÊ¼
TaskTime(19 , 00);
--ÉèÖüä¸ôʱ¼ä£¬µ¥Î»Îª·ÖÖÓ
TaskInterval(86400)
--ÉèÖô¥·¢´ÎÊý£¬0±íʾÎÞÏÞ´Î� �ý
TaskCountLimit(0)
OutputMsg("QUA HUY HOANG");
end
function TaskContent()
--ÔÚ19:30µ½20:01·ÖÖмä²ÅÄÜ´¥·¢
local START_TIME = 1200;
local END_TIME = 1230;
if righttime_add() ~= 1 then--Èç¹ûʱ¼ä²»¶Ô
gb_SetTask("HOAT DONG HOA DANG", 1, 0)
gb_SetTask("QUA HUY HOANG", 12, 0); --12ºÅ±äÁ¿ÓÃÀ´´æ´¢NPCµÄÐòºÅ
return
end;
OutputMsg("QUA HUY HOANG")
--±£ÏÕÆð¼û£¬Ôڻ×ʼ½«± äÁ¿ÇåÁã
local nNowTime = tonumber(date("%H%M"))
--µ±·þÎñÆ÷Õý³£ÔËÐÐʱ£¬Ã¿Ìì× ¼Ê±¿ªÊ¼»î¶¯Ê±£¬µÚÒ»³¡Ê±
if nNowTime >= 1200 and nNowTime < 1205 then --
--NPCÐòºÅ = NPCµÄ˳Ðò + ÈÕÆÚ(4)£»ÓÃÒÔÑéÖ¤µã»÷µÄNPCÊÇ ·ñÊôÓڿɱ»ÕªÈ¡µÄ¹ûʵ
gb_SetTask("QUA HUY HOANG", 12, 0); --12ºÅ±äÁ¿ÓÃÀ´´æ´¢NPCµÄÐòºÅ
end
--------------------
--
--------------------
--¼ì²éÊǵڼ¸¸ö5·ÖÖÓ£¬¼´µÚ¼¸� �ú´Î
--Ö´ÐеÄʱºò¸ù¾ÝÅú´ÎµÄÆæżÀ ´È·¶¨ÊÇË¢ÖÖ×Ó»¹Êǹûʵ
local nBatch = floor(mod(nNowTime,100)/5) + 1
--
local nMapCount = getn(greatseed_configtab);
-----
--
-----
for i = 1, nMapCount do
local strExecute = format("dw Global_GreatSeedExecute(%d, %d, %d, [[%s]], [[%s]],%d)", greatseed_configtab[i][1], greatseed_configtab[i][2], greatseed_configtab[i][3], greatseed_configtab[i][4],greatseed_configtab[i][5],nBatch);
GlobalExecute(strExecute);
local szMsg = "";
if (mod(nBatch,2) == 1) and greatseed_configtab[i][2] ~= 4 then
szMsg = "Qu¶ Huy Hoµng"
elseif greatseed_configtab[i][2] == 4 then
szMsg = "Qu¶ Huy Hoµng"
elseif (mod(nBatch,2) == 0) and greatseed_configtab[i][2] ~= 4 then
szMsg = "Qu¶ Huy Hoµng"
elseif greatseed_configtab[i][2] == 4 then
szMsg = "Qu¶ Huy Hoµng"
end;
szMsg = format("HiÖn t¹i <%s> ®· xuÊt hiÖn %s, 5 phót sau sÏ chÝn. C¸c vÞ ®¹i hiÖp chuÈn bÞ h¸i qu¶.",
szMsg,
greatseed_configtab[i][5]);
GlobalExecute(format("dw AddLocalNews([[%s]])",szMsg));
end;
end
function CreateLantern(nDate)
if (gb_GetTask("HOAT DONG HOA DANG 2") == 0 or gb_GetTask("HOAT DONG HOA DANG 2") ~= nDate) then
lantern_area = tblantern_area[ random( getn(tblantern_area) ) ]
gb_SetTask("HOAT DONG HOA DANG 1", lantern_area)
gb_SetTask("HOAT DONG HOA DANG 2", nDate)
end
GlobalExecute("dw GN_Create_Lanterns()")
end
-- LLG_ALLINONE_TODO_20070802
--
function righttime_add()
local nTime = tonumber(date("%H%M"));
if (nTime >= 1200 and nTime < 1230) then
return 1;
end;
return 0;
end
function goldenseedmap() --Ëæ»úÏ¢Ò»´Î»Æ½ðÖÖ×Ó³öÏֵĵ Øͼ£»1´óÀí£¬2ÑïÖÝ£»
local goldcity = random(1, 2);
gb_SetTask("QUA HUY HOANG", 1, goldcity);
local RowIndex = random(2, 41)
gb_SetTask("QUA HUY HOANG", 2, RowIndex);
OutputMsg("HUY HOANG THANH THI"..goldcity);
OutputMsg("goldenseedmap();"..RowIndex);
return goldcity;
end;
function GameSvrConnected(dwGameSvrIP)
end
function GameSvrReady(dwGameSvrIP)
end