Thư viện mẩu dành cho team
Hello & Welcome to our community. Is this your first visit? Đăng Ký
Follow us on
Follow us on Facebook Follow us on Twitter Linked In Flickr Watch us on YouTube My Space Blogger
 
Kết quả 1 đến 2 của 2
  1. #1
    [S]-[A]-[N]-[G] sangpronhat's Avatar
    Ngày tham gia
    Apr 2008
    Đang ở
    HCM
    Bài viết
    546
    Thanks
    9
    Thanked 82 Times in 27 Posts

    Icon14 Thư viện mẩu dành cho team

    Code:
    ----------------------------------------------------------------------------------
    --have many function of team 
    ----------------------------------------------------------------------------------
    --Khi su dung Include("\\script\\lib\\team_lib.lua")
    
    -----------------------------------CAC HAM-----------------------------------
    -- 1 : MoveTeam(idteam,idmap,posx,posy)
    -- 2 : TeamInfo(idteam)
    -- 3 : ChoPhepTanCong(idteam,num)    [num={0,1}]
    -- 3 : SetDeathScriptTeam(idteam,scriptdir) 
    -- 4 : SetTaskTeam(idteam,taskid,num)
    -- 5 : GetTaskTeam(idteam,taskid)
    -- 6 : XemTaskTamThoi(idteam,taskid)
    -- 7 : SuaTaskTamThoi(idteam,taskid,num)
    -- 8 : XemPK(idteam)
    -- 9 : SuaPK(idteam)
    -- 10 : SetTimerTeam(idteam,timerid,thoigian)
    -- 11 : StopTimerTeam(idteam)
    -- 12 : SetTempRevPosTeam(idteam,idmap,posx,posy)
    -- 13 : SetRevPos(idteam,idmap,posx,posy)
    -- 14 : SayTeam(idteam,loithoai)
    -- 15 : CaptainTeam(idteam)
    -- 16 : AllMemberTeam(idteam)
    -- 17 : SetCurCampTeam(idteam,camp)
    --------------------------------------------------------------------------------------
    function MoveTeam(idteam,idmap,posx,posy)
    if SubWorldID2Idx(idmap) == -1 then
    Msg2Player("Ban do khong duoc mo trong qua trinh khoi dong !")
    return 
    end
        for i=1,GetPlayerCount() do
            PlayerIndex = i
            if GetTeam() == idteam then
                NewWorld(idmap,posx*8,posy*16)
            end
        end
    end
    function TeamInfo(idteam)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            teamsize = GetTeamSize()
            if IsCaptain() == 1 then
                totruong = GetName()
            end
        end
    end
    str = "Info To Doi [Ma so] : "..idteam..", [So Nguoi] : "..teamsize..", [Doi Truong] : "..totruong
    return str
    end
    function ChoPhepTanCong(idteam,num)
    if num == nil then return end
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetFightState(num)
        end
    end
    end
    function SetDeathScriptTeam(idteam,scriptdir) 
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetDeathScript(scriptdir)
        end
    end
    end
    function SetTaskTeam(idteam,taskid,num)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetTask(taskid,num)
        end
    end
    end
    function GetTaskTeam(idteam,taskid)
    local task = 0
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            if task == 0 then task = GetTask(taskid) end
            if task == GetTask(taskid) then
                task = GetTask(taskid)
            else
                return 0
            end
        end
    end
    return task
    end
    function XemTaskTamThoi(idteam,taskid)
    local task = 0
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            if task == 0 then task = GetTaskTemp(taskid) end
            if task == GetTaskTemp(taskid) then
                task = GetTaskTemp(taskid)
            else
                return 0
            end
        end
    end
    return task
    end
    function SuaTaskTamThoi(idteam,taskid,num)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetTaskTemp(taskid,num)
        end
    end
    end
    function XemPK(idteam)
    local pksum = 0
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            pksum = pksum+GetPK()
        end
    end
    return pksum
    end
    function SuaPK(idteam,num)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetPK(num)
        end
    end
    end
    function SetTimerTeam(idteam,timerid,thoigian)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetTimer(timerid,thoigian)
        end
    end
    end
    function StopTimerTeam(idteam)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            StopTimer()
        end
    end
    end
    function SetTempRevPosTeam(idteam,idmap,posx,posy)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetTempRevPos(idmap,posx*8,posy*16)
        end
    end
    end
    function SetRevPos(idteam,idmap,posx,posy)
    if posx == nil and posy == nil then return end
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetRevPos(idmap,posx*8,posy*16)
        end
    end
    end
    function SayTeam(idteam,loithoai)
    local loinoi,loithoailen = "","";
    local loidoithoai = "";
    loithoailen = getn(loithoai)
    if type(loithoai) == "table" then
    if loithoailen > 2 then
        for i=2,loithoailen - 1 do
            loinoi = loinoi..format("%q",loithoai[i])..","
        end
        loinoi = loinoi..format("%q",loithoai[loithoailen])
        loidoithoai = "Say("..format("%q",loithoai[1])..","..(loithoailen-1)..","..loinoi..")"
    elseif loithoailen == 2 then
        loidoithoai = "Say("..format("%q",loithoai[1])..",1,"..format("%q",loithoai[2])..")"
    elseif loithoailen < 2 then
        if loithoailen == 1 then
            loidoithoai = "Say("..format("%q",loithoai[1])..",0)"
        else
            return nil
        end
    end
    else print("Ham SayTeam khong chay duco do loi du lieu") return end
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            dostring(loidoithoai)
        end
    end
        return loidoithoai
    end
    function CaptainTeam(idteam)
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            if IsCaptain() == 1 then
                totruong = GetName()
            end
        end
    end
    return totruong
    end
    function AllMemberTeam(idteam)
    local name = ""
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            name=name..GetName()..","
        end
    end
    return name
    end
    function SetCurCampTeam(idteam,camp)
    if camp == nil then return end
    for i=1,GetPlayerCount() do
        PlayerIndex = i
        if GetTeam() == idteam then
            SetCurCamp(camp)
        end
    end
    end
    Chức năng
    đơn giản hóa các cấu trúc đụng đến team
    Viết các event hay mission có liên quan đến team
    Soure game mobile full Unity3d mới nhất cập nhật liên tục
    Có share 1 số source free cho anh em học tập
    Click ngay
    [Only registered and activated users can see links. ]

  2. #2
    Super Moderator thaihoa91's Avatar
    Ngày tham gia
    Apr 2008
    Bài viết
    12,110
    Thanks
    662
    Thanked 3,167 Times in 1,602 Posts

    Ðề: Thư viện mẩu dành cho team

    Dạo này Sangpronhat lại Dev Jx típ àh ^__^
    Khách viếng thăm hãy cùng thaihoa91 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •  
Múi giờ GMT +7. Bây giờ là 04:46 PM.
vBulletin®, Copyright ©2000-2011, Jelsoft Enterprises Ltd.
CLBGamesVN không chịu trách nhiệm về Luật Bản Quyền của các tài liệu, bài viết v.v...được đăng tải trên diễn đàn này.
Diễn đàn phát triển dưới sự đóng góp của tất cả thành viên. BQT chỉ là những người thành lập ra sân chơi, quản lý và duy trì về mặt kỹ thuật, nội dung khi hợp lệ.