PDA

View Full Version : [JX] Cần hướng dẫn viết script bang hội



evjnshiva
22-03-12, 07:09 PM
mình cần viết 1 script bang hội cho sv awjx , nhưng đọc trên dd thì toàn thấy mấy pro khuyên dùng hàm opentong(1) mà chả hĩu nó dùng add vô đâu , cấu trúc nó ra sao , mong mấy pro hướng dẫn dùm , có rãnh qua <b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b> giúp dùm luôn nha :) thank mọi người nhìu :)

thaihoa91
22-03-12, 08:40 PM
Viết code


function main()
OpenTong(1)
end;

chỉ có thế thôi !

evjnshiva
23-03-12, 08:30 PM
sau khi add scrip thì tạo bang dc 1 lần tắt sv mở lại ko tạo dc bang nữa , tắt lần 2 cũng vậy , tắt lần 3 mở lại GS dis >>>>lần thứ n GD vẫn cứ dí dù đã sử dung sv gốc chưa bị tui phá , ai có cách nào để tạo bang mà ko bị dis ko ????

jxvietnam
24-03-12, 10:48 AM
tạo bang bằng hàm OpenTong(1) ko đầy đủ chức năng đâu, và hay bị lỗi lung tung nữa

evjnshiva
24-03-12, 12:02 PM
tạo bang bằng hàm OpenTong(1) ko đầy đủ chức năng đâu, và hay bị lỗi lung tung nữa

vậy bạn có hàm nào dùng tạo bang ko ? mình đang dùng cái sv awjx+tsbd do heocon share đó

jxvietnam
24-03-12, 01:20 PM
Tui cũng ko làm đc, vì muốn viết lại bang hội thì phải code trong source chứ ko phải đơn giản là chỉ viết chữ hàm ra là có ngay đâu
Tốt nhất nên dùng script làm bang hội tạm thời cũng đc rồi

evjnshiva
24-03-12, 04:31 PM
-----------------------------------------------------------------
--Author: DNTmaster
--Thong Tin:
--Script dua theo cua Manh Tuyen
--Fix Bug loi C++ khi co hon 10 bang
--Cap nhat Truong Lao va Doi Truong
--Cap nhat lai he thong goi va rut tien
--Cap nhat lai he thong dieu kien lap bang
--He Thong Cong Thanh chua test nhung chac la co Bug
--Tam thoi chi su dung banghoi_main
-----------------------------------------------------------------
Include("\\script\\cacsukien\\banghoi\\guild.lua")
Include("\\script\\cacsukien\\banghoi\\listguild.lua")
Include("\\script\\cacsukien\\banghoi\\thanhthi.lua")
Include("\\script\\cacsukien\\banghoi\\lich_congthanh.lua")
Include("\\Script\\global\\sourcejx49.lua");
Luong = 10*1000 -- 10 van
--Tailanhdao = GetLeadLevel()
--Danhvong = GetRepute()
YcDV = 500 --danh vong can thiet de lap bang
YcTLD = 10 --tai lanh dao can thiet de lap bang
YcLv = 60 --dang cap de lap bang
idNVK = 13 --id nhac vuong kiem
idKCL = 150 --id khieu chien lenh
--THANHTHI = {}
--LIST_TONG = {}
--LIST_MEMBER_TONG = {}
filetong = "script/cacsukien/banghoi/guild.lua"
filetongmem = "script/cacsukien/banghoi/listguild.lua"
filetongcaste = "script/cacsukien/banghoi/thanhthi.lua"
function dieukienlapbang()
tailanhdao = GetLeadLevel()
danhvong = GetRepute()
if tailanhdao >= YcTLD then
if danhvong >= YcDV then
if GetCash() >= Luong then
if GetCurCamp() == 4 then
return 1
else
return 2
end
else
return 3
end
else
return 4
end
else
return 5
end
end;
function lapbang_buoc1()
tailanhdao = GetLeadLevel()
danhvong = GetRepute()
if dieukienlapbang() == 2 then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Nguoi van chua <color=red>xuat su<color> khong the lap bang duoc.")
elseif dieukienlapbang() == 3 then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Nguoi van chua <color=red>"..Luong.." luong<color> khong the lap bang duoc.")
elseif dieukienlapbang() == 4 then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Nguoi van chua <color=red>du danh vong 500 diem<color> khong the lap bang duoc.\nDiem danh vong hien nay cua nguoi la "..danhvong.." diem")
elseif dieukienlapbang() == 5 then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Nguoi van chua <color=red>Tai lanh dao cap 10<color> khong the lap bang duoc.\nTai lanh dao hien tai cua nguoi la cap "..tailanhdao)
elseif dieukienlapbang() == 1 then
lapbang_buoc2()
end
end;
function lapbang_buoc2()
SayEx({"<color=cyan>Quan Vien Bang Hoi<color>: Nguoi hay chon <color=metal>phe phai<color> cua bang hoi minh.","Chinh Phai./info","Trung Lap./info","Ta Phai./info","Thoat./Exit"})
end;
function info(nsel)
post = nsel +1
if post == 1 then
SetTaskTemp(TaskTempBH,1)
elseif post == 2 then
SetTaskTemp(TaskTempBH,3)
elseif post == 3 then
SetTaskTemp(TaskTempBH,2)
end
lapbang_buoc3()
end;
function lapbang_buoc3()
LIST_TONG[getn(LIST_TONG)+1] = {GetName(),GetName(),"Chua Co",0,0,GetTaskTemp(TaskTempBH),0}
LIST_MEMBER_TONG[getn(LIST_MEMBER_TONG)+1] = {GetName(),GetName()}
bangdanhsachbanghoi = TaoBang(LIST_TONG,"LIST_TONG","")
SaveData(filetong,bangdanhsachbanghoi)
danhsachthanhvienbanghoi = TaoBang(LIST_MEMBER_TONG,"LIST_MEMBER_TONG","")
SaveData(filetongmem,danhsachthanhvienbanghoi)
SetCamp(GetTaskTemp(TaskTempBH))
SetCurCamp(GetTaskTemp(TaskTempBH))
DelItem(idNVK)
Msg2Player("Lap bang "..GetName().." thanh cong")
Msg2SubWorld("Bang Hoi "..LIST_TONG[getn(LIST_TONG)][1].." da duoc thanh lap.")
print(GetName().." lap bang "..GetName())
SetTaskTemp(TaskTempBH,0)
SetTask(TaskBHchucvu,0)
SetRank(19)
end;
function nhanthanhvien()
team = GetTeam()
tenbang = GuildMember()
if team == nil then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Khong he co nguoi nao trong to doi nguoi.")
return
end
name = GetName()
mauchu = GetCurCamp()
for i = 1,GetPlayerCount() do
PlayerIndex = i
if GetTeam() == team and GetName() ~= name then
Say("Bang chu bang <color=yellow>"..tenbang.."<color> muon moi ban gia nhap bang.",2,"Ta dong y gia nhap bang "..tenbang.."./dongynhapbang","Khong can./ExitG")
end
end
end;
function dongynhapbang()
if Guild(GetName()) == 1 then
Msg2Team(GetName().." dang la thanh vien cua bang "..GuildMember())
LeaveTeam()
else
if GetCurCamp() ~= nil then
for k = 1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[k][1] == tenbang then
LIST_MEMBER_TONG[k][getn(LIST_MEMBER_TONG[k])+1] = GetName()
danhsachthanhvienbanghoi = TaoBang(LIST_MEMBER_TONG,"LIST_MEMBER_TONG","")
SaveData(filetongmem,danhsachthanhvienbanghoi)
Msg2Team("Xin chuc mung! Ban da gia nhap bang hoi ["..tenbang.."]")
SetTask(TaskBHchucvu,0)
SetCamp(mauchu)
SetCurCamp(mauchu)
AddNote("Bang "..name)
Msg2SubWorld(GetName().." da gia nhap bang "..tenbang)
print(GetName().." da gia nhap bang "..tenbang)
end
end
else
Msg2Team("Nhan vat nay khong phu hop de gia nhap vao Bang Hoi.")
LeaveTeam()
end
end
end

function ExitG()
Msg2Team("Nguoi choi tu choi loi de nghi.")
LeaveTeam()
end;
function duoithanhvien()
danhsachthanhvien = {}
for i = 1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[i][1] == GuildMember() then
for k = 1,10 do
if LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2] ~= nil and LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2] ~= "" then
danhsachthanhvien[getn(danhsachthanhvien)+1] = LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2].."/duoikhoibang"
end
end
end
end
if getn(danhsachthanhvien) == 0 then
return
end
if CountMember(GuildMember()) > 10 then
danhsachthanhvien[getn(danhsachthanhvien)+1] = "Tiep Theo./tieptheo"
danhsachthanhvien[getn(danhsachthanhvien)+1] = "Thoat./Exit"
else
danhsachthanhvien[getn(danhsachthanhvien)+1] = "Thoat./Exit"
end
Say("<color=cyan>Quan Vien Bang Hoi<color>: Bang chu muon duoi thanh vien nao",getn(danhsachthanhvien),danhsachthanhvien)
end;
function tieptheo()
SetTaskTemp(TaskTempSS,GetTaskTemp(TaskTempSS)+1)
duoithanhvien()
end;
function duoikhoibang(nsel)
tenbanghoi = GuildMember()
for i = 1,getn(LIST_MEMBER_TONG) do
for k = 1,getn(LIST_MEMBER_TONG[i]) do
if LIST_MEMBER_TONG[i][k].."/duoikhoibang" == danhsachthanhvien[nsel+1] then
tenthanhvienbiduoi = LIST_MEMBER_TONG[i][k]
LIST_MEMBER_TONG[i][k] = ""
end
end
end
--SetTask(TaskBHchucvu,0)
Msg2SubWorld("Thanh vien "..tenthanhvienbiduoi.." bi duoi khoi bang "..tenbanghoi)
danhsachthanhvienbanghoi = TaoBang(LIST_MEMBER_TONG,"LIST_MEMBER_TONG","")
SaveData(filetongmem,danhsachthanhvienbanghoi)
end;
function roikhoibanghoi()
Say("<color=cyan>Quan Vien Bang Hoi<color>: Nguoi co chac chan muon rut khoi bang <color=metal>"..GuildMember().."<color> khong",2,"Ta nghi ki roi,ta muon roi khoi bang./roikhoibanghoi2","Khong dong y./Exit")
end;
function roikhoibanghoi2()
tenbanghoi = GuildMember()
for i = 1,getn(LIST_MEMBER_TONG) do
for k = 1,getn(LIST_MEMBER_TONG[i]) do
if LIST_MEMBER_TONG[i][k] == GetName() then
LIST_MEMBER_TONG[i][k] = ""
end
end
end
SetTask(TaskBHchucvu,0)
Msg2SubWorld("Thanh vien "..GetName().." roi khoi bang "..tenbanghoi)
danhsachthanhvienbanghoi = TaoBang(LIST_MEMBER_TONG,"LIST_MEMBER_TONG","")
SaveData(filetongmem,danhsachthanhvienbanghoi)
end;
CashtoBox = {10000,50000,500000,1000000,5000000}
function guitienvaobang()
Say("<color=cyan>Quan Vien Bang Hoi<color>: Nguoi muon gui bao nhieu tien vao ngan kho bang "..GuildMember()..".",2,"Phai, ta muon gui/luachonsotien","Thoi de khi khac/Exit")
end
function luachonsotien()
SayEx({"<color=cyan>Quan Vien Bang Hoi<color>: Chao <color="..colorS(1)..">"..GetName().."<color>\nNguoi muon goi bao nhieu tien?","1 van./savecash","5 van./savecash","50 van./savecash","100 van./savecash","500 van./savecash","Thoi de khi khac/Exit"})
end;
function savecash(nsel)
lys = nsel + 1
TestMoney(lys)
end;
function TestMoney(ly)
nocash = "<color="..colorS()..">Ngan Quy Bang<color>: Hien tai trong nguoi cua nguoi khong du tien de goi vao ngan quy."
yes = "<color="..colorS()..">Ngan Quy Bang<color>: Da thuc hien goi tien thanh cong vao ngan quy. Hay kiem tra lai ngan quy bang."
tiengoi = CashGuild()
if ly >= 1 and ly < 6 then
if GetCash() >= CashtoBox[ly] then
Pay(CashtoBox[ly])
nMoney = CashtoBox[ly]
NganKho(GuildMember(),nMoney)
Msg2Player("Ban goi "..CashtoBox[ly].." vao ngan quy bang")
Talk(1,"",yes)
else
Talk(1,"",nocash)
end
else
Msg2Player("Co loi xay ra hay lien he voi DNTmaster de fix.")
<b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
end
end;
function ruttienkhoibang()
--if GuildMaster() == 1 then
Say("<color=cyan>Quan Vien Bang Hoi<color>: Nguoi muon rut ra bao nhieu tien trong ngan kho",6,"10 van luong/ruttien2","100 van luong/ruttien2","1000 van luong/ruttien2","10000 van luong/ruttien2","Rut toan bo tien/ruttien2","Thoat./Exit")
--end
end
function ruttien2(nsel)
ruttienbanghoi = {}
for i = 1,getn(LIST_TONG) do
if GuildMember() == LIST_TONG[i][1] then
ruttienbanghoi = {100000,1000000,10000000,100000000,LIST_TONG[i][4]}
end
end
if CashGuild(GuildMember()) < ruttienbanghoi[nsel+1] then
Msg2Player("Bang cua nguoi chi co "..CashGuild(GuildMember()).." lam gi co nhieu hon ma doi lay")
return
end
if (GetCash() + ruttienbanghoi[nsel+1]) <= 2000000000 then
Earn(ruttienbanghoi[nsel+1])
NganKho(GuildMember(),-1*ruttienbanghoi[nsel+1])
Msg2SubWorld(GetName().." lay di "..ruttienbanghoi[nsel+1].." tu ngan kho bang "..GuildMember())
else
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: So tien trong nguoi qua lon khong the vuot qua 2 ty.")
end
end;
function luachonchucvu()
SayEx({"<color=cyan>Quan Vien Bang Hoi<color>: Nguoi muon phong cho chuc vu gi ?","Truong Lao./modT","Doi Truong./modT","Thoat./Exit"})
end;
function modT(nsel)
sel = nsel+1
if sel == 1 then
CallPlayer1()
elseif sel == 2 then
CallPlayer2()
end
end;
function CallPlayer1()
team = GetTeam()
tenbang = GuildMember()
if team == nil then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Khong he co nguoi nao trong to doi nguoi.")
return
end
name = GetName() --ten bang chu
mauchu = GetCurCamp()
for i = 1,GetPlayerCount() do
PlayerIndex = i
if GetTeam() == team and GetName() ~= name and GuildMember() == tenbang and GetTeamSize() == 2 then
Say("Bang chu bang <color=yellow>"..tenbang.."<color> muon moi ban lam <color=red>Truong Lao<color>.",2,"Ta dong y./lamtl","Khong can./ExitG")
elseif GuildMember() ~= tenbang then
Msg2Team("Nguoi nay khong thuoc bang hoi cua nguoi. Khong the phong chuc vu duoc.")
LeaveTeam()
elseif GetTeamSize() > 2 then
Msg2Team("To doi khong nhieu hon 2 nguoi.\nTu dong cat ket noi to doi")
LeaveTeam()
end
end
end;
function lamtl()
if searchCTask(1) < 6 then
if GetTask(TaskBHchucvu) == 0 then
SetTask(TaskBHchucvu,1)
SetRank(20)
Msg2Team(GetName().." duoc phong lam Truong Lao cua bang "..GuildMember())
LeaveTeam()
else
Msg2Team(GetName().." Hien tai dang la: "..LoadChucVu().." khong the phong chuc tiep tuc.")
LeaveTeam()
end
else
Msg2Team("Hien tai Truong Lao cua bang la 5 nguoi roi khong the phong them nua.")
end
end;
function CallPlayer2()
team = GetTeam()
tenbang = GuildMember()
if team == nil then
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Khong he co nguoi nao trong to doi nguoi.")
return
end
name = GetName() --ten bang chu
mauchu = GetCurCamp()
for i = 1,GetPlayerCount() do
PlayerIndex = i
if GetTeam() == team and GetName() ~= name and GuildMember() == tenbang and GetTeamSize() == 2 then
Say("Bang chu bang <color=yellow>"..tenbang.."<color> muon moi ban lam <color=blue>Doi Truong<color>.",2,"Ta dong y./lamdt","Khong can./ExitG")
elseif GuildMember() ~= tenbang then
Msg2Team("Nguoi nay khong thuoc bang hoi cua nguoi. Khong the phong chuc vu duoc.")
LeaveTeam()
elseif GetTeamSize() > 2 then
Msg2Team("To doi khong nhieu hon 2 nguoi.\nTu dong cat ket noi to doi")
LeaveTeam()
end
end
end;
function lamdt()
if searchCTask(2) < 11 then
if GetTask(TaskBHchucvu) == 0 then
SetTask(TaskBHchucvu,2)
SetRank(21)
Msg2Team(GetName().." duoc phong lam Doi Truong cua bang "..GuildMember())
LeaveTeam()
else
Msg2Team(GetName().." Hien tai dang la: "..LoadChucVu().." khong the phong chuc tiep tuc.")
LeaveTeam()
end
else
Msg2Team("So luong Doi Truong trong bang da qua nhieu khong the tiep tuc.")
end
end;
function LoadChucVu()
if GetTask(TaskBHchucvu) == 1 then
return "Truong Lao"
elseif GetTask(TaskBHchucvu) == 2 then
return "Doi Truong"
elseif GetTask(TaskBHchucvu) == 0 then
return "Mon De"
end
end;
function khaitruchucvu()
SayEx({"<color=cyan>Quan Vien Bang Hoi<color>: Nguoi muon loai bo chuc vu cua ai ?","Tim Truong Lao./searchTask","Tim Doi Truong./searchTask","Thoat./Exit"})
end;
function searchTask(nsel)
tenbang = GuildMember()
danhsach = {}
sel = nsel+1
if sel == 1 then
for i =1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[i][1] == GuildMember() then
for k = 1,10 do
if LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2] ~= nil and LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2] ~= "" and GetTask(TaskBHchucvu) == 1 then
danhsach[getn(danhsach)+1] = LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2].."/BoChucVu"
end
end
end
end
if getn(danhsach) == 0 then
return
end
if getn(danhsach) >= 2 then
danhsach[getn(danhsach)+1] = "Tiep Theo./tieptheo1"
danhsach[getn(danhsach)+1] = "Thoat./Exit"
end
Say("<color=cyan>Quan Vien Bang Hoi<color>: Loai chuc vu cua ai ?",getn(danhsach),danhsach)
elseif sel == 2 then
for i =1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[i][1] == GuildMember() then
for k = 1,10 do
if LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2] ~= nil and LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2] ~= "" and GetTask(TaskBHchucvu) == 2 then
danhsach[getn(danhsach)+1] = LIST_MEMBER_TONG[i][GetTaskTemp(TaskTempSS)*10+k+2].."/BoChucVu"
end
end
end
end
if getn(danhsach) == 0 then
return
end
if getn(danhsach) >= 2 then
danhsach[getn(danhsach)+1] = "Tiep Theo./tieptheo1"
danhsach[getn(danhsach)+1] = "Thoat./Exit"
end
Say("<color=cyan>Quan Vien Bang Hoi<color>: Loai chuc vu cua ai ?",getn(danhsach),danhsach)
end
end;
function tieptheo1()
SetTaskTemp(TaskTempSS,GetTaskTemp(TaskTempSS)+1)
khaitruchucvu()
end;
function BoChucVu()
ReFactionTo()
SetTask(TaskBHchucvu,0)
Msg2Player("Ban bi bang chu khai tru chuc vu.")
end;
function searchCTask(id)
task = 0
for i = 1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[i][1] == tenbang then
for k = 1,getn(LIST_MEMBER_TONG[i]) do
for j = 1,GetPlayerCount() do
PlayerIndex = j
if LIST_MEMBER_TONG[i][k] == GetName() and GetTask(TaskBHchucvu) == id then
task = task + 1
end
end
return task
end
end
end
end;
function lapbang()
if GetLevel() >= YcLv then
if HaveItem(idNVK) >= 1 then
lapbang_buoc1()
else
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Muon lap bang hoi can co 1 <color=metal>Nhac Vuong Kiem<color>.")
end
else
Talk(1,"","<color=cyan>Quan Vien Bang Hoi<color>: Dang cap toi thieu de lap bang la <color=pink>cap "..YcLv.."<color>.")
end
end;
function phattientrongbang()
SayEx({"<color=cyan>Quan Vien Bang Hoi<color>: Bang chu muon phat cho moi nguoi trong bang bao nhieu tien",
"5 van/phattientrongbang_yes",
"10 van/phattientrongbang_yes",
"50 van/phattientrongbang_yes",
"100 van/phattientrongbang_yes",
"200 van/phattientrongbang_yes",
"500 van/phattientrongbang_yes",
"Thoat./Exit"})
end;
tienchua = {50000,100000,500000,1000000,2000000,5000000}
function phattientrongbang_yes(nsel)
cash = nsel + 1
tenbang = GuildMember()
for i = 1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[i][1] == GuildMember() then
if CashGuild(GuildMember()) < getn(LIST_MEMBER_TONG[i])*tienchua[cash] then
Msg2Player("So tien trong bang khong du de phat.\nSo tien trong bang la "..CashGuild(GuildMember()))
return
end
break
end
end
for i = 1,GetPlayerCount() do
PlayerIndex = i
if GuildMember() == tenbang then
Earn(tienchua[cash])
NganKho(tenbang,-(tienchua[cash]))
Msg2Player("Ban duoc bang chu phat cho "..(tienchua[cash]).." luong")
end
end
end
function nganquybang()
SayEx({"<color=cyan>Quan Vien Bang Hoi<color>: Thong Tin Bang Hoi:\nNgan Quy: <color=yellow>"..CashGuild(GuildMember()).."<color>",tool[8],tool[9],tool[10],tool[12]})
end
tool = {
"Lap Bang./lapbang", --1
"Nhan Nguoi Vao Bang./nhanthanhvien", -- 2
"Duoi Khoi Bang./duoithanhvien", --3
"Roi Khoi Bang./roikhoibanghoi", --4
"Phong Chuc Vu./luachonchucvu", -- 5
"Huy Bo Chuc Vu./khaitruchucvu", --6
"Ngan Quy Bang./nganquybang", --7
"Goi Tien Vao Bang./guitienvaobang", --8
"Rut Tien Khoi Bang./ruttienkhoibang", --9
"Phat Tien Cho Nguoi Trong Bang./phattientrongbang", --10
"Nang Cap Bang Hoi./updateTong", --11
"Thoat./Exit", --12
"Dang Ky Cong Thanh./dangkycongthanh", --13
"Giao Khieu Chien Lenh./giaokhieuchienlenh", --14
"Di Cong Thanh./CONGTHANHCHIEN_CONG", --15
"Mua Ngua Bang Hoi./muangua", --16
"Di Thu Thanh./CONGTHANHCHIEN_THU", --17
}
function banghoi_main()
SetTaskTemp(TaskTempBH,0)
SetTaskTemp(TaskTempSS,0)
tenbang = GuildMember()
nganquy = CashGuild(GuildMember())
thanhvien = CountMember(GuildMember())
khieuchien = SOLUONG_KHIEUCHIENLENH(GuildMember())
if tenbang == nil then tenbang = "_" end
if nganquy == nil then nganquy = "_" end
if thanhvien == nil then thanhvien = "_" end
if khieuchien == nil then khieuchien = "_" end
str = "Bang Chu: "..tenbang.."\tNgan Quy: "..nganquy.."\nSo Thanh Vien: "..thanhvien.." nguoi.\tSo Khieu Chien Lenh: "..khieuchien.."."
if GuildMember() ~= nil then
if GuildMaster() == 1 then
Say(str,10,tool[2],tool[3],tool[5],tool[6],tool[7],tool[11],tool[13],tool[14],tool[16],tool[12])
elseif LoadChucVu() == "Truong Lao" then
Say(str,5,tool[2],tool[4],tool[7],tool[14],tool[12])
elseif LoadChucVu() == "Doi Truong" then
Say(str,5,tool[2],tool[4],tool[8],tool[14],tool[12])
elseif LoadChucVu() == "Mon De" then
Say(str,4,tool[4],tool[8],tool[14],tool[12])
end
else
Say("<color=cyan>Bang Hoi Quan Vien<color>: Dieu Kien:\nDang Cap Tren "..YcLv.."\nDanh Vong: "..YcDV.." diem\nTai Lanh Dao: Cap "..YcTLD.."\nTien: "..Luong.." luong\nVa 1 cay Nhac Vuong Kiem va da Xuat Su.",2,tool[1],tool[12])
end
end;
function main()
ngay = tonumber(date("%d"))
gio = tonumber(date("%H"))
banghoi_main()
end;

function banghoi_in_war()
SetTaskTemp(TaskTempBH,0)
SetTaskTemp(TaskTempSS,0)
tenbang = GuildMember()
nganquy = CashGuild(GuildMember())
thanhvien = CountMember(GuildMember())
khieuchien = SOLUONG_KHIEUCHIENLENH(GuildMember())
str1 = "Bang Chu: "..tenbang.."\tNgan Quy: "..nganquy.."\nSo Thanh Vien: "..thanhvien.." nguoi.\tSo Khieu Chien Lenh: "..khieuchien.."."


end;

function banghoi_war_main()
SetTaskTemp(TaskTempBH,0)
SetTaskTemp(TaskTempSS,0)
tenbang = GuildMember()
nganquy = CashGuild(GuildMember())
thanhvien = CountMember(GuildMember())
khieuchien = SOLUONG_KHIEUCHIENLENH(GuildMember())
if tenbang == nil then tenbang = "__" end
if nganquy == nil then nganquy = "__" end
if thanhvien == nil then thanhvien = "__" end
if khieuchien == nil then khieuchien = "__" end
str = "Bang Chu: <color=red>"..tenbang.."<color>\nNgan Quy: <color=yellow>"..nganquy.."<color>\nSo Thanh Vien: "..thanhvien.." nguoi.\nSo Khieu Chien Lenh: "..khieuchien.."."
if NgayCongThanh() ~= nil then--ngay duoc cong thanh
if GuildMaster() == 1 then
if GuildMember() == BANGDUOCCONGTHANH(NgayCongThanh()) and gio == giocongthanh then
SayEx({str,tool[15],tool[2],tool[3],tool[5],tool[6],tool[7],tool[11],tool[13],tool[14],tool[16],tool[12]})
elseif GuildMember() == BANGCHIEMTHANH(NgayCongThanh()) and gio == giocongthanh then
SayEx({str,tool[15],tool[2],tool[3],tool[5],tool[6],tool[7],tool[11],tool[14],tool[16],tool[12]})
else
SayEx({str,tool[2],tool[3],tool[5],tool[6],tool[7],tool[11],tool[13],tool[14],tool[16],tool[12]})
end
elseif GuildMember() == BANGDUOCCONGTHANH(NgayCongThanh()) then
if LoadChucVu() == "Truong Lao" then
SayEx({str,tool[15],tool[2],tool[4],tool[7],tool[14],tool[12]})
elseif LoadChucVu() == "Doi Truong" then
SayEx({str,tool[15],tool[2],tool[4],tool[8],tool[14],tool[12]})
elseif LoadChucVu() == nil and GuildMaster() == nil then
SayEx({str,tool[15],tool[4],tool[8],tool[14],tool[12]})
end
elseif GuildMember() == BANGCHIEMTHANH(NgayCongThanh()) then
if LoadChucVu() == "Truong Lao" then
SayEx({str,tool[15],tool[2],tool[4],tool[7],tool[14],tool[12]})
elseif LoadChucVu() == "Doi Truong" then
SayEx({str,tool[15],tool[2],tool[4],tool[8],tool[14],tool[12]})
elseif LoadChucVu() == nil and GuildMaster() == nil then
SayEx({str,tool[15],tool[4],tool[8],tool[14],tool[12]})
end
elseif GuildMember() ~= nil then
if LoadChucVu() == "Truong Lao" then
SayEx({str,tool[2],tool[4],tool[7],tool[14],tool[12]})
elseif LoadChucVu() == "Doi Truong" then
SayEx({str,tool[2],tool[4],tool[8],tool[14],tool[12]})
elseif LoadChucVu() == nil and GuildMaster() == nil then
SayEx({str,tool[4],tool[8],tool[14],tool[12]})
end
else
SayEx({"<color=cyan>Bang Hoi Quan Vien<color>: Nguoi co muon lap bang hay khong?\nDieu Kien:\n<color=water>Dang Cap Tren "..YcLv.."<color>\nDanh Vong: <color=pink>"..YcDV.." diem<color>\nTai Lanh Dao: <color=green>Cap "..YcTLD.."<color>\nTien: <color=yellow>"..Luong.." luong<color>\nVa 1 cay <color=bule>Nhac Vuong Kiem<color> va da <color=red>Xuat Su<color>.",tool[1],tool[12]})
end
else
banghoi_main()
end
end;

function NgayCongThanh()--ten thanh thi dien ra cong thanh chien
ngay = tonumber(date("%d"))
for i = 1,getn(ngaycongthanh) do
if ngay == ngaycongthanh[i][1] then
return ngaycongthanh[i][2]
end
end
end;
function dangkycongthanh()
if gio ~= giocongthanh then
local thanhthi = {}
for i = 1,getn(THANHTHI) do
thanhthi[i] = THANHTHI[i][1].."/DANGKYCONGTHANH"
end
thanhthi[getn(thanhthi)+1] = "De ta say nghi lai da/out"
Say("<color=cyan>Bang Hoi Quan Vien<color>: <color=green>Nguoi muon dang ky cong thanh nao<color>",getn(THANHTHI),thanhthi)
else
Say("<color=cyan>Bang Hoi Quan Vien<color>: Dang trong thoi gian dien ra cong thanh chien, ban khong the dang ky cong thanh",0)
end
end;
function DANGKYCONGTHANH(nsel)
if NgayCongThanh() == THANHTHI[nsel+1][1] then
Msg2Player("Ban khong the dang ky cong thanh "..NgayCongThanh().." ngay hom nay")
return
end
if GuildMember() == BANGCHIEMTHANH(NgayCongThanh()) then
Msg2Player("Bang hoi cua ban dang chiem thanh "..NgayCongThanh())
return
end
for i = 1, getn(THANHTHI[nsel+1]) do
if THANHTHI[nsel+1][i] == GuildMember() then
Msg2Player("Bang "..GuildMember().." da dang ky cong thanh "..THANHTHI[nsel+1][1].." roi, khong can dang ky tiep")
return
end
end
THANHTHI[nsel+1][getn(THANHTHI[nsel+1])+1] = GuildMember()
dangkycongthanhchien = TaoBang(THANHTHI,"THANHTHI","")
SaveData(filetongcaste,dangkycongthanhchien)
Msg2SubWorld("Bang "..GuildMember().." dang ky cong thanh "..THANHTHI[nsel+1][1])
end;
function BANGCHIEMTHANH(ten)---tenthanhthi
if GetMissionV(4) == 3 then
return BANGDUOCCONGTHANH(NgayCongThanh())
end
for i = 1,getn(THANHTHI) do
if THANHTHI[i][1] == ten then
return THANHTHI[i][2]--ten bang chiem thanh
end
end
end;
function BANGDUOCCONGTHANH(tenthanhthi)--ten bang se duoc cong thanh
if getn(THANHTHI) == 0 then
return
end
if bangduoccongthanh == "" then
for i = 1,getn(THANHTHI) do
if THANHTHI[i][1] == tenthanhthi then
if getn(THANHTHI[i]) == 3 then
bangduoccongthanh = THANHTHI[i][3]
end
if getn(THANHTHI[i]) == 2 then
bangduoccongthanh = ""
end
if getn(THANHTHI[i]) >= 3 then
bangduoccongthanh = THANHTHI[i][3]
for k = 4,getn(THANHTHI[i]) do
if SOLUONG_KHIEUCHIENLENH(bangduoccongthanh) < SOLUONG_KHIEUCHIENLENH(THANHTHI[i][k]) then
bangduoccongthanh = THANHTHI[i][k]
end
end
end
end
end
for i = 1,getn(LIST_TONG) do
if LIST_TONG[i][1] == bangduoccongthanh then
LIST_TONG[i][5] = 0
end
end
capnhattintuccongthanh = TaoBang(LIST_TONG,"LIST_TONG","")
SaveData(filetong,capnhattintuccongthanh)
end
return bangduoccongthanh
end;
function SOLUONG_KHIEUCHIENLENH(tenbanghoi)
for i = 1,getn(LIST_TONG) do
if LIST_TONG[i][1] == tenbanghoi then
return LIST_TONG[i][5]
end
end
end;
function CONGTHANH_WIN()
for i = 1,getn(THANHTHI) do
if THANHTHI[i][1] == NgayCongThanh() then
THANHTHI[i] = {NgayCongThanh(),BANGDUOCCONGTHANH(NgayCongThanh() )}
capnhattintuccongthanh = TaoBang(THANHTHI,"THANHTHI","")
SaveData(filetongcaste,capnhattintuccongthanh)
end
end
for i = 1,getn(LIST_TONG) do
if LIST_TONG[i][1] == BANGDUOCCONGTHANH(NgayCongThanh()) then
LIST_TONG[i][3] = NgayCongThanh()
capnhattintuccongthanh = TaoBang(LIST_TONG,"LIST_TONG","")
SaveData(filetong,capnhattintuccongthanh)
end
end
end;
function giaokhieuchienlenh()
if GetItemCount(idKCL) == 0 then
Msg2Player("Nguoi khong mang theo khieu chien lenh trong nguoi.")
return
end
if GuildMember() ~= nil then
for i = 1,getn(LIST_TONG) do
if GuildMember() == LIST_TONG[i][1] then
LIST_TONG[i][5] = LIST_TONG[i][5] + GetItemCount(idKCL)
Msg2Player("Ban da dong gop "..GetItemCount(idKCL).." khieu chien lenh cho bang "..GuildMember())
for i = 1,GetItemCount(idKCL) do
DelItem(idKCL)
AddOwnExp(50000)
end
capnhattintuccongthanh = TaoBang(LIST_TONG,"LIST_TONG","")
SaveData(filetong,capnhattintuccongthanh)
break
end
end
end
end;
function dicongthanh()
--idx = SubWorldID2Idx(326)
--SubWorld = idx
gio = tonumber(date("%H"))
if gio ~= giocongthanh then
Say("<color=cyan>Bang Hoi Quan Vien<color>: Van chua den thoi gian dien gia Cong Thanh Chien",1,"Thoat./Exit")
return
end
if GetMissionV(4) == 3 then
Msg2Player("Hoat dong cong thanh chien da ket thuc,khong the den khu vuc chien truong!")
return
end
if BANGDUOCCONGTHANH(NgayCongThanh()) == "" then
Msg2Player("He thong chua xac dinh bang se cong thanh hom nay, ban khong the di chien truong")
return
end
if GuildMember() == BANGCHIEMTHANH(NgayCongThanh()) then
NewWorld(222,200*8,200*16)
SetFightState(0)
SetCurCamp(1)
SetCreateTeam(0);
SetTask(saveEXP,GetExp())
SetDeathScript("\\script\\cacsukien\\banghoi\\player_death.lua")
SetPunish(0)
SetTempRevPos(222,200*8,200*16)
SetLogoutRV(1);
Msg2Player("Ban da den chien truong phe thu thanh ")
elseif GuildMember() == BANGDUOCCONGTHANH(NgayCongThanh()) then
NewWorld(223,200*8,200*16)
SetFightState(0)
SetCurCamp(2)
SetCreateTeam(0);
SetPunish(0)
SetTask(saveEXP,GetExp())
SetDeathScript("\\script\\cacsukien\\banghoi\\player_death.lua")
SetTempRevPos(223,200*8,200*16)
SetLogoutRV(1);
Msg2Player("Ban da den chien truong phe cong thanh ")
end
end;
function ReFactionTo()
playerfaction = GetFaction()
if playerfaction == "Thieu Lam Phai" then
SetRank(1)
elseif playerfaction == "Thien Vuong Bang" then
SetRank(2)
elseif playerfaction == "Duong Mon" then
SetRank(3)
elseif playerfaction == "Ngu Doc Giao" then
SetRank(4)
elseif playerfaction == "Nga My Phai" then
SetRank(5)
elseif playerfaction == "Thuy Yen Mon" then
SetRank(6)
elseif playerfaction == "Cai Bang" then
SetRank(7)
elseif playerfaction == "Thien Nhan Giao" then
SetRank(8)
elseif playerfaction == "Vo Dang Phai" then
SetRank(9)
elseif playerfaction == "Con Lon Phai" then
SetRank(10)
end
end;
function updateTong()
tenbang = GuildMember()
Msg2Player("Chua cap nhat.")
end;

function TaoBang(tTable, sTableName, sTab)
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..sTab..sTableName.."={"
local tStart = 0
for key, value in tTable do
if tStart == 1 then
sTmp = sTmp..",\r\n"
else
sTmp = sTmp.."\r\n"
tStart = 1
end
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..TaoBang(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
end
sTmp = sTmp.."\r\n"..sTab.."}"
return sTmp
end

function SaveData(file, string)
local f,e = openfile( file, "w+" )
if f then
write(f,string)
closefile(f)
return 1
else
local _,_,path = strfind(file, "(.+[/_\\]).+$")
if path ~= nil then execute("mkdir ".."\""..gsub(path, "/", "\\").."\"") end
f,e = openfile( file, "w+" )
if f then
write(f,string)
closefile(f)
return 2
else
return 0
end
end
end
function search(tenbang,tucantim)
for i = 1,getn(tenbang) do
for k = 1,getn(tenbang[i]) do
if tenbang[i][k] == tucantim then
return 1 --neu co tucantim trong array tenbang thi gia tri la 1
end
end
end
end
function GuildMaster()--ok
if getn(LIST_TONG) == 0 then
return 0
end
for i = 1,getn(LIST_TONG) do
if LIST_TONG[i][2] == GetName() then
return 1
end
end
end
function GuildMember()--ok
for i = 1,getn(LIST_MEMBER_TONG) do
for k =1,getn(LIST_MEMBER_TONG[i]) do
if GetName() == LIST_MEMBER_TONG[i][k] then
return LIST_MEMBER_TONG[i][1] --ten bang cua player
end
end
end
end
function CountMember(tenbang)
ghost = 0
for i = 1,getn(LIST_MEMBER_TONG) do
if LIST_MEMBER_TONG[i][1] == tenbang then
for k = 1,getn(LIST_MEMBER_TONG[i]) do
if LIST_MEMBER_TONG[i][k] == "" or LIST_MEMBER_TONG[i][k] == nil then
ghost = ghost + 1
end
end
return getn(LIST_MEMBER_TONG[i]) - ghost -1
end
end
end
function Guild(ten)---nil chua vao bang---1 da vao bang
for i = 1,getn(LIST_MEMBER_TONG) do
for k = 1,getn(LIST_MEMBER_TONG[i]) do
if LIST_MEMBER_TONG[i][k] == ten then
return 1
end
end
end
end
function CashGuild(tenbanghoi)
for i = 1,getn(LIST_TONG) do
if LIST_TONG[i][1] == tenbanghoi then
return LIST_TONG[i][4]
end
end
end
function NganKho(tenbang,nMoney)
if nMoney == nil then
return
end
for i = 1,getn(LIST_TONG) do
if tenbang == LIST_TONG[i][1] then
LIST_TONG[i][4] = LIST_TONG[i][4] + nMoney
if nMoney >= 0 then
Pay(nMoney)
--Msg2SubWorld("Ban da dong gop "..nMoney.." luong cho bang "..GuildMember())
else
Earn(nMoney)
--Msg2SubWorld("Ban da rut "..nMoney.." luong tu ngan kho bang "..GuildMember())
end
capnhattintuccongthanh = TaoBang(LIST_TONG,"LIST_TONG","")
SaveData(filetong,capnhattintuccongthanh)
break
end
end
end
function TIMKIEM(tenbang,tucantim)
for i = 1,getn(tenbang) do
for k = 1,getn(tenbang[i]) do
if tenbang[i][k] == tucantim then
return 1 --neu co tucantim trong array tenbang thi gia tri la 1
end
end
end
end

function muangua()
SayEx({"<color=cyan>Chan Ngua Bang Hoi<color>: Nguoi muon mua nguoi loai gi ?","Ngua 80./ngua80","Ngua 100./ngua100","Thoat./Exit"})
end;

function ngua80()
Sale(40)
end;

function ngua100()
SayEx({"<color=cyan>Ban Ngua<color>:",
"Bon Tieu-1000v./bontieu",
"Phien Vu-1500v./phienvu",
"Phi Van-1500v./phivan",
"Xich Long Cau-2000v./xichlong",
"Du Huy-2500v./duhuy",
"Thoat./Exit"})
end;

function bontieu()
tien = Van(1000)
if GetCash() >= tien then
Pay(tien)
AddItem(0,10,6,10,0,0,0)
else
MsgEx("Can co "..tien.." luong de mua.")
end
end;

function phienvu()
tien = Van(1500)
if GetCash() >= tien then
Pay(tien)
AddItem(0,10,7,10,0,0,0)
else
MsgEx("Can co "..tien.." luong de mua.")
end
end;

function phivan()
tien = Van(1500)
if GetCash() >= tien then
Pay(tien)
AddItem(0,10,8,10,0,0,0)
else
MsgEx("Can co "..tien.." luong de mua.")
end
end;

function xichlong()
tien = Van(2000)
if GetCash() >= tien then
Pay(tien)
AddItem(0,10,9,10,0,0,0)
else
MsgEx("Can co "..tien.." luong de mua.")
end
end;

function duhuy()
tien = Van(2500)
if GetCash() >= tien then
Pay(tien)
AddItem(0,10,11,10,0,0,0)
else
MsgEx("Can co "..tien.." luong de mua.")
end
end;

function sieuquang()
tien = Van(3000)
if GetCash() >= tien then
Pay(tien)
AddItem(0,10,13,10,0,0,0)
else
MsgEx("Can co "..tien.." luong de mua.")
end
end;

script này ổn ko các bạn , mình ko cần chức năng công thành nen scrip này chắc ổn phải ko ???????????

01676598479
24-03-12, 05:50 PM
không ổn đâu bạn,awjx set rank không hiển thị trên đầu nên chỉ thấy tên bang ở khung F3 thôi,nói chung chả có gì hay hết á L-)

evjnshiva
24-03-12, 06:31 PM
có lẽ awjx nguyên bản là vậy nhưng mình đang dev cái tsbd+awjx nên chuyện danh hiệu bang trên đầu là hoàn toàn khả thi :D , mình chỉ hỏi cái scrip mình pót lên có khả thi khi dùng lập bang trong tsbd+awjx ko , và làm sao để reset thông tin bang khi dùng scrip này ( nó có cái list nhưng ko biết phải xóa list hay xóa cái flie nữa :( )

runkissbig
28-03-12, 07:30 AM
có lẽ awjx nguyên bản là vậy nhưng mình đang dev cái tsbd+awjx nên chuyện danh hiệu bang trên đầu là hoàn toàn khả thi :D , mình chỉ hỏi cái scrip mình pót lên có khả thi khi dùng lập bang trong tsbd+awjx ko , và làm sao để reset thông tin bang khi dùng scrip này ( nó có cái list nhưng ko biết phải xóa list hay xóa cái flie nữa :( )

Xóa 2 cái folder có chữ Tong ngoài SV là reset hết. Còn nếu dùng sv cua heocon thì bạn coppy folder bang hội khi chưa lập đè lên cái đã lập thì reset