感觉这个脚本有点意思,就更新到沧海千年了
可以先看一下效果
这里面用到了OnTimer函数,这个函数挺好玩的,以后可以发挥更多的想象
附上主脚本代码:
function OnTimer(NpcP, PlayP, aStr)
if (aStr == '20 55 00' or aStr == '20 55 1') or (aStr == '20 55 5' or aStr == '20 55 6') or (aStr == '20 55 7' or aStr == '20 55 8') or (aStr == '20 55 10' or aStr == '20 55 15') then
PlayerList.SendNoticeMessageByCol('夺宝奇兵活动将于5分钟后开启', 1023, 0);
end;
if (aStr == '21 0 0' or aStr == '21 0 1') or (aStr == '21 0 2' or aStr == '21 0 3') or (aStr == '21 0 4' or aStr == '21 0 5') or (aStr == '21 0 6' or aStr == '21 0 7') then
PlayerList.SendNoticeMessageByCol('夺宝奇兵活动已开启,10分钟后将禁止进入地图', 1023, 0);
Manager.SetSdbInfo('tgsplus\\奇兵夺宝.sdb', '1', 'name','true');
BasicObj.MapRegen(NpcP, 122);
end;
if (aStr == '21 5 1' or aStr == '21 5 2') or (aStr == '21 5 3' or aStr == '21 5 4') or (aStr == '21 5 5' or aStr == '21 5 6') or (aStr == '21 5 7' or aStr == '21 5 8') then
PlayerList.SendNoticeMessageByCol('夺宝奇兵活动地图将在5分钟后关闭进入功能', 1023, 0);
end;
if (aStr == '21 10 0' or aStr == '21 10 1') or (aStr == '21 10 2' or aStr == '21 10 3') or (aStr == '21 10 5' or aStr == '21 10 6') or (aStr == '21 10 7' or aStr == '21 10 8') then
PlayerList.SendNoticeMessageByCol('夺宝奇兵活动地图已关闭进入', 1023, 0);
Manager.SetSdbInfo('tgsplus\\奇兵夺宝.sdb', '1', 'name','false');
end;
local s = Manager.GetSdbInfo('tgsplus\\奇兵夺宝.sdb', '持宝人', 'time');
if s == '' then
return;
end;
local name = Manager.GetSdbInfo('tgsplus\\奇兵夺宝.sdb', '持宝人', 'name');
if name == '' then
return;
end;
local op,zt = PlayerList.GetUserPointer(name);
if zt == true then
if Player.GetServerId(op) ~= 115 then
print(NpcP, op, 'getsenderallitem 宝箱');
Manager.CheckItemRegen(115, '宝箱', 41, 58, 1, 0);
Player.UnInitEffect(op, 1003);
Manager.DelNameInSdb('tgsplus\\奇兵夺宝.sdb', '持宝人');
PlayerList.SendNoticeMessageByCol('夺宝奇兵:持宝人死亡,宝箱掉落在[夺宝地图]的41,58附近.', 31680, 99);
return;
end;
end;
s = tostring(tonumber(s) - 1);
Manager.SetSdbInfo('tgsplus\\奇兵夺宝.sdb', '持宝人', 'time', s);
if s == '300' then
PlayerList.SendNoticeMessageByCol('夺宝奇兵:持宝人已携带宝箱5分钟,继续携带5分钟后即可开启宝箱', 31680, 99);
end;
if s == '120' then
PlayerList.SendNoticeMessageByCol('夺宝奇兵:持宝人已携带宝箱8分钟,继续携带2分钟后即可开启宝箱', 31680, 99);
end;
if s == '60' then
PlayerList.SendNoticeMessageByCol('夺宝奇兵:持宝人已携带宝箱9分钟,继续携带1分钟后即可开启宝箱', 31680, 99);
end;
if s == '30' then
PlayerList.SendNoticeMessageByCol('夺宝奇兵:持宝人继续携带宝箱30秒后即可开启', 31680, 99);
end;
if tonumber(s) < 11 and tonumber(s) > 0 then
PlayerList.SendNoticeMessageByCol('夺宝奇兵:持宝人继续携带宝箱'..s..'秒后即可开启', 31680, 99);
end;
if tonumber(s) < 1 then
local name = Manager.GetSdbInfo('tgsplus\\奇兵夺宝.sdb', '持宝人', 'name');
Manager.DelNameInSdb('tgsplus\\奇兵夺宝.sdb', '持宝人');
local op,zz = PlayerList.GetUserPointer(name);
if zz == true then
Player.UnInitEffect(op, 1003);
print(op, op, 'getsenderallitem 宝箱');
itemtable = {
{'无相神功残卷','1'},
{'无相神功残卷','1'},
{'冰玉','1'},
{'太极明珠三','1'},
{'养魂莲','10'},
{'仙魔秘典','1'},
{'苍王天书残页','3'},
{'上古雨中客之魂','1'},
{'飞血镖','10000'},
{'石棺青龙刺客的信','1'},
{'两仪擒拿手上卷','1'},
{'金元','500'},
{'金元','50'},
{'金元','200'},
{'金元','50'},
{'金元','500'},
{'狐狸内丹五','1'},
{'金元','500'},
{'两仪擒拿手中卷','10'},
{'金元','1000'},
{'金元','500'},
{'金元','50'},
{'金元','1400'},
{'金元','500'},
{'金元','500'},
{'金元','200'},
{'门主召集令','1'},
{'两仪擒拿手下卷','1'},
{'金元','1000'},
{'金元','600'},
{'金元','500'},
{'金元','300'},
{'金元','200'},
{'金元','100'},
{'连城剑法','1'},
};
local item = itemtable[math.random(table.getn(itemtable))];
PlayerList.SendNoticeMessageByCol('群雄争霸赛:宝箱已经开启,当前持宝人获得['..item[1]..']'..item[2]..'个', 31680, 99);
Player.Putmagicitem(op, item[1]..':'..item[2], '群雄争霸赛', 4);
end;
end;