Kết quả 1 đến 2 của 2
-
28-10-09, 09:55 PM #1
- Ngày tham gia
- Apr 2008
- Đang ở
- HCM
- Bài viết
- 546
- Thanks
- 9
- Thanked 82 Times in 27 Posts
Script kết hôn dùng cấu trúc lưu dữ liệu
Tôi nhớ đã share một lần gòi nhưng giờ update chọ mọi người luk
nguyet_lao.lua
Code:--------------------------------------------------------- ----------------Ket hon-------------------------------- DANH_SACH_KET_HON = {} Include("\\script\\ket_hon\\danh_sach_marrie.lua") ---data save o day >''< strMain = { "<bclr=red>Nguyet Lao<bclr> : Ta la nguoi chuyen di lam may moi cho cac cap trai gai dang <color=pink>Yeu<color> nhau, hom nay nguoi den gap ta co chuyen gi khong", "Ta muon ket hon/kethonok", "Ta muon ly hon/kethondel", "Ta gop gop tien vao quy vo chong/gop_money", "Giao vo chong thiep/giao_hw_thiep", "Ta muon dung tien de mua nha/buyhouse", "Ta muon rut tien trong quy/ruttien", "Ta muon kiem tra tinh hinh/kiemtra", "Ket thuc doi thoai/out" } function main() strSay = "Ten chong Ten Vo So Tien Quy\n" for i=1,getn(DANH_SACH_KET_HON) do strSay = strSay..DANH_SACH_KET_HON[i][1].." "..DANH_SACH_KET_HON[i][2].." "..DANH_SACH_KET_HON[i][3].."\n" end if KETHON(GetName()) == 1 then Say(strSay,6,strMain[3],strMain[4],strMain[5],strMain[7],strMain[8],strMain[9]) else Say(strSay,2,strMain[2],strMain[9]) end end function kethonok() team=GetTeam() size=GetTeamSize() if team==nil then Say("<bclr=red>Nguyet Lao<bclr> : Nguoi phai lap to doi 2 nguoi la nam va nu thi moi ket hon duoc !",0) elseif team~=nil and size ~= 2 then Say("<bclr=red>Nguyet Lao<bclr> : Nguoi phai lap to doi 2 nguoi thi moi ket hon duoc ! doi ban chi co"..size,0) elseif team~=nil and size==2 and IsCaptain()~=1 then Say("<bclr=red>Nguyet Lao<bclr> : Chi co chu nhom moi den dang ky duoc !",0) elseif team~=nil and size==2 and IsCaptain()==1 then Say("<bclr=red>Nguyet Lao<bclr> : Nguoi da du dieu kien de ket hon roi nguoi co muon ket hon khong ?",2,"Tat nhien muon/ok","Ta chua chuan bi tam ly/out") end end function ok() team=GetTeam() sex=GetSex() name=GetName() if TIMKIEM(GetName()) == 1 then Say("Nguoi dung la khong chung thuy ma ta se mach cho "..VOLA(GetName()).." do",0) return end if GetSex() == 0 then for i=1,GetPlayerCount() do PlayerIndex = i if GetTeam() == team and GetName() ~= name then if GetSex() == 1 then DANH_SACH_KET_HON[getn(DANH_SACH_KET_HON)+1] = {name,GetName(),0,0,0} --chong--vo--tien quy--vochongthiep--socon-- danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) Msg2SubWorld("Chuc mung ! 1 cap vo chong vua ket hon la "..name.." ♂ va "..GetName().." ♀ !") break else Msg2Team("Hai nguoi muon tro thanh nguoi dong tinh u >''<") end end end else Say("Nguoi la con gai chuyen dai su nay phai de cho nam gioi lam chu ! dung trach ta co hu nhe !",0) end end function kethondel() if KETHON(GetName()) == 1 then for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then Msg2SubWorld("Cap vo chong vua ly hon la ♂ :"..DANH_SACH_KET_HON[i][1].." ♀ :"..DANH_SACH_KET_HON[i][2]) DANH_SACH_KET_HON[i] = nil danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) end end else Say("Nguoi van chua ket hon ly hon voi ai the !",0) end end function gop_money() if KETHON(GetName()) == 1 then for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then tien = GetCash() if tien == 0 then Say("Co 0 dong ma cung bay dat gop quy that nuc cuoi !",0) return end tien_kho = DANH_SACH_KET_HON[i][3] tongcong = tien + tien_kho DANH_SACH_KET_HON[i][3] = tongcong Pay(tien) danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) Msg2Player("Ban vua gop them "..tien..", vao quy rieng cua vo chong ban !") end end else Say("Nguoivan chua ket hon gui tien di dau day !",0) end end function giao_hw_thiep() if KETHON(GetName()) == 1 then for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then item = GetItemCount(15) if item == 0 or item == nil then Say("Co cai gi dau ma doi gop tuc uoi that ^__^ !",0) return end count = DANH_SACH_KET_HON[i][4] DANH_SACH_KET_HON[i][4] = item + count danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) end end else Say("Chua ket hon ta khong giup gi duoc nguoi ca !",0) end end function kiemtra() Say("<bclr=red>Nguyet Lao<bclr> : Nguoi muon kiem tra gi nao hay noi ta biet",3, "So tien trong quy vo chong ta/tienquy", "So vo chong thiep vo chong ta dat duoc/vchong", "Ket thuc doi thoai/out") end function tienquy() for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then Talk(1,"","So tien quy cua vo chong nguoi la :<color=red>"..DANH_SACH_KET_HON[i][3].."<color> luong") end end end function vchong() for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then Talk(1,"","So vo chong thiep cua vo chong nguoi la :<color=red>"..DANH_SACH_KET_HON[i][4].."<color> cai") end end end function ruttien() Say("Nguoi muon rut bao nhieu tien tu trong quy cua vo chong nguoi !",4, "10 van/_10v", "100 van/_100v", "Tat ca so tien/all", "Ket thuc doi thoai/out") end function _10v() for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then if DANH_SACH_KET_HON[i][3] >= 10000000 then Earn(10000000) DANH_SACH_KET_HON[i][3] = DANH_SACH_KET_HON[i][3] - 10000000 danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) else Say("<bclr=red>Nguyet Lao<bclr> : So tien quy nguoi qua it khong rut duoc !",0) end end end end function _100v() for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then if DANH_SACH_KET_HON[i][3] >= 100000000 then Earn(100000000) DANH_SACH_KET_HON[i][3] = DANH_SACH_KET_HON[i][3] - 100000000 danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) else Say("<bclr=red>Nguyet Lao<bclr> : So tien quy nguoi qua it khong rut duoc !",0) end end end end function all() for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] or DANH_SACH_KET_HON[i][2] == GetName() then Earn(DANH_SACH_KET_HON[i][3]) DANH_SACH_KET_HON[i][3] = 0 danhsachkethon = TaoBang(DANH_SACH_KET_HON,"DANH_SACH_KET_HON","") SaveData("script/ket_hon/danh_sach_marrie.lua",danhsachkethon) end end end function TaoBang(tTable, sTableName, sTab) --include cua manh tuyen 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) ---Tuy ngan nhung wan trong nhat >''< file_op = openfile( file, "w+" ) --- a+ la vit them hem xoa file dau -- w+ -- la che do doc ghi xoa file dau write(file_op,string) closefile(file_op) end function KETHON(name) if getn(DANH_SACH_KET_HON) == 0 then return 0 end for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] == name or DANH_SACH_KET_HON[i][2] == name then return 1 end end end function TIMKIEM(string) for i=1,getn(DANH_SACH_KET_HON) do for k=1,getn(DANH_SACH_KET_HON[i]) do if DANH_SACH_KET_HON[i][k] == string then return 1 end end end end function buyhouse() Msg2Player("Chuc nang nay se cap nhat sau ") end function VOLA(husband) if husband == nil then return 0 end for i=1,getn(DANH_SACH_KET_HON) do if DANH_SACH_KET_HON[i][1] == husband then return DANH_SACH_KET_HON[i][2] end end end function out() end;---------------------script end
Code:DANH_SACH_KET_HON={}
Code:\Script\ket_hon
Test script này tui chế tính năng ai múm phát triển dựa vào nó rất tốt tui ũng hộ 100 % sức lực
Chúc bạn vui !
-
28-10-09, 09:56 PM #2
- Ngày tham gia
- Apr 2008
- Đang ở
- HCM
- Bài viết
- 546
- Thanks
- 9
- Thanked 82 Times in 27 Posts
Ðề: Script kết hôn dùng cấu trúc lưu dữ liệu
Câu hỏi đặt ra cho mọi người chỉ ra cấu trúc lưu dữ liệu của script nầy ở chỗ nào
Có thể bỏ bước đó hong ?
Các Chủ đề tương tự
-
Một số script trong thư mục script Vina (unpack)
Bởi sangpronhat trong diễn đàn ScriptsTrả lời: 19Bài viết cuối: 26-11-11, 08:12 AM