Diễn Đàn Game - Forum Game Private | GamePrivate.Biz

Xin Chào

[Võ Lâm]Script Sư Đồ

Share
    New Mem
    avatar

    Tổng số bài gửi : 6

    Giới tính : Male

    Gold : 28

    Cảm Ơn : 4

    Ngày Tham Gia : 2013-11-25

    Post by 1horh19254 on 25/11/13, 10:10 am

    Share cái này chứ để chả làm gì , cái này lúc trước có 1 số bug nhỏ nhỏ nhưng Fix rồi mà hồi đó cũng gần 1 năm rồi sang nhỉ 
    Code
    sudo_main.lua
    code

    --Dj sangpronhat
    --Date : 21/11/2009
    --He thong su do
    --¡ï¡ï¡ï¡ï¡ï¡ï¡ï
    ----------------------
    SU={}
    DO={}
    Include("\\script\\lib\\taobang.lua")
    Include("\\script\\sudo_sn\\dssu.lua")
    Include("\\script\\sudo_sn\\dsdo.lua")
    Include("\\script\\sudo_sn\\dssudo.lua")
    Include("\\script\\global\\Serverlib.lua")
    Include("\\Script\\global\\sourcejx49.lua");
    --Khoi tao mang
    loithoai=
    {
    "¡ïThu Nhan Do De/add_dt", --1
    "¡ïBai Su./bai_su",--2
    "¡ïTruy Tim Su Phu./search_s",--3
    "¡ïTruy Tim De Tu./search_dt",--4
    "¡ïXuat Su./leave_sd",--5 
    "¡ïPhan Su Do/leave2_sd",--6
    "¡ïTinh Hinh Su Do/LEVS",--7
    "¡ï¡ï[Hot] Ban Do [Su Do]/hot",--8
    "¡ï¡ï[Hot] Kiem Tra Do De/theodoi",--9
    "¡ï¡ï[Hot] Tham Gia Su Do Song Hiep/sdsh",--10
    "¡ïHo tro de tu/helps",--11
    "¡ïTruc Xuat Do De/bo_dt"--12
    }
    sudothiep = 215 --
    daihongbao = 217 --
    function main() ---
    Msg2Player(su().." "..do_t())
    if su()==1 then su_main() return end
    if do_t()==1 then do_main() return end
    if GetLevel() >= 80 then
    Say("<color=green>Tien Su<color>: Voi dang cap cua nguoi co the giup nhung nhan si moi gia nhap giang ho do :!!!",5,loithoai[1],loithoai[12],loithoai[4],loithoai[7],"¡ïKet Thuc./OnEx")
    else
    Say("<color=green>Tien Su<color>: Nguoi muon nhan su phu thi hoi ho co chap nhan nhan nguoi lam de tu khong neu dong y thi moi su phu den gap ta",1,"¡ïKet Thuc./OnEx")
    end
    end

    function su()
    if getn(SU) == 0 then
    return 0 end
    for i=1,getn(SU) do
    name=GetName()
    if name == SU[1] then
    return 1
    else
    return 0
    end
    end
    end
    function search_dt()
    Say("<color=green> To Su: <color> Chuc Nang nay van chua cap nhat",1,"Ket Thuc./OnEx")
    end;

    function su_main()
    Say("<color=green>Tien Su<color>: Dang cap lam su phu cua nguoi la "..LEVS().." nguoi co y dinh gi nho ta giup",5,loithoai[1],loithoai[4],loithoai[7],loithoai[8],"Trang ke tiep/next1")
    end

    function next1()
    Say("<color=green>Tien Su<color>: Dang cap lam su phu cua nguoi la "..LEVS().." nguoi co y dinh gi nho ta giup",5,loithoai[9],loithoai[10],loithoai[11],loithoai[12],"Ket thuc doi thoai/OnEx")
    end 

    function do_t()
    if getn(DO) == 0 then
    return 0 end
    for i=1,getn(DO) do
    for z=2,getn(DO[i]) do
    if DO[i][z]==GetName() then
    return 1
    end
    end
    end
    return 0
    end
    function search_s()
    Say("<color=green>Tien Su<color>: Nguoi muon tim Su Phu <color=red>"..timsu().."<color> phai khong",1,"Ket Thuc./OnEx")
    end;

    function do_main()
    if GetLevel()>=80 then
    Say("<color=green>Tien Su<color>: Su phu cua ban la <color=red>"..timsu().."<color>",5,loithoai[3],loithoai[5],loithoai[6],loithoai[11],"¡ïKet Thuc/OnEx")
    else
    Say("<color=green>Tien Su<color>: Su phu cua ban la <color=red>"..timsu().."<color>",5,loithoai[3],loithoai[6],loithoai[7],loithoai[11],"¡ïKet Thuc/OnEx")
    end
    end

    function OnEx()
    Msg2Player("Sever mang ten Jx50 version 1.0")
    end

    function add_dt()
    sdt_count = GetItemCount(sudothiep)
    tz = GetTeamSize()
    if su()~=1 then
    if sdt_count >= 1 then
    if tz == 2 then
    DelItem(sudothiep)
    SU[getn(SU)+1] = {GetName(),1,1,0}
    bien = TaoBang(SU,"SU")
    LuuBang("script/sudo_sn/dssu.lua",bien)
    pl = PlayerIndex
    team=GetTeam()
    name=GetName()
    lev=GetLevel()
    do_a=nil
    for i=1,GetPlayerCount() do
    PlayerIndex = i
    if team==GetTeam() then
    if name~=GetName() then
    if GetLevel()>=lev then 
    PlayerIndex = pl
    Msg2Player("Khong the nhan de tu co lev cao hon") 
    break 
    end
    if tim_su(GetName())~=1 then
    do_a = GetName()
    break
    else
    PlayerIndex = pl
    Msg2Player("Nhan vat ban muon nhan lam de tu da bai su :!!!")
    return
    end
    end
    end
    end
    Msg2Player(do_a)
    PlayerIndex = pl
    DO[getn(DO)+1] = {GetName(),do_a}--su, do1
    bien = TaoBang(DO,"DO")
    LuuBang("script/sudo_sn/dsdo.lua",bien)
    Msg2SubWorld("Su phu "..GetName().." nhan de tu "..do_a)
    AddGlobalCountNews("Su phu "..GetName().."va Do De"..do_a.." ket bai thanh cong ",1)
    else
    Say("<color=green>Tien Su<color>: Nguoi hay tao do doi giua nguoi va nguoi can nhan lam de tu ta se giup cho",0)
    end
    else
    Say("<color=green>Tien Su<color>: Hay di tim bi pho su do thiep roi den gap ta :!!",0)
    end
    else
    if num_dt() > 5 then Say("To So: Ban dang nhan vuot qua so de tu quy dinh",0) return end
    if sdt_count >= 1 then
    DelItem(sudothiep)
    if tz == 2 then
    pl = PlayerIndex
    team=GetTeam()
    name=GetName()
    lev=GetLevel()
    do_a=nil
    for i=1,GetPlayerCount() do
    PlayerIndex = i
    if team==GetTeam() then
    if name~=GetName() then
    if GetLevel()>=lev then Msg2Player("Khong the nhan de tu co level cao hon") break end
    if tim_su(GetName())~=1 then
    do_a = GetName()
    break
    else
    PlayerIndex = pl
    Msg2Player("Nhan vat ban muon nhan lam de tu da bai su :!!!")
    return
    end
    end
    end
    end
    PlayerIndex = pl
    for k=1,getn(DO) do
    if DO[k][1] == GetName() then
    su_id = k
    so_vl = getn(DO[k])
    break
    end
    end
    DO[su_id][so_vl+1]=do_a
    bien = TaoBang(DO,"DO")
    LuuBang("script/sudo_sn/dsdo.lua",bien)
    for k=1,getn(SU) do
    if SU[k][1] == GetName() then
    su_id = k
    end
    end
    for k=1,getn(DO) do
    if DO[k][1] == GetName() then
    su_id = k
    so_vl = getn(DO[k])
    break
    end
    end
    xuat_su = SU[su_id][4]
    SU[su_id]={GetName(),so_vl-1,floor(so_vl/2),xuat_su}
    bien = TaoBang(SU,"SU")
    LuuBang("script/sudo_sn/dssu.lua",bien)
    Msg2SubWorld("Su phu "..GetName().." nhan de tu "..do_a)
    AddGlobalCountNews("Su do "..GetName()..", "..do_a.." gan ket",1)
    else
    Say("<color=green>Tien Su<color>: Nguoi hay tao do doi giua nguoi va nguoi can nhan lam de tu ta se giup cho",0)
    end
    else
    Say("<color=green>Tien Su<color>: Hay di tim bi pho su do thiep roi den gap ta :!!",0)
    end



    end
    end

    function num_dt()
    for i=1,getn(DO) do
    if DO[i][1]==GetName() then
    return getn(DO[i])-1
    end
    end
    end

    function tim_su(name)
    if getn(DO) == 0 then
    return 0 end
    for i=1,getn(DO) do
    for k=1,getn(DO[i]) do
    if DO[i][k] == name then
    return 1
    end
    end
    end
    return nil
    end

    function LEVS()
    muc_luc = 
    {
    {1,1,3,"Kien tap su phu"},
    {2,2,3,"Pho thong su phu"},
    {3,3,3,"Thu nghiep truyen su"},
    {5,4,4,"Pho thong danh su"},
    {7,5,5,"Nhat dai danh su"},
    {10,6,6,"Nhat dai ton su"},
    {13,7,7,"Thien co danh su"},
    {17,8,8,"Khoang the luong su"},
    {21,9,9,"Mon do tam thien"},
    {26,10,10,"Danh do tam thien"},
    }
    for i=1,getn(SU) do
    if SU[i][1] == GetName() then
    xuat = SU[i][4]
    if xuat <= 1 then
    return muc_luc[1][4]
    elseif xuat == 2 then
    return muc_luc[2][4]
    elseif xuat == 3 then
    return muc_luc[3][4]
    elseif xuat > 3 and xuat <= 5 then
    return muc_luc[4][4]
    elseif xuat > 5 and xuat <=7 then
    return muc_luc[5][4]
    elseif xuat > 7 and xuat <=10 then
    return muc_luc[6][4]
    elseif xuat > 10 and xuat <=13 then
    return muc_luc[7][4]
    elseif xuat > 13 and xuat <=17 then
    return muc_luc[8][4]
    elseif xuat > 17 and xuat <=21 then
    return muc_luc[9][4]
    elseif xuat > 21 and xuat <=26 then
    return muc_luc[10][4]
    else
    return muc_luc[10][4]
    end
    end
    end

    end

    function timsu()
    for i=1,getn(DO) do
    for k=1,getn(DO[i]) do
    if DO[i][k] == GetName() then
    return DO[i][1]
    end
    end
    end
    end

    function bo_dt()
    List_do_de2={}
    List_do_de={}
    so_dt=0
    id_su=0
    for i=1,getn(DO) do
    if DO[i][1] == GetName() then
    so_dt=getn(DO[i])
    id_su=i
    break
    end
    end

    if so_dt==2 then
    Say("return
    end

    for k=2,so_dt do
    List_do_de[getn(List_do_de)+1]=DO[id_su][k].."/select_one"
    List_do_de2[getn(List_do_de2)+1]=DO[id_su][k]
    end
    List_do_de2[getn(List_do_de2)+1]="Thoat./OnEx"
    Say("<color=green>Tien Su<color>: Nguoi muon truc xuat de tu nao ?",getn(List_do_de),List_do_de)
    end

    function select_one(nSel)
    Msg2Player(nSel)
    num = nSel+1
    do_de_bi_truc_xuat = List_do_de2[num]
    Msg2Player(do_de_bi_truc_xuat)
    for i=1,getn(DO) do
    for k=1,getn(DO[i]) do
    if DO[i][k] == do_de_bi_truc_xuat then
    DO[i][k] = nil
    end
    end
    end
    bien = TaoBang(DO,"DO")
    LuuBang("script/sudo_sn/dsdo.lua",bien)
    Msg2Player("Truc xuat thanh cong de tu "..do_de_bi_truc_xuat)
    AddGlobalCountNews("Su phu "..GetName().."truc xuat de tu "..do_de_bi_truc_xuat,1)
    for i=1,getn(SU) do
    if SU[i][1]==GetName() then
    SU[i][2]=SU[i][2]-1
    end
    end
    bien = TaoBang(SU,"SU")
    LuuBang("script/sudo_sn/dssu.lua",bien)
    List_do_de2={}
    List_do_de={}
    end
    function helps()
    Talk(3,"","He Thong Su Do Chi Moi Cap Nhat Chuc Nang Thu Nhan De Tu",
    "Khi nhan Su Phu nguoi se duoc nhieu uu dai",
    "Chuc ban thanh cong trong cong tac Su Do")
    end;


    function leave_sd()
    if GetLevel() >= 80 then
    Say("To So: Hien tai nguoi da du level de xuat su...?",2,"Xuat Su/dong_y","Thoat./OnEx")
    else
    Talk(1,"","Dang cap non kem khong dua vao su phu thi nguoi lam duoc gi co chu")
    end
    end
    function dong_y()
    if GetLevel() >= 80 then --ok
    Talk(1,"","<color="..colorS()..">To Su<color>: Bay gio nguoi da du dieu kien tu minh phieu bat giang ho khong can su phu chi day gi nua.")
    AddEventItem(daihongbao)
    AddEventItem(daihongbao)
    tensuphu = timsu()
    updateSD()
    for i = 1,getn(DO) do
    for k = 1,getn(DO[i]) do
    if DO[i][k] == GetName() then
    DO[i][k] = ""
    end
    end
    end
    bien = TaoBang(DO,"DO","")
    LuuBang("script/sudo_sn/dsdo.lua",bien)
    Msg2SubWorld(GetName().." da duoc su phu "..timsu().." nuoi day thanh tai tro thanh mot dai hiep.")
    elseif GetLevel() >= 100 then --ok
    Talk(1,"","<color="..colorS()..">To Su<color>: Bay gio nguoi da du dieu kien tu minh phieu bat giang ho khong can su phu chi day gi nua.")
    AddEventItem(daihongbao)
    AddEventItem(daihongbao)
    AddEventItem(daihongbao)
    AddEventItem(daihongbao)
    AddEventItem(daihongbao)
    tensuphu = timsu()
    updateSD()
    for i = 1,getn(DO) do
    for k = 1,getn(DO[i]) do
    if DO[i][k] == GetName() then
    DO[i][k] = ""
    end
    end
    end
    bien = TaoBang(DO,"DO","")
    LuuBang("script/sudo_sn/dsdo.lua",bien)
    Msg2SubWorld(GetName().." da duoc su phu "..timsu().." nuoi day thanh tai tro thanh mot dai hiep.")
    end
    end;

    function leave2_sd()
    Talk(1,"","<color="..colorS()..">Tien Su<color>: Nguoi da phan lai Su Phu cua minh!.")
    tensuphu = timsu()
    updateSD()
    for i = 1,getn(DO) do
    for k = 1,getn(DO[i]) do
    if DO[i][k] == GetName() then
    DO[i][k] = ""
    end
    end
    end
    bien = TaoBang(DO,"DO","")
    LuuBang("script/sudo_sn/dsdo.lua",bien)
    end;
    function updateSD()
    for i = 1,getn(SU) do
    if tensuphu == timsu() then
    SU[i][3] = SU[i][3] + 1
    bien = TaoBang(SU,"SU")
    LuuBang("script/sudo_sn/dssu.lua",bien)
    end
    end
    end;
    [/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]