thiensud
16-02-13, 10:00 PM
Mình đã thêm vào TimerTask.txt
22 \script\lien_dau\su_gia_lien_dau.lua
Báo danh thành công.Nhưng gần đến h vào đấu trường thì nó ko set cặp đấu vào đấu trường mà nó báo bạn nhân dc 4 điểm vinh dự mà vẫn ỡ ngoài map báo danh.Mình đã thữ test = 6 acc vẫn lỗi trên:
Server Auto in game script BFF 2.0
Đây là Script su_gia_lien_dau : Giúp mình nhé mấy bạn :(
--************************************Written by Manh Tuyen********************************************--
--******************************************BEGIN*** *************************************************--
danhsach_account = {}
Include("\\script\\lien_dau\\liendau_head.lua")
Include("\\script\\Global\\sourcejx49.lua");
--Include("\\script\\lien_dau\\danhsach_account.lua")
--{GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
xaphu = {}
DS_THAMGIA_LD = {}
function main(sel)
W,X,Y = GetWorldPos()
if W == 396 then
quanvienliendau()
else
sugiadangkyliendau()
end
end
function sugiadangkyliendau()
if GetTask(TaskUyThac) == 0 then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: Ta lµ ngêi chuyªn phô tr¸ch c¸c ho¹t ®éng PK , Liªn §Êu\nVÞ "..GetName().." cã muèn tham gia hay kh«ng?:",4,
"§¨ng KÝ Tham Gia/DangKyChienDoi",
"Vµo Héi Trêng Liªn §Êu./VaoHoiTruongLienDau",
"PhÇn Thëng Liªn §Êu./phanthuong",
"Tho¸t./out")
else
Talk(1,"","<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: B¹n ®ang <color=red>ñy Th¸c<color> kh«ng thÓ tham gia Liªn §Êu")
end
end
function VaoHoiTruongLienDau()
if TimKiem(danhsach_account,GetName()) == nil then
Talk(1,"","<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: B¹n ph¶i ®¨ng ký chiÕn ®éi tríc khi vµo ®Êu trêng")
return
end
NewWorld(396,47744/32,97440/32)
SetFightState(0)
SetLogoutRV(1)
SetDeathScript("")
SetTaskTemp(100,0)
Msg2Player("B¹n ®· ®Õn héi trêng Liªn §Êu!")
if TimKiem(DS_THAMGIA_LD,GetName()) == 1 and GioLienDau() == "bao danh" then
LeaveTeam()
SetFightState(0)
SetCreateTeam(0);
SetPunish(0)
SetTaskTemp(100,0)
SetTaskTemp(101,GetPK())
SetTaskTemp(102,GetExp())
SetPK(0)
SetLogoutRV(1)
SetTempRevPos(396,47744/32,97440/32)
SetDeathScript("\\script\\lien_dau\\su_gia_lien_dau.lua")
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
giay = tonumber(date("%S"))
for i = 1,getn(gio_liendau) do
if phut <= gio_liendau[i][2]+thoigianbaodanh then
thoigiancho = (gio_liendau[i][2]+thoigianbaodanh-phut)*60-giay
break
end
end
Msg2Player("Thêi gian chê ®îi: "..thoigiancho.." gi©y")
StopTimer()
SetTimer(thoigiancho*18,22)
end
end
function DangKyChienDoi()
if TimKiem(danhsach_account,GetName()) == nil then
danhsach_account[getn(danhsach_account)+1] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
Msg2Player("B¹n ®· lËp thµnh c«ng chiÕn ®éi ["..GetName().."]")
else
Msg2Player("B¹n ®a lËp chiÕn ®éi,kh«ng cÇn lËp l¹i n÷a")
end
end
function quanvienliendau()
SetFightState(0)
if GioLienDau() == "bao danh" then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: Ho¹t §éng <color=pink>Liªn §Êu <color>®· diÔn ra, h·y B¸o Danh ®Ó tham gia",4,
"Ta muèn tham gia./DangKy",
"Th«ng tin c¸ nh©n./thongtincanhan",
"B¶ng xÕp h¹ng./Xem_BangXepHang",
"Tho¸t./out")
elseif GioLienDau() == "thi dau" then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: Ho¹t §éng <color=pink> s¾p b¾t ®Çu\nThêi gian thi ®Êu cßn l¹i lµ:<color=yellow> "..ThoiGianConLai().."<color>",3,
"Th«ng tin c¸ nh©n./thongtincanhan",
"B¶ng xÕp h¹ng./Xem_BangXepHang",
"Tho¸t./out")
elseif GioLienDau() == "chua den gio" then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: HiÖn t¹i cha ®Õn thêi gian sù kiÖn Liªn §Êu diÔn ra",1,
"KÕt Thóc §èi Tho¹i./out")
end
end;
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function Xem_BangXepHang()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>:Ng¬i muèn biÕt th«ng tin vÒ b¶ng xÕp h¹ng Liªn §Êu phai ko?",3,
"10 h¹ng ®Çu./xephang",
"20 h¹ng ®Çu./xephang",
"Tho¸t./out")
end
function xephang(nsel)
BangXepHang((nsel+1)*10)
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function DangKy()--Dang ky tham gia
if STT_LD() ~= luotliendau then
luotliendau = STT_LD()
DS_THAMGIA_LD = {}
end
if GioLienDau() ~= "bao danh" then
return
end
if TimKiem(DS_THAMGIA_LD,GetName()) == nil then
if getn(DS_THAMGIA_LD) < 2 then
DS_THAMGIA_LD[getn(DS_THAMGIA_LD)+1] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
else
i = random(1,getn(DS_THAMGIA_LD))
DS_THAMGIA_LD[getn(DS_THAMGIA_LD)+1] = DS_THAMGIA_LD[i]
DS_THAMGIA_LD[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
i = nil
end
LeaveTeam()
SetFightState(0)
SetCreateTeam(0);
SetPunish(0)
SetTaskTemp(100,0)
SetTaskTemp(101,GetPK())
SetTaskTemp(102,GetExp())
SetPK(0)
SetLogoutRV(1)
SetTempRevPos(396,47744/32,97440/32)
SetDeathScript("\\script\\lien_dau\\su_gia_lien_dau.lua")
Msg2Player("B¹n ®· ®¨ng ký tham gia Liªn §Êu dot "..luotliendau)
Msg2SubWorld("ChiÕn ®éi ["..GetName().."] ®¨ng ký tham gia Liªn §Êu lît thø "..luotliendau)
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
giay = tonumber(date("%S"))
for i = 1,getn(gio_liendau) do
if phut <= gio_liendau[i][2]+thoigianbaodanh then
thoigiancho = (gio_liendau[i][2]+thoigianbaodanh-phut)*60-giay
break
end
end
Msg2Player("Thêi gian chê ®îi: "..thoigiancho.." gi©y")
StopTimer()
SetTimer(thoigiancho*18,22)
else
Msg2Player("B¹n ®· ®¨ng ký tham gia lît thø "..luotliendau..", xin ®îi Ýt phót")
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function TenDoiThu(tennhanvat)--tim ten doi thu cua tennhanvat
for i = 1,getn(DS_THAMGIA_LD) do
if GetName() == DS_THAMGIA_LD[i][1] then
if i == getn(DS_THAMGIA_LD) and mod(getn(DS_THAMGIA_LD),2) ~= 0 then
return ""
end
if mod(i,2) ~= 0 then --so le
return DS_THAMGIA_LD[i+1][1]
else --so chan
return DS_THAMGIA_LD[i-1][1]
end
end
end
return ""
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function STT_LD()
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
for i = 1,getn(gio_liendau) do
if gio == gio_liendau[i][1] and phut <= gio_liendau[i][2]+thoigianthidau+thoigianbaodanh-1 then
return i
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function BangXepHang(hang)
if getn(danhsach_account) < 2 then
Talk(1,"","<bclr=red><color=yellow>B¶ng xÕp h¹ng cha ®îc cËp nhËt<color><bclr>")
return
end
bangxephang = {}
for k = 1,hang do
danhsach2 = {}
danhsach1 = {}
danhsach = {}
diem_vd_lonnhat = 0
tilethang_lonnhat = 0
level_nhonhat = 0
--so sanh §iÓm Vinh Dù
for i = 1,getn(danhsach_account) do
if danhsach_account[i][3] > diem_vd_lonnhat and TimKiem(bangxephang,danhsach_account[i][1]) == nil then
danhsach = {danhsach_account[i][1]}
diem_vd_lonnhat = danhsach_account[i][3]
elseif danhsach_account[i][3] == diem_vd_lonnhat and TimKiem(bangxephang,danhsach_account[i][1]) ==nil then
danhsach[getn(danhsach)+1] = danhsach_account[i][1]
end
end
--so sanh TØ LÖ Th¾ng
for i = 1,getn(danhsach) do
if TiLeThang(danhsach[i],0) > tilethang_lonnhat and TimKiem(bangxephang,danhsach[i]) ==nil then
danhsach1 = {danhsach[i]}
tilethang_lonnhat = TiLeThang(danhsach[i],0)
elseif TiLeThang(danhsach[i],0) == tilethang_lonnhat and TimKiem(bangxephang,danhsach[i]) ==nil then
danhsach1[getn(danhsach1)+1] = danhsach[i]
end
end
--so sanh dang cap
danhsach2 = {danhsach1[1]}
for i = 1,getn(danhsach1)-1 do
if Level_LD(danhsach1[i]) < level_nhonhat and TimKiem(bangxephang,danhsach1[i]) ==nil then
danhsach2 = {danhsach1[i+1][1]}
level_nhonhat = Level_LD(danhsach1[i])
elseif Level_LD(danhsach1[i]) == level_nhonhat and TimKiem(bangxephang,danhsach1[i]) ==nil then
danhsach2[getn(danhsach2)+1] = danhsach1[i+1][1]
end
end
if danhsach2[1] ~= nil then
bangxephang[getn(bangxephang)+1] = danhsach2
end
end
if getn(bangxephang) == 0 then
return
end
for i = 1,getn(bangxephang) do
for k = 1,getn(bangxephang[i]) do
str = "<<"..bangxephang[i][k]..">>\n§iÓm vinh dù: "..DiemVinhDu(bangxephang[i][k]).."\nTØ lÖ th¾ng: "..TiLeThang(bangxephang[i][k],1).."."
end
str = "H¹ng "..i..":\n"..str
Msg2Player(str)
str = ""
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function TimKiem(tenbang,tukhoa)
if getn(tenbang) == 0 then
return nil
end
for i= 1,getn(tenbang) do
for k = 1,getn(tenbang[i]) do
if tenbang[i][k] == tukhoa then
return 1
end
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function DiemVinhDu(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
return danhsach_account[i][3]
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function ThoiGianConLai()
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
giay = tonumber(date("%S"))
for i = 1,getn(gio_liendau) do
if gio == gio_liendau[i][1] and phut <= gio_liendau[i][2]+thoigianthidau+thoigianbaodanh then
thoigianconlai = (gio_liendau[i][2]+thoigianbaodanh+thoigianthidau-phut)*60-giay
break
end
end
return floor(thoigianconlai/60)
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function Level_LD(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
return danhsach_account[i][2]
end
end
return "biet chet lien"
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function ThongTin_NhanVat_LD(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
return tennhanvat..":M«n Ph¸i:"..danhsach_account[i][6].."\n§iÓm Vinh Dù:"..danhsach_account[i][3].."\nTØ LÖ Th¾ng:"..TiLeThang(tennhanvat,1).."\nXÕp H¹ng:"..XepHang_LienDau()..""
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function TiLeThang(tennhanvat,lamtron)
if tennhanvat == "" or tennhanvat == "Khong Xac Dinh" then
return 0
end
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
if danhsach_account[i][4]+danhsach_account[i][5] == 0 then
return 0
else
if lamtron == 1 then
return floor(danhsach_account[i][4]*100/(danhsach_account[i][5]+danhsach_account[i][4]))
else
return danhsach_account[i][4]*100/(danhsach_account[i][5]+danhsach_account[i][4])
end
end
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function thongtincanhan()
sotranthang = GetTask(107)
sotranthua = GetTask(105)
if sotranthua+sotranthang == 0 then
tilethang = 0
else
tilethang = floor(sotranthang*100/(sotranthua+sotranthang))
end
SayNew("<color=yellow>"..GetName().."<color>:Level:"..GetLevel().."\nM«n Ph¸i:"..GetFaction().."\n§iÓm Vinh Dù:"..GetTask(106).."\nSè TrËn Th¾ng:"..GetTask(107).."\nSè TrËn Thua:"..GetTask(105).."\nTØ LÖ Th¾ng:"..tilethang.."",0)
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function NguoiThangCuoc(tennv1,tennv2)
if TiLeThang(tennv1,0) > TiLeThang(tennv2,0) then
return tennv1
elseif TiLeThang(tennv1,0) < TiLeThang(tennv2,0) then
return tennv2
else--neu TØ LÖ Th¾ng bang nhau thi set den dang cap(neu dang cap thap hon se thang)
if Level_LD(tennv1) > Level_LD(tennv2) then
return tennv1
elseif Level_LD(tennv1) < Level_LD(tennv2) then
return tennv2
else--neu den dang cap cung bang nhau thi he thong se random nguoi thang cuoc
i = random(1,2)
if i == 1 then
return tennv1
else
return tennv2
end
i = nil
end
end
end
--************************************************** ************************************************** ************************************************** ***************************
function OnDeath(Launcher)
PlayerIndex1 = NpcIdx2PIdx(Launcher);
OrgPlayer = PlayerIndex;
DeathName = GetName();--------------------------nguoi thua
SetFightState(0);
camp = GetCamp();
SetCurCamp(camp);
SetCreateTeam(1);
SetPK(GetTask(103))
SetPunish(1)
SetDeathScript("");
if GetExp() < GetTaskTemp(102) then
AddOwnExp(GetTaskTemp(102) - GetExp())
end
SetTask(103,0)
SetTask(104,0)
SetTask(105,GetTask(105)+1)
AddOwnExp(random(5000000,10000000))
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
Msg2Player("B¹n bÞ ®èi thñ "..MonPhai(TenDoiThu(GetName())).." cÊp "..Level_LD(GetName()).." h¹, träng th¬ng trong chiÕn trêng")
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
end
end
StopTimer()
--******************************************
PlayerIndex = PlayerIndex1;------------------nguoi danh thang
LaunName = GetName();
SetFightState(0)
camp = GetCamp();
SetCurCamp(camp);
SetCreateTeam(1);
SetPK(GetTask(103))
SetPunish(1)
SetDeathScript("");
SetTask(106,GetTask(106)+4)
SetTask(107,GetTask(107)+1)
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
Msg2Player("Xin chóc mõng b¹n nhËn ®îc thªm 4 §iÓm Vinh Dù")
AddOwnExp(random(10000000,20000000))
str = "ChiÕn ®éi ["..LaunName.."] ®¸nh b¹i chiÕn ®éi ["..DeathName.."]"
Msg2SubWorld(str);
print(str)
StopTimer()
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
end
end
PlayerIndex = OrgPlayer;
end
--************************************************** ************************************************** ************************************************** ***************************
function MonPhai(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
if danhsach_account[i][6] == "" then
return "Vo Mon Phai"
else
return danhsach_account[i][6]
end
end
end
return ""
end
--************************************************** ************************************************** ************************************************** ***************************
function OnTimer()
idx = SubWorldID2Idx(396)
SubWorld = idx
if GetTaskTemp(100) == 0 then
--neu khong co ai la doi thu trong luot dau do thi se duoc su thang cuoc
if TenDoiThu(GetName()) == "" or TenDoiThu(GetName()) == "Khong Xac Dinh" then
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
StopTimer()
SetTaskTemp(100,0)
SetFightState(0)
SetPunish(0)
SetTask(106,GetTask(106)+4)
SetDeathScript("")
SetTask(107,GetTask(107)+1)
camp = GetCamp();
SetCurCamp(camp);
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
break
end
end
Msg2Player("Xin chóc mõng! b¹n nhËn ®îc 4 §iÓm Vinh Dù")
return
end
Msg2Player("\n[Th«ng tin ®èi thñ]:"..TenDoiThu(GetName())..",level:"..Level_LD(TenDoiThu(GetName()))..",M«n Ph¸i:"..MonPhai(TenDoiThu(GetName())))
for i = 1,getn(DS_THAMGIA_LD) do
if GetName() == DS_THAMGIA_LD[i][1] then
if mod(i,2) == 0 then
NewWorld(397,DAUTRUONGPOSXY[floor(i/2)][1]*8,DAUTRUONGPOSXY[floor(i/2)][2]*16)
SetLogoutRV(1)
print(GetName().." vµo ®Êu trêng thø "..floor(i/2))
else
NewWorld(397,DAUTRUONGPOSXY[floor(i/2)+1][1]*8,DAUTRUONGPOSXY[floor(i/2)+1][2]*16)
SetLogoutRV(1)
print(GetName().." vµo ®Êu trêng thø "..(floor(i/2)+1))
end
Msg2SubWorld("ChiÕn ®éi ["..GetName().."] ®· vµo khu vøc chuÈn bÞ thi ®Êu")
break
end
end
for i = 1,getn(DS_THAMGIA_LD) do
if DS_THAMGIA_LD[i][1] == GetName() then
if mod(i,2) == 0 then
SetCurCamp(1)
else
SetCurCamp(2)
end
break
end
end
StopTimer()
SetTimer(18,22)
SetTaskTemp(100,1)
elseif GetTaskTemp(100) < 11 then
Msg2Player("TrËn ®Êu sÏ b¾t ®Çu sau "..(11-GetTaskTemp(100)).." gi©y!")
SetTaskTemp(100,GetTaskTemp(100)+1)
w,x,y = GetWorldPos()
if w ~= 397 then
Msg2SubWorld("["..GetName().."] tô ý rêi khái ®Êu trêng Liªn §Êu nªn bÞ xñ thua,chiÕn th¾ng thuéc vÒ ["..TenDoiThu(GetName()).."]")
for i = 1,getn(DS_THAMGIA_LD) do
if DS_THAMGIA_LD[i][1] == GetName() then
DS_THAMGIA_LD[i] = {"Khong Xac Dinh"}
break
end
end
return
end
if Player_Online_LD(TenDoiThu(GetName())) == "OffLine" and GetTaskTemp(100) == 10 then
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
StopTimer()
SetTaskTemp(100,0)
SetFightState(0)
SetPunish(0)
SetTask(106,GetTask(106)+4)
SetDeathScript("")
SetTask(107,GetTask(107)+1)
camp = GetCamp();
SetCurCamp(camp);
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
break
end
end
Msg2Player("Xin chóc mõng! b¹n nhËn ®îc 4 §iÓm Vinh Dù")
Msg2SubWorld("["..TenDoiThu(GetName()).."] tô ý rêi khái ®Êu trêng Liªn §Êu nªn bÞ xñ thua,chiÕn th¾ng thuéc vÒ ["..GetName().."]")
return
end
elseif GetTaskTemp(100) == 11 then
w,x,y = GetWorldPos()
if w ~= 397 then
Msg2SubWorld("["..GetName().."] tô ý rêi khái ®Êu trêng Liªn §Êu nªn bÞ xñ thua,chiÕn th¾ng thuéc vÒ ["..TenDoiThu(GetName()).."]")
for i = 1,getn(DS_THAMGIA_LD) do
if DS_THAMGIA_LD[i][1] == GetName() then
DS_THAMGIA_LD[i] = {"Khong Xac Dinh"}
break
end
end
return
end
SetTaskTemp(100,GetTaskTemp(100)+1)
Msg2Player("TrËn ®Êu b¾t ®Çu!")
StopTimer()
SetFightState(1)
SetTimer(((thoigianthidau-1)*60-10)*18,22)
else
--Neu khong ai danh chet duoc doi thu thi se chay den doan script nay
if GetName() == NguoiThangCuoc(GetName(),TenDoiThu(GetName())) then
SetTask(106,GetTask(106)+4)
SetTask(107,GetTask(107)+1)
AddOwnExp(random(100000,200000))
Msg2Player("Xin chóc mõng! b¹n nhËn ®îc 4 §iÓm Vinh Dù")
else
SetTask(105,GetTask(105)+1)
AddOwnExp(random(50000,100000))
Msg2Player("§å v« dông! ®¸nh ®Êm nh thÕ h¶, ®Ó c¸i th»ng "..MonPhai(TenDoiThu(GetName())).." cÊp "..Level_LD(GetName()).." nã b¾t n¹t, ®i chÕt ®i!")
end
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
break
end
end
StopTimer()
SetFightState(0)
SetLogoutRV(1)
SetPunish(1)
SetCreateTeam(1)
camp = GetCamp();
SetCurCamp(camp);
SetDeathScript("")
SetTaskTemp(100,0)
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
end
end
--************************************************** ************************************
function Player_Online_LD(tennhanvat)
player1 = PlayerIndex --nguoi choi hien tai
for i = 1,100 do
PlayerIndex = i
if GetName() == tennhanvat then
W,X,Y = GetWorldPos()
if W == 397 then
return "OnLine"
else
return "OffLine"
end
end
end
return "OffLine"
end
function phanthuong()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",4,
"§æi LÖnh Bµi Vinh Dù./lbvd",
"Trang bÞ An Bang - §Þnh Quèc./loaiab",
"Trang BÞ §¹i M· Hå {Vît ¶i} Cao CÊp./vacc",
"Tho¸t/out")
end
function loaiab()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",3,
"Key §Þnh Quèc Vip./vipdq",
"Key An Bang./vipab",
"Tho¸t./out")
end;
function lbvd()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",3,
"§æi LÖnh Bµi LÊy §iÓm./diemld",
"Mua LÖnh Bµi B»ng §iÓm./mualb",
"Tho¸t./out")
end;
function diemld()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",4,
"LÖnh Bµi §ång [ 10 ®iÓm]./thaps",
"LÖnh Bµi ThiÕt [ 50 ®iÓm ]./trungs",
"LÖnh Bµi Vµng [100 ®iÓm]./caos",
"Tho¸t./out")
end;
function vacc()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: SÏ ra m¾t Item nµy sím nhÊt",1,"KÕt Thóc §èi Tho¹i./out")
end
function thaps()
if GetItemCount(76) >= 1 then
SetTask(106,GetTask(106)+10)
DelItem(76)
Msg2Player("NhËn ®îc 10 ®iÓm Liªn §Êu")
else
Talk(1,""," CÇn 1 LÖnh Bµi [ ThiÕt] ®Ó ®æi")
end
end;
function trungs()
if GetItemCount(77) >= 1 then
SetTask(106,GetTask(106)+50)
DelItem(77)
Msg2Player("NhËn dîc 50 ®iÓm Liªn §Êu")
else
Talk(1,""," CÇn 1 LÖnh Bµi [§ång] ®Ó ®æi")
end
end;
function caos()
if GetItemCount(78) >= 1 then
SetTask(106,GetTask(106)+100)
DelItem(78)
Msg2Player("NhËn ®îc 100 ®iÓm Liªn §Êu")
else
Talk(1,""," CÇn 1 LÖnh Bµi [Vµng] ®Ó ®æi")
end
end;
function mualb()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",4,
"LÖnh Bµi §ång [ ThÊp]./thap",
"LÖnh Bµi ThiÕt [ Trung ]./trung",
"LÖnh Bµi Vµng [Cao]./cao",
"Tho¸t./out")
end;
function thap()
if GetTask(106) >= 11 then
SetTask(106,GetTask(106)-11)
AddEventItem(76)
Msg2Player("NhËn ®îc 1 LÖnh Bµi Vinh Dù [ThiÕt]")
else
Talk(1,""," CÇn 11 §iÓm Vinh Dù ®Ó cã thÓ mua")
end
end;
function trung()
if GetTask(106) >= 55 then
SetTask(106,GetTask(106)-55)
AddEventItem(77)
Msg2Player("NhËn ®îc 1 LÖnh Bµi Vinh Dù [§ång]")
else
Talk(1,""," CÇn 55 §iÓm Vinh Dù ®Ó cã thÓ mua")
end
end
;
function cao()
if GetTask(106) >= 111 then
SetTask(106,GetTask(106)-111)
AddEventItem(78)
Msg2Player("NhËn ®îc 1 LÖnh Bµi Vinh Dù [Vµng]")
else
Talk(1,""," CÇn 111 §iÓm Vinh Dù ®Ó cã thÓ mua")
end
end;
function vipdq()
if GetTask(106) >= 50 then
SetTask(106,GetTask(106)-50)
AddItem(0,8,3,10,0,0,10)
AddItem(0,5,5,10,0,0,10)
AddItem(0,7,15,10,0,0,10)
AddItem(0,2,30,10,0,0,10)
AddItem(0,6,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 Bé An Bang - §Þnh Quèc.")
else
Talk(1,""," CÇn 50 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ §Þnh Quèc")
end
end;
function vipab()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: ë ®©y cã c¸c lo¹i trang bÞ tranh hïng phôc quèc",5,
"NhÉn An Bang [Háa]./hoa",
"NhÉn An Bang [Thñy]/thuy",
"Ngäc béi An Bang [Méc]./moc",
"D©y ChuyÒn An Bang [Thæ]./tho",
"Tho¸t/out")
end;
function moc()
if GetTask(106) >= 30 then
SetTask(106,GetTask(106)-30)
AddItem(0,9,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 30 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang [Méc]")
end
end;
function tho()
if GetTask(106) >= 100 then
SetTask(106,GetTask(106)-100)
AddItem(0,4,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 100 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang [Thæ]")
end
end;
function hoa()
if GetTask(106) >= 50 then
SetTask(106,GetTask(106)-50)
AddItem(0,3,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 50 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang [Háa]")
end
end;
function thuy()
if GetTask(106) >= 50 then
SetTask(106,GetTask(106)-50)
AddItem(0,3,4,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 50 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang[Thñy]")
end
end;
function PlayerBT()
SetDeathScript("")
SetCreateTeam(1)
StopTimer()
SetTask(103,0)
SetTask(104,0)
SetTaskTemp(100,0)
end
function xa_phu()
for i = 1,7 do
xaphu[getn(xaphu)+1] = GetStationName(i).."/gothanhthi"
end
xaphu[8] = "Ta kh«ng muèn ®i/out"
SayNew("<color=blue>Kh¸ch quan cã muèn trë l¹i c¸c thµnh thÞ kh«ng<color>",8,xaphu)
end;
function gothanhthi(nSel)
w,x,y = GetStationPos(nSel+1)
if SubWorldID2Idx(w) ~= -1 then
NewWorld(w,x,y)
SetFightState(0)
SetLogoutRV(1)
SetLogoutRV(0);
Msg2Player("Ngåi yªn nhÐ! chóng ta ®i "..GetStationName(nSel+1))
else
SayNew("<color=blue>N¬i b¹n muèn ®Õn kh«ng ®îc më trong qu¸ tr×nh khëi ®éng server!<color>",0)
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
--sau day la 1 doan script cuc ki quan trong,neu khong co doan nay GameServer se bao loi(that khung khiep)
function out()
end;
function no()
end;
--************************************************** ***************THE END*********************************************** ************************************************** ************************************************** ************************************************** ************************************************** ***************************************
Cái nào fix dc thì gắng fix.Chứ khó quá fix ko dc nên mới hõi b-)
22 \script\lien_dau\su_gia_lien_dau.lua
Báo danh thành công.Nhưng gần đến h vào đấu trường thì nó ko set cặp đấu vào đấu trường mà nó báo bạn nhân dc 4 điểm vinh dự mà vẫn ỡ ngoài map báo danh.Mình đã thữ test = 6 acc vẫn lỗi trên:
Server Auto in game script BFF 2.0
Đây là Script su_gia_lien_dau : Giúp mình nhé mấy bạn :(
--************************************Written by Manh Tuyen********************************************--
--******************************************BEGIN*** *************************************************--
danhsach_account = {}
Include("\\script\\lien_dau\\liendau_head.lua")
Include("\\script\\Global\\sourcejx49.lua");
--Include("\\script\\lien_dau\\danhsach_account.lua")
--{GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
xaphu = {}
DS_THAMGIA_LD = {}
function main(sel)
W,X,Y = GetWorldPos()
if W == 396 then
quanvienliendau()
else
sugiadangkyliendau()
end
end
function sugiadangkyliendau()
if GetTask(TaskUyThac) == 0 then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: Ta lµ ngêi chuyªn phô tr¸ch c¸c ho¹t ®éng PK , Liªn §Êu\nVÞ "..GetName().." cã muèn tham gia hay kh«ng?:",4,
"§¨ng KÝ Tham Gia/DangKyChienDoi",
"Vµo Héi Trêng Liªn §Êu./VaoHoiTruongLienDau",
"PhÇn Thëng Liªn §Êu./phanthuong",
"Tho¸t./out")
else
Talk(1,"","<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: B¹n ®ang <color=red>ñy Th¸c<color> kh«ng thÓ tham gia Liªn §Êu")
end
end
function VaoHoiTruongLienDau()
if TimKiem(danhsach_account,GetName()) == nil then
Talk(1,"","<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: B¹n ph¶i ®¨ng ký chiÕn ®éi tríc khi vµo ®Êu trêng")
return
end
NewWorld(396,47744/32,97440/32)
SetFightState(0)
SetLogoutRV(1)
SetDeathScript("")
SetTaskTemp(100,0)
Msg2Player("B¹n ®· ®Õn héi trêng Liªn §Êu!")
if TimKiem(DS_THAMGIA_LD,GetName()) == 1 and GioLienDau() == "bao danh" then
LeaveTeam()
SetFightState(0)
SetCreateTeam(0);
SetPunish(0)
SetTaskTemp(100,0)
SetTaskTemp(101,GetPK())
SetTaskTemp(102,GetExp())
SetPK(0)
SetLogoutRV(1)
SetTempRevPos(396,47744/32,97440/32)
SetDeathScript("\\script\\lien_dau\\su_gia_lien_dau.lua")
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
giay = tonumber(date("%S"))
for i = 1,getn(gio_liendau) do
if phut <= gio_liendau[i][2]+thoigianbaodanh then
thoigiancho = (gio_liendau[i][2]+thoigianbaodanh-phut)*60-giay
break
end
end
Msg2Player("Thêi gian chê ®îi: "..thoigiancho.." gi©y")
StopTimer()
SetTimer(thoigiancho*18,22)
end
end
function DangKyChienDoi()
if TimKiem(danhsach_account,GetName()) == nil then
danhsach_account[getn(danhsach_account)+1] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
Msg2Player("B¹n ®· lËp thµnh c«ng chiÕn ®éi ["..GetName().."]")
else
Msg2Player("B¹n ®a lËp chiÕn ®éi,kh«ng cÇn lËp l¹i n÷a")
end
end
function quanvienliendau()
SetFightState(0)
if GioLienDau() == "bao danh" then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: Ho¹t §éng <color=pink>Liªn §Êu <color>®· diÔn ra, h·y B¸o Danh ®Ó tham gia",4,
"Ta muèn tham gia./DangKy",
"Th«ng tin c¸ nh©n./thongtincanhan",
"B¶ng xÕp h¹ng./Xem_BangXepHang",
"Tho¸t./out")
elseif GioLienDau() == "thi dau" then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: Ho¹t §éng <color=pink> s¾p b¾t ®Çu\nThêi gian thi ®Êu cßn l¹i lµ:<color=yellow> "..ThoiGianConLai().."<color>",3,
"Th«ng tin c¸ nh©n./thongtincanhan",
"B¶ng xÕp h¹ng./Xem_BangXepHang",
"Tho¸t./out")
elseif GioLienDau() == "chua den gio" then
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: HiÖn t¹i cha ®Õn thêi gian sù kiÖn Liªn §Êu diÔn ra",1,
"KÕt Thóc §èi Tho¹i./out")
end
end;
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function Xem_BangXepHang()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>:Ng¬i muèn biÕt th«ng tin vÒ b¶ng xÕp h¹ng Liªn §Êu phai ko?",3,
"10 h¹ng ®Çu./xephang",
"20 h¹ng ®Çu./xephang",
"Tho¸t./out")
end
function xephang(nsel)
BangXepHang((nsel+1)*10)
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function DangKy()--Dang ky tham gia
if STT_LD() ~= luotliendau then
luotliendau = STT_LD()
DS_THAMGIA_LD = {}
end
if GioLienDau() ~= "bao danh" then
return
end
if TimKiem(DS_THAMGIA_LD,GetName()) == nil then
if getn(DS_THAMGIA_LD) < 2 then
DS_THAMGIA_LD[getn(DS_THAMGIA_LD)+1] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
else
i = random(1,getn(DS_THAMGIA_LD))
DS_THAMGIA_LD[getn(DS_THAMGIA_LD)+1] = DS_THAMGIA_LD[i]
DS_THAMGIA_LD[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
i = nil
end
LeaveTeam()
SetFightState(0)
SetCreateTeam(0);
SetPunish(0)
SetTaskTemp(100,0)
SetTaskTemp(101,GetPK())
SetTaskTemp(102,GetExp())
SetPK(0)
SetLogoutRV(1)
SetTempRevPos(396,47744/32,97440/32)
SetDeathScript("\\script\\lien_dau\\su_gia_lien_dau.lua")
Msg2Player("B¹n ®· ®¨ng ký tham gia Liªn §Êu dot "..luotliendau)
Msg2SubWorld("ChiÕn ®éi ["..GetName().."] ®¨ng ký tham gia Liªn §Êu lît thø "..luotliendau)
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
giay = tonumber(date("%S"))
for i = 1,getn(gio_liendau) do
if phut <= gio_liendau[i][2]+thoigianbaodanh then
thoigiancho = (gio_liendau[i][2]+thoigianbaodanh-phut)*60-giay
break
end
end
Msg2Player("Thêi gian chê ®îi: "..thoigiancho.." gi©y")
StopTimer()
SetTimer(thoigiancho*18,22)
else
Msg2Player("B¹n ®· ®¨ng ký tham gia lît thø "..luotliendau..", xin ®îi Ýt phót")
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function TenDoiThu(tennhanvat)--tim ten doi thu cua tennhanvat
for i = 1,getn(DS_THAMGIA_LD) do
if GetName() == DS_THAMGIA_LD[i][1] then
if i == getn(DS_THAMGIA_LD) and mod(getn(DS_THAMGIA_LD),2) ~= 0 then
return ""
end
if mod(i,2) ~= 0 then --so le
return DS_THAMGIA_LD[i+1][1]
else --so chan
return DS_THAMGIA_LD[i-1][1]
end
end
end
return ""
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function STT_LD()
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
for i = 1,getn(gio_liendau) do
if gio == gio_liendau[i][1] and phut <= gio_liendau[i][2]+thoigianthidau+thoigianbaodanh-1 then
return i
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function BangXepHang(hang)
if getn(danhsach_account) < 2 then
Talk(1,"","<bclr=red><color=yellow>B¶ng xÕp h¹ng cha ®îc cËp nhËt<color><bclr>")
return
end
bangxephang = {}
for k = 1,hang do
danhsach2 = {}
danhsach1 = {}
danhsach = {}
diem_vd_lonnhat = 0
tilethang_lonnhat = 0
level_nhonhat = 0
--so sanh §iÓm Vinh Dù
for i = 1,getn(danhsach_account) do
if danhsach_account[i][3] > diem_vd_lonnhat and TimKiem(bangxephang,danhsach_account[i][1]) == nil then
danhsach = {danhsach_account[i][1]}
diem_vd_lonnhat = danhsach_account[i][3]
elseif danhsach_account[i][3] == diem_vd_lonnhat and TimKiem(bangxephang,danhsach_account[i][1]) ==nil then
danhsach[getn(danhsach)+1] = danhsach_account[i][1]
end
end
--so sanh TØ LÖ Th¾ng
for i = 1,getn(danhsach) do
if TiLeThang(danhsach[i],0) > tilethang_lonnhat and TimKiem(bangxephang,danhsach[i]) ==nil then
danhsach1 = {danhsach[i]}
tilethang_lonnhat = TiLeThang(danhsach[i],0)
elseif TiLeThang(danhsach[i],0) == tilethang_lonnhat and TimKiem(bangxephang,danhsach[i]) ==nil then
danhsach1[getn(danhsach1)+1] = danhsach[i]
end
end
--so sanh dang cap
danhsach2 = {danhsach1[1]}
for i = 1,getn(danhsach1)-1 do
if Level_LD(danhsach1[i]) < level_nhonhat and TimKiem(bangxephang,danhsach1[i]) ==nil then
danhsach2 = {danhsach1[i+1][1]}
level_nhonhat = Level_LD(danhsach1[i])
elseif Level_LD(danhsach1[i]) == level_nhonhat and TimKiem(bangxephang,danhsach1[i]) ==nil then
danhsach2[getn(danhsach2)+1] = danhsach1[i+1][1]
end
end
if danhsach2[1] ~= nil then
bangxephang[getn(bangxephang)+1] = danhsach2
end
end
if getn(bangxephang) == 0 then
return
end
for i = 1,getn(bangxephang) do
for k = 1,getn(bangxephang[i]) do
str = "<<"..bangxephang[i][k]..">>\n§iÓm vinh dù: "..DiemVinhDu(bangxephang[i][k]).."\nTØ lÖ th¾ng: "..TiLeThang(bangxephang[i][k],1).."."
end
str = "H¹ng "..i..":\n"..str
Msg2Player(str)
str = ""
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function TimKiem(tenbang,tukhoa)
if getn(tenbang) == 0 then
return nil
end
for i= 1,getn(tenbang) do
for k = 1,getn(tenbang[i]) do
if tenbang[i][k] == tukhoa then
return 1
end
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function DiemVinhDu(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
return danhsach_account[i][3]
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function ThoiGianConLai()
gio = tonumber(date("%H"))
phut = tonumber(date("%M"))
giay = tonumber(date("%S"))
for i = 1,getn(gio_liendau) do
if gio == gio_liendau[i][1] and phut <= gio_liendau[i][2]+thoigianthidau+thoigianbaodanh then
thoigianconlai = (gio_liendau[i][2]+thoigianbaodanh+thoigianthidau-phut)*60-giay
break
end
end
return floor(thoigianconlai/60)
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function Level_LD(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
return danhsach_account[i][2]
end
end
return "biet chet lien"
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function ThongTin_NhanVat_LD(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
return tennhanvat..":M«n Ph¸i:"..danhsach_account[i][6].."\n§iÓm Vinh Dù:"..danhsach_account[i][3].."\nTØ LÖ Th¾ng:"..TiLeThang(tennhanvat,1).."\nXÕp H¹ng:"..XepHang_LienDau()..""
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function TiLeThang(tennhanvat,lamtron)
if tennhanvat == "" or tennhanvat == "Khong Xac Dinh" then
return 0
end
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
if danhsach_account[i][4]+danhsach_account[i][5] == 0 then
return 0
else
if lamtron == 1 then
return floor(danhsach_account[i][4]*100/(danhsach_account[i][5]+danhsach_account[i][4]))
else
return danhsach_account[i][4]*100/(danhsach_account[i][5]+danhsach_account[i][4])
end
end
end
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function thongtincanhan()
sotranthang = GetTask(107)
sotranthua = GetTask(105)
if sotranthua+sotranthang == 0 then
tilethang = 0
else
tilethang = floor(sotranthang*100/(sotranthua+sotranthang))
end
SayNew("<color=yellow>"..GetName().."<color>:Level:"..GetLevel().."\nM«n Ph¸i:"..GetFaction().."\n§iÓm Vinh Dù:"..GetTask(106).."\nSè TrËn Th¾ng:"..GetTask(107).."\nSè TrËn Thua:"..GetTask(105).."\nTØ LÖ Th¾ng:"..tilethang.."",0)
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
function NguoiThangCuoc(tennv1,tennv2)
if TiLeThang(tennv1,0) > TiLeThang(tennv2,0) then
return tennv1
elseif TiLeThang(tennv1,0) < TiLeThang(tennv2,0) then
return tennv2
else--neu TØ LÖ Th¾ng bang nhau thi set den dang cap(neu dang cap thap hon se thang)
if Level_LD(tennv1) > Level_LD(tennv2) then
return tennv1
elseif Level_LD(tennv1) < Level_LD(tennv2) then
return tennv2
else--neu den dang cap cung bang nhau thi he thong se random nguoi thang cuoc
i = random(1,2)
if i == 1 then
return tennv1
else
return tennv2
end
i = nil
end
end
end
--************************************************** ************************************************** ************************************************** ***************************
function OnDeath(Launcher)
PlayerIndex1 = NpcIdx2PIdx(Launcher);
OrgPlayer = PlayerIndex;
DeathName = GetName();--------------------------nguoi thua
SetFightState(0);
camp = GetCamp();
SetCurCamp(camp);
SetCreateTeam(1);
SetPK(GetTask(103))
SetPunish(1)
SetDeathScript("");
if GetExp() < GetTaskTemp(102) then
AddOwnExp(GetTaskTemp(102) - GetExp())
end
SetTask(103,0)
SetTask(104,0)
SetTask(105,GetTask(105)+1)
AddOwnExp(random(5000000,10000000))
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
Msg2Player("B¹n bÞ ®èi thñ "..MonPhai(TenDoiThu(GetName())).." cÊp "..Level_LD(GetName()).." h¹, träng th¬ng trong chiÕn trêng")
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
end
end
StopTimer()
--******************************************
PlayerIndex = PlayerIndex1;------------------nguoi danh thang
LaunName = GetName();
SetFightState(0)
camp = GetCamp();
SetCurCamp(camp);
SetCreateTeam(1);
SetPK(GetTask(103))
SetPunish(1)
SetDeathScript("");
SetTask(106,GetTask(106)+4)
SetTask(107,GetTask(107)+1)
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
Msg2Player("Xin chóc mõng b¹n nhËn ®îc thªm 4 §iÓm Vinh Dù")
AddOwnExp(random(10000000,20000000))
str = "ChiÕn ®éi ["..LaunName.."] ®¸nh b¹i chiÕn ®éi ["..DeathName.."]"
Msg2SubWorld(str);
print(str)
StopTimer()
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
end
end
PlayerIndex = OrgPlayer;
end
--************************************************** ************************************************** ************************************************** ***************************
function MonPhai(tennhanvat)
for i = 1,getn(danhsach_account) do
if danhsach_account[i][1] == tennhanvat then
if danhsach_account[i][6] == "" then
return "Vo Mon Phai"
else
return danhsach_account[i][6]
end
end
end
return ""
end
--************************************************** ************************************************** ************************************************** ***************************
function OnTimer()
idx = SubWorldID2Idx(396)
SubWorld = idx
if GetTaskTemp(100) == 0 then
--neu khong co ai la doi thu trong luot dau do thi se duoc su thang cuoc
if TenDoiThu(GetName()) == "" or TenDoiThu(GetName()) == "Khong Xac Dinh" then
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
StopTimer()
SetTaskTemp(100,0)
SetFightState(0)
SetPunish(0)
SetTask(106,GetTask(106)+4)
SetDeathScript("")
SetTask(107,GetTask(107)+1)
camp = GetCamp();
SetCurCamp(camp);
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
break
end
end
Msg2Player("Xin chóc mõng! b¹n nhËn ®îc 4 §iÓm Vinh Dù")
return
end
Msg2Player("\n[Th«ng tin ®èi thñ]:"..TenDoiThu(GetName())..",level:"..Level_LD(TenDoiThu(GetName()))..",M«n Ph¸i:"..MonPhai(TenDoiThu(GetName())))
for i = 1,getn(DS_THAMGIA_LD) do
if GetName() == DS_THAMGIA_LD[i][1] then
if mod(i,2) == 0 then
NewWorld(397,DAUTRUONGPOSXY[floor(i/2)][1]*8,DAUTRUONGPOSXY[floor(i/2)][2]*16)
SetLogoutRV(1)
print(GetName().." vµo ®Êu trêng thø "..floor(i/2))
else
NewWorld(397,DAUTRUONGPOSXY[floor(i/2)+1][1]*8,DAUTRUONGPOSXY[floor(i/2)+1][2]*16)
SetLogoutRV(1)
print(GetName().." vµo ®Êu trêng thø "..(floor(i/2)+1))
end
Msg2SubWorld("ChiÕn ®éi ["..GetName().."] ®· vµo khu vøc chuÈn bÞ thi ®Êu")
break
end
end
for i = 1,getn(DS_THAMGIA_LD) do
if DS_THAMGIA_LD[i][1] == GetName() then
if mod(i,2) == 0 then
SetCurCamp(1)
else
SetCurCamp(2)
end
break
end
end
StopTimer()
SetTimer(18,22)
SetTaskTemp(100,1)
elseif GetTaskTemp(100) < 11 then
Msg2Player("TrËn ®Êu sÏ b¾t ®Çu sau "..(11-GetTaskTemp(100)).." gi©y!")
SetTaskTemp(100,GetTaskTemp(100)+1)
w,x,y = GetWorldPos()
if w ~= 397 then
Msg2SubWorld("["..GetName().."] tô ý rêi khái ®Êu trêng Liªn §Êu nªn bÞ xñ thua,chiÕn th¾ng thuéc vÒ ["..TenDoiThu(GetName()).."]")
for i = 1,getn(DS_THAMGIA_LD) do
if DS_THAMGIA_LD[i][1] == GetName() then
DS_THAMGIA_LD[i] = {"Khong Xac Dinh"}
break
end
end
return
end
if Player_Online_LD(TenDoiThu(GetName())) == "OffLine" and GetTaskTemp(100) == 10 then
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
StopTimer()
SetTaskTemp(100,0)
SetFightState(0)
SetPunish(0)
SetTask(106,GetTask(106)+4)
SetDeathScript("")
SetTask(107,GetTask(107)+1)
camp = GetCamp();
SetCurCamp(camp);
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
break
end
end
Msg2Player("Xin chóc mõng! b¹n nhËn ®îc 4 §iÓm Vinh Dù")
Msg2SubWorld("["..TenDoiThu(GetName()).."] tô ý rêi khái ®Êu trêng Liªn §Êu nªn bÞ xñ thua,chiÕn th¾ng thuéc vÒ ["..GetName().."]")
return
end
elseif GetTaskTemp(100) == 11 then
w,x,y = GetWorldPos()
if w ~= 397 then
Msg2SubWorld("["..GetName().."] tô ý rêi khái ®Êu trêng Liªn §Êu nªn bÞ xñ thua,chiÕn th¾ng thuéc vÒ ["..TenDoiThu(GetName()).."]")
for i = 1,getn(DS_THAMGIA_LD) do
if DS_THAMGIA_LD[i][1] == GetName() then
DS_THAMGIA_LD[i] = {"Khong Xac Dinh"}
break
end
end
return
end
SetTaskTemp(100,GetTaskTemp(100)+1)
Msg2Player("TrËn ®Êu b¾t ®Çu!")
StopTimer()
SetFightState(1)
SetTimer(((thoigianthidau-1)*60-10)*18,22)
else
--Neu khong ai danh chet duoc doi thu thi se chay den doan script nay
if GetName() == NguoiThangCuoc(GetName(),TenDoiThu(GetName())) then
SetTask(106,GetTask(106)+4)
SetTask(107,GetTask(107)+1)
AddOwnExp(random(100000,200000))
Msg2Player("Xin chóc mõng! b¹n nhËn ®îc 4 §iÓm Vinh Dù")
else
SetTask(105,GetTask(105)+1)
AddOwnExp(random(50000,100000))
Msg2Player("§å v« dông! ®¸nh ®Êm nh thÕ h¶, ®Ó c¸i th»ng "..MonPhai(TenDoiThu(GetName())).." cÊp "..Level_LD(GetName()).." nã b¾t n¹t, ®i chÕt ®i!")
end
for i = 1,getn(danhsach_account) do
if GetName() == danhsach_account[i][1] then
danhsach_account[i] = {GetName(),GetLevel(),GetTask(106),GetTask(107),Ge tTask(105),GetFaction()}
break
end
end
StopTimer()
SetFightState(0)
SetLogoutRV(1)
SetPunish(1)
SetCreateTeam(1)
camp = GetCamp();
SetCurCamp(camp);
SetDeathScript("")
SetTaskTemp(100,0)
NewWorld(396,47744/32,97440/32)
SetLogoutRV(1)
end
end
--************************************************** ************************************
function Player_Online_LD(tennhanvat)
player1 = PlayerIndex --nguoi choi hien tai
for i = 1,100 do
PlayerIndex = i
if GetName() == tennhanvat then
W,X,Y = GetWorldPos()
if W == 397 then
return "OnLine"
else
return "OffLine"
end
end
end
return "OffLine"
end
function phanthuong()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",4,
"§æi LÖnh Bµi Vinh Dù./lbvd",
"Trang bÞ An Bang - §Þnh Quèc./loaiab",
"Trang BÞ §¹i M· Hå {Vît ¶i} Cao CÊp./vacc",
"Tho¸t/out")
end
function loaiab()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",3,
"Key §Þnh Quèc Vip./vipdq",
"Key An Bang./vipab",
"Tho¸t./out")
end;
function lbvd()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",3,
"§æi LÖnh Bµi LÊy §iÓm./diemld",
"Mua LÖnh Bµi B»ng §iÓm./mualb",
"Tho¸t./out")
end;
function diemld()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",4,
"LÖnh Bµi §ång [ 10 ®iÓm]./thaps",
"LÖnh Bµi ThiÕt [ 50 ®iÓm ]./trungs",
"LÖnh Bµi Vµng [100 ®iÓm]./caos",
"Tho¸t./out")
end;
function vacc()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: SÏ ra m¾t Item nµy sím nhÊt",1,"KÕt Thóc §èi Tho¹i./out")
end
function thaps()
if GetItemCount(76) >= 1 then
SetTask(106,GetTask(106)+10)
DelItem(76)
Msg2Player("NhËn ®îc 10 ®iÓm Liªn §Êu")
else
Talk(1,""," CÇn 1 LÖnh Bµi [ ThiÕt] ®Ó ®æi")
end
end;
function trungs()
if GetItemCount(77) >= 1 then
SetTask(106,GetTask(106)+50)
DelItem(77)
Msg2Player("NhËn dîc 50 ®iÓm Liªn §Êu")
else
Talk(1,""," CÇn 1 LÖnh Bµi [§ång] ®Ó ®æi")
end
end;
function caos()
if GetItemCount(78) >= 1 then
SetTask(106,GetTask(106)+100)
DelItem(78)
Msg2Player("NhËn ®îc 100 ®iÓm Liªn §Êu")
else
Talk(1,""," CÇn 1 LÖnh Bµi [Vµng] ®Ó ®æi")
end
end;
function mualb()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: §iÓm Vinh Dù cña ng¬i hiÖn t¹i lµ:<color=pink>"..GetTask(106).."<color> ®iÓm",4,
"LÖnh Bµi §ång [ ThÊp]./thap",
"LÖnh Bµi ThiÕt [ Trung ]./trung",
"LÖnh Bµi Vµng [Cao]./cao",
"Tho¸t./out")
end;
function thap()
if GetTask(106) >= 11 then
SetTask(106,GetTask(106)-11)
AddEventItem(76)
Msg2Player("NhËn ®îc 1 LÖnh Bµi Vinh Dù [ThiÕt]")
else
Talk(1,""," CÇn 11 §iÓm Vinh Dù ®Ó cã thÓ mua")
end
end;
function trung()
if GetTask(106) >= 55 then
SetTask(106,GetTask(106)-55)
AddEventItem(77)
Msg2Player("NhËn ®îc 1 LÖnh Bµi Vinh Dù [§ång]")
else
Talk(1,""," CÇn 55 §iÓm Vinh Dù ®Ó cã thÓ mua")
end
end
;
function cao()
if GetTask(106) >= 111 then
SetTask(106,GetTask(106)-111)
AddEventItem(78)
Msg2Player("NhËn ®îc 1 LÖnh Bµi Vinh Dù [Vµng]")
else
Talk(1,""," CÇn 111 §iÓm Vinh Dù ®Ó cã thÓ mua")
end
end;
function vipdq()
if GetTask(106) >= 50 then
SetTask(106,GetTask(106)-50)
AddItem(0,8,3,10,0,0,10)
AddItem(0,5,5,10,0,0,10)
AddItem(0,7,15,10,0,0,10)
AddItem(0,2,30,10,0,0,10)
AddItem(0,6,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 Bé An Bang - §Þnh Quèc.")
else
Talk(1,""," CÇn 50 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ §Þnh Quèc")
end
end;
function vipab()
SayNew("<color="..colorS()..">Sø Gi¶ Liªn §Êu<color>: ë ®©y cã c¸c lo¹i trang bÞ tranh hïng phôc quèc",5,
"NhÉn An Bang [Háa]./hoa",
"NhÉn An Bang [Thñy]/thuy",
"Ngäc béi An Bang [Méc]./moc",
"D©y ChuyÒn An Bang [Thæ]./tho",
"Tho¸t/out")
end;
function moc()
if GetTask(106) >= 30 then
SetTask(106,GetTask(106)-30)
AddItem(0,9,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 30 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang [Méc]")
end
end;
function tho()
if GetTask(106) >= 100 then
SetTask(106,GetTask(106)-100)
AddItem(0,4,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 100 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang [Thæ]")
end
end;
function hoa()
if GetTask(106) >= 50 then
SetTask(106,GetTask(106)-50)
AddItem(0,3,3,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 50 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang [Háa]")
end
end;
function thuy()
if GetTask(106) >= 50 then
SetTask(106,GetTask(106)-50)
AddItem(0,3,4,10,0,0,10)
Msg2Player("NhËn ®îc 1 mãn An Bang ")
else
Talk(1,""," CÇn 50 §iÓm Vinh Dù ®Ó cã thÓ mua trang bÞ An Bang[Thñy]")
end
end;
function PlayerBT()
SetDeathScript("")
SetCreateTeam(1)
StopTimer()
SetTask(103,0)
SetTask(104,0)
SetTaskTemp(100,0)
end
function xa_phu()
for i = 1,7 do
xaphu[getn(xaphu)+1] = GetStationName(i).."/gothanhthi"
end
xaphu[8] = "Ta kh«ng muèn ®i/out"
SayNew("<color=blue>Kh¸ch quan cã muèn trë l¹i c¸c thµnh thÞ kh«ng<color>",8,xaphu)
end;
function gothanhthi(nSel)
w,x,y = GetStationPos(nSel+1)
if SubWorldID2Idx(w) ~= -1 then
NewWorld(w,x,y)
SetFightState(0)
SetLogoutRV(1)
SetLogoutRV(0);
Msg2Player("Ngåi yªn nhÐ! chóng ta ®i "..GetStationName(nSel+1))
else
SayNew("<color=blue>N¬i b¹n muèn ®Õn kh«ng ®îc më trong qu¸ tr×nh khëi ®éng server!<color>",0)
end
end
--************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** *
--sau day la 1 doan script cuc ki quan trong,neu khong co doan nay GameServer se bao loi(that khung khiep)
function out()
end;
function no()
end;
--************************************************** ***************THE END*********************************************** ************************************************** ************************************************** ************************************************** ************************************************** ***************************************
Cái nào fix dc thì gắng fix.Chứ khó quá fix ko dc nên mới hõi b-)