[JX] có ai biết lỗi này giúp mình mới
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 5 của 5
  1. #1
    Vi phạm quy định
    Ngày tham gia
    May 2016
    Bài viết
    58
    Thanks
    15
    Thanked 5 Times in 5 Posts

    có ai biết lỗi này giúp mình mới

    nhập code vào nó báo như trong hình
    [Only registered and activated users can see links. ]

    giftcodedata.lua
    Include("\\script\\giftcode\\code.lua")
    Include("\\script\\global\\vn\\head_vip.lua")
    Include("\\script\\global\\hamapi.lua")
    Include("\\script\\task\\task_addplayerexp.lua")
    Include("\\script\\dailogsys\\dailogsay.lua")
    Include("\\script\\lib\\awardtemplet.lua");
    IncludeLib("SETTING")
    IncludeLib("ITEM")

    T_GiftEXP = 998
    T_GiftCode = 999

    function main()
    dofile("script/giftcode/giftcodedata.lua")
    dofile("script/giftcode/code.lua")
    DoiThoai()
    end

    function DoiThoai()

    local nTransLife = ST_GetTransLifeCount()
    if (nTransLife > 0) then
    Say("Nh©n vËt ®· trïng sinh kh«ng thÓ nhËn th­ëng",0)
    return
    end


    if GetLevel() < 80 then
    Say("Nh©n vËt ®¹t cÊp 80 míi cã thÓ nhËp GiftCode.",0)
    return
    end


    local EMPTY = 30
    if (CalcFreeItemCellCount() < EMPTY) then
    Msg2Player(""..XungHo().." h·y thu dän hµnh trang "..EMPTY.." « trèng!")
    return
    end

    local szTitle = "<npc>"..GetPlayerSex().." t×m ta cã viÖc g×?"
    local tbOpt =
    {
    {"NhËp GiftCode",InputCheckCode},
    {"Tho¸t"},
    }
    CreateNewSayEx(szTitle, tbOpt)
    end

    function InputCheckCode()
    if GetCurCamp() == 0 then
    Msg2Player("Gia nhËp m«n ph¸i míi cã thÓ nhËp ®­îc code")
    return
    end

    if GetTask(T_GiftEXP) >= 1500 then
    Msg2Player("Ng­¬i ®· nhËn th­ëng råi kh«ng thÓ nhËn tiÕp ®­îc n÷a")
    return
    end

    AskClientForString("NhapCode","",1,50,"Xin mêi nhËn GiftCode")

    function NhapCode(str) --như ảnh nó báo dòng này nhưng dòng này lỗi j vậy các bác
    local CheckCode = 0
    for i=1,1500 do
    if ListCode[i][1] == str then
    if ListCode[i][2] == 0 then
    Msg2Player("<color=green>Chóc mõng!B¹n ®· nhËp thµnh c«ng m· Code!")
    local Tab = {
    {szName="Kim M· LÔ Bao", tbProp={6,1,4089}, nCount = 7, nExpiredTime = 1440, nBindState = -2},
    --{szName="§¹i B¹ch CÇu Hoµn", tbProp={6,1,1766}, nCount = 2, nExpiredTime = 1440, nBindState = -2},
    {szName="§¹i Thµnh BÝ KÝp CÊp 90", tbProp={6,1,2424}, nCount = 1, nExpiredTime = 1440, nBindState = -2},
    {szName="BÝ KÝp 120", tbProp={6,1,1125}, nCount = 1, nExpiredTime = 1440, nBindState = -2},
    {szName="ChiÕn M· cÊp 80", tbProp={0,10,5,random(6,10),0,0}, nCount = 1, nExpiredTime = 1440*7, nBindState = -2},
    }
    for i = 1,getn(Tab) do
    tbAwardTemplet:GiveAwardByList(Tab[i], "PhÇn th­ëng t©n thñ");
    end

    AddGiftVip()
    local LEVEL = 190
    if (GetLevel() < LEVEL) then
    local nCurLevel = GetLevel()
    local nAddLevel = LEVEL - nCurLevel
    ST_LevelUp(nAddLevel)
    end
    SetTask(T_GiftEXP,1501)
    UpdateData(i)
    return
    else
    CheckCode = 1
    end
    end
    end
    if CheckCode == 1 then
    Msg2Player("<color=yellow>M· Code nµy ®· ®­îc sö dông , vui lßng chän m· code kh¸c!")
    else
    Msg2Player("<color=metal>M· Code b¹n nhËp kh«ng hîp lÖ vui lßng liªn hÖ GM ®Ó ®­îc ph¸t code.")
    end
    end
    end

    function InputCheckCodeVip()
    if GetCurCamp() == 0 then
    Msg2Player("Gia nhËp m«n ph¸i míi cã thÓ nhËp ®­îc code")
    return
    end

    if GetTask(T_GiftCode) >= 1500 then
    Msg2Player("Ng­¬i ®· nhËn th­ëng råi kh«ng thÓ nhËn tiÕp ®­îc n÷a")
    return
    end

    AskClientForString("NhapCodeVip","",1,50,"Xin mêi nhËn GiftCode")

    function NhapCodeVip(str)
    local CheckCode = 0
    for i=501,getn(ListCode) do
    if ListCode[i][1] == str then
    if ListCode[i][2] == 0 then
    Msg2Player("<color=green>Chóc mõng!B¹n ®· nhËp thµnh c«ng m· Code!")
    local nTransLife = ST_GetTransLifeCount()
    if (nTransLife > 0) then
    SetTask(T_GiftCode,1501)
    AddItemS1()
    local nItemIdx = AddItem(0,10,18,1,0,0)
    ITEM_SetExpiredTime(nItemIdx,3000)
    SyncItem(nItemIdx)
    SetItemBindState(nItemIdx,-2)
    else
    local levelVip = GetTask(T_LEVEL_VIP)
    if (levelVip > 0) then
    SetTask(T_GiftCode,1501)
    AddGiftVip()
    else
    Say("§èi víi nh©n sü ch­a trïng sinh ph¶i quy ®æi Ýt nhÊt 20xu vµo game kÓ tõ ngµy 14/8 míi cã thÓ nhËn th­ëng",0)
    return
    end
    end
    UpdateData(i)
    return
    else
    CheckCode = 1
    end
    end
    end
    if CheckCode == 1 then
    Msg2Player("<color=yellow>M· Code nµy ®· ®­îc sö dông , vui lßng chän m· code kh¸c!")
    else
    Msg2Player("<color=metal>M· Code b¹n nhËp kh«ng hîp lÖ vui lßng liªn hÖ GM ®Ó ®­îc ph¸t code.")
    end
    end
    end

    function UpdateData(iViTri)
    local sTmp = {}
    ClearData("script/giftcode/code.lua","")
    SaveData("script/giftcode/code.lua","ListCode =\n{")
    for i=1,getn(ListCode) do
    if i == iViTri then
    ListCode[i][2] = 1
    SaveData("script/giftcode/code.lua","\n\t["..i.."]={")
    SaveData("script/giftcode/code.lua","'"..ListCode[i][1].."',")
    SaveData("script/giftcode/code.lua",ListCode[i][2].."},")
    else
    SaveData("script/giftcode/code.lua","\n\t["..i.."]={")
    SaveData("script/giftcode/code.lua","'"..ListCode[i][1].."',")
    SaveData("script/giftcode/code.lua",ListCode[i][2].."},")
    end
    end
    SaveData("script/giftcode/code.lua","\n}")
    return sTmp
    end

    function AddGift()
    local nMP = GetLastFactionNumber()
    if (nMP == 0) then --ThiÕu L©m
    for i=1,2 do
    local ran = random(1,15)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 1) then --TVB
    for i=1,2 do
    local ran = random(16,30)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 2) then -- §M
    for i=1,2 do
    local ran = random(71,90)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 3) then -- 5 §éc
    for i=1,2 do
    local ran = random(56,70)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 4) then --Nga Mi
    for i=1,2 do
    local ran = random(31,46)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 5) then --Thóy Yªn
    for i=1,2 do
    local ran = random(46,55)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 6) then --C¸i Bang
    for i=1,2 do
    local ran = random(91,100)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 7) then --Thiªn NhÉn
    for i=1,2 do
    local ran = random(101,115)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 8) then --Vâ §ang
    for i=1,2 do
    local ran = random(116,125)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 9) then --C«n L«n
    for i=1,2 do
    local ran = random(126,140)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 10) then --Hoa S¬n
    for i=1,2 do
    local ran = random(4643,4652)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    end
    end

    function AddGiftVip()
    local nMP = GetLastFactionNumber()
    if (nMP == 0) then --ThiÕu L©m
    local tab_Content = {
    "ThiÕu L©m QuyÒn/#SelectCode(1)",
    "ThiÕu L©m Bæng/#SelectCode(2)",
    "ThiÕu L©m §ao/#SelectCode(3)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 1) then --TVB
    local tab_Content = {
    "Thiªn V­¬ng Chïy/#SelectCode(4)",
    "Thiªn V­¬ng Th­¬ng/#SelectCode(5)",
    "Thiªn V­¬ng §ao/#SelectCode(6)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 2) then -- §M
    local tab_Content = {
    "§­êng M«n phi ®ao/#SelectCode(15)",
    "§­êng M«n tô tiÔn/#SelectCode(16)",
    "§­êng M«n phi tiªu/#SelectCode(17)",
    "§­êng M«n bÉy/#SelectCode(18)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 3) then -- 5 §éc
    local tab_Content = {
    "Ngò §éc Ch­ëng/#SelectCode(12)",
    "Ngò §éc §ao/#SelectCode(13)",
    "Ngò §éc Bïa/#SelectCode(14)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 4) then --Nga Mi
    local tab_Content = {
    "Nga My KiÕm/#SelectCode(7)",
    "Nga My Ch­ëng/#SelectCode(8)",
    "Nga My Buff/#SelectCode(9)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 5) then --Thóy Yªn
    local tab_Content = {
    "Thóy Yªn §ao/#SelectCode(10)",
    "Thóy Yªn Song §ao/#SelectCode(11)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 6) then --C¸i Bang
    local tab_Content = {
    "C¸i Bang rång/#SelectCode(19)",
    "C¸i Bang bæng/#SelectCode(20)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 7) then --Thiªn NhÉn
    local tab_Content = {
    "Thiªn NhÉn kÝch/#SelectCode(21)",
    "Thiªn NhÉn ®ao/#SelectCode(23)",
    "Thiªn NhÉn bïa/#SelectCode(22)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 8) then --Vâ §ang
    local tab_Content = {
    "Vâ §ang khÝ/#SelectCode(24)",
    "Vâ §ang kiÕm/#SelectCode(25)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 9) then --C«n L«n
    local tab_Content = {
    "C«n L«n ®ao/#SelectCode(26)",
    "C«n L«n kiÕm/#SelectCode(27)",
    "C«n L«n bïa/#SelectCode(28)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 10) then --Hoa S¬n
    for i=1,2 do
    local ran = random(4643,4652)
    local nItemIdx = AddGoldItem(0,ran)
    ITEM_SetExpiredTime(nItemIdx,1440*7)
    SyncItem(nItemIdx)
    SetItemBindState(nItemIdx,-2)
    end
    end
    end

    function SelectCode(nId)
    for i=1,2 do
    local mp = GetLastFactionNumber()
    --local ran = random(nId*5+1-5,nId*5)
    local ran = (nId*5+i-5)
    AddGoldItemLimit(ran,1440*7)
    end
    end

    function AddItemS1(sel)
    local tab_Content = {
    "[H¹n chÕ]ThiÕu L©m QuyÒn/#SelectS1(1)",
    "[H¹n chÕ]ThiÕu L©m Bæng/#SelectS1(2)",
    "[H¹n chÕ]ThiÕu L©m §ao/#SelectS1(3)",
    "[H¹n chÕ]Thiªn V­¬ng §ao/#SelectS1(4)",
    "[H¹n chÕ]§­êng M«n Ná/#SelectS1(5)",
    "[H¹n chÕ]Ngò §éc §ao/#SelectS1(6)",
    "[H¹n chÕ]Nga My KiÕm/#SelectS1(7)",
    "[H¹n chÕ]Nga My Ch­ëng/#SelectS1(8)",
    "[H¹n chÕ]Thóy Yªn §ao/#SelectS1(9)",
    "[H¹n chÕ]Thóy Yªn Song §ao/#SelectS1(10)",
    "[H¹n chÕ]C¸i Bang Rång/#SelectS1(11)",
    "[H¹n chÕ]Thiªn NhÉn KÝch/#SelectS1(12)",
    "[H¹n chÕ]Thiªn NhÉn §ao/#SelectS1(13)",
    "[H¹n chÕ]Vâ §ang KhÝ/#SelectS1(14)",
    "[H¹n chÕ]Vâ §ang KiÕm/#SelectS1(15)",
    "[H¹n chÕ]C«n L«n §ao/#SelectS1(16)",
    "[H¹n chÕ]C«n L«n KiÕm/#SelectS1(17)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    end

    function SelectS1(sel)
    local n = sel + 1
    local tab_GoldItem = {769,771,776,793,843,829,796,801,811,816,855,868,8 76,881,888,891,898}
    local ItemIndex = AddGoldItem(0,tab_GoldItem[n])
    ITEM_SetExpiredTime(ItemIndex, 1440 * 2)
    SyncItem(ItemIndex)
    SetItemBindState(ItemIndex,-2)
    end


    code.lua
    ListCode =
    {
    [1]={'BACNAMSUMVAY009',1},
    [2]={'BACNAMSUMVAY010',1},
    [3]={'BACNAMSUMVAY011',1},
    [4]={'BACNAMSUMVAY012',1},
    [5]={'BACNAMSUMVAY013',1},
    [6]={'BACNAMSUMVAY014',1},
    [7]={'BACNAMSUMVAY015',1},
    [8]={'BACNAMSUMVAY016',1},
    }
    Lần sửa cuối bởi cokiemhoalong, ngày 26-05-16 lúc 09:37 PM.
    Khách viếng thăm hãy cùng cokiemhoalong xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  2. #2
    Thành Viên
    Ngày tham gia
    Mar 2010
    Bài viết
    430
    Thanks
    30
    Thanked 182 Times in 81 Posts

    Ðề: có ai biết lỗi này giúp mình mới

    Thiếu 1 chữ end của function InPutCheckCode() thêm vào là fix được liền bug.
    Khách viếng thăm hãy cùng hoivegame xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  3. Các thành viên gởi lời cảm ơn đến hoivegame vì bài viết này !

    cokiemhoalong (27-05-16)

  4. #3
    Thành Viên
    Ngày tham gia
    Jan 2007
    Bài viết
    224
    Thanks
    52
    Thanked 21 Times in 16 Posts

    Ðề: có ai biết lỗi này giúp mình mới

    Trích dẫn Gửi bởi cokiemhoalong [Only registered and activated users can see links. ]
    nhập code vào nó báo như trong hình
    [Only registered and activated users can see links. ]

    giftcodedata.lua
    Include("\\script\\giftcode\\code.lua")
    Include("\\script\\global\\vn\\head_vip.lua")
    Include("\\script\\global\\hamapi.lua")
    Include("\\script\\task\\task_addplayerexp.lua")
    Include("\\script\\dailogsys\\dailogsay.lua")
    Include("\\script\\lib\\awardtemplet.lua");
    IncludeLib("SETTING")
    IncludeLib("ITEM")

    T_GiftEXP = 998
    T_GiftCode = 999

    function main()
    dofile("script/giftcode/giftcodedata.lua")
    dofile("script/giftcode/code.lua")
    DoiThoai()
    end

    function DoiThoai()

    local nTransLife = ST_GetTransLifeCount()
    if (nTransLife > 0) then
    Say("Nh©n vËt ®· trïng sinh kh«ng thÓ nhËn th­ëng",0)
    return
    end


    if GetLevel() < 80 then
    Say("Nh©n vËt ®¹t cÊp 80 míi cã thÓ nhËp GiftCode.",0)
    return
    end


    local EMPTY = 30
    if (CalcFreeItemCellCount() < EMPTY) then
    Msg2Player(""..XungHo().." h·y thu dän hµnh trang "..EMPTY.." « trèng!")
    return
    end

    local szTitle = "<npc>"..GetPlayerSex().." t×m ta cã viÖc g×?"
    local tbOpt =
    {
    {"NhËp GiftCode",InputCheckCode},
    {"Tho¸t"},
    }
    CreateNewSayEx(szTitle, tbOpt)
    end

    function InputCheckCode()
    if GetCurCamp() == 0 then
    Msg2Player("Gia nhËp m«n ph¸i míi cã thÓ nhËp ®­îc code")
    return
    end

    if GetTask(T_GiftEXP) >= 1500 then
    Msg2Player("Ng­¬i ®· nhËn th­ëng råi kh«ng thÓ nhËn tiÕp ®­îc n÷a")
    return
    end

    AskClientForString("NhapCode","",1,50,"Xin mêi nhËn GiftCode")

    function NhapCode(str) --như ảnh nó báo dòng này nhưng dòng này lỗi j vậy các bác
    local CheckCode = 0
    for i=1,1500 do
    if ListCode[i][1] == str then
    if ListCode[i][2] == 0 then
    Msg2Player("<color=green>Chóc mõng!B¹n ®· nhËp thµnh c«ng m· Code!")
    local Tab = {
    {szName="Kim M· LÔ Bao", tbProp={6,1,4089}, nCount = 7, nExpiredTime = 1440, nBindState = -2},
    --{szName="§¹i B¹ch CÇu Hoµn", tbProp={6,1,1766}, nCount = 2, nExpiredTime = 1440, nBindState = -2},
    {szName="§¹i Thµnh BÝ KÝp CÊp 90", tbProp={6,1,2424}, nCount = 1, nExpiredTime = 1440, nBindState = -2},
    {szName="BÝ KÝp 120", tbProp={6,1,1125}, nCount = 1, nExpiredTime = 1440, nBindState = -2},
    {szName="ChiÕn M· cÊp 80", tbProp={0,10,5,random(6,10),0,0}, nCount = 1, nExpiredTime = 1440*7, nBindState = -2},
    }
    for i = 1,getn(Tab) do
    tbAwardTemplet:GiveAwardByList(Tab[i], "PhÇn th­ëng t©n thñ");
    end

    AddGiftVip()
    local LEVEL = 190
    if (GetLevel() < LEVEL) then
    local nCurLevel = GetLevel()
    local nAddLevel = LEVEL - nCurLevel
    ST_LevelUp(nAddLevel)
    end
    SetTask(T_GiftEXP,1501)
    UpdateData(i)
    return
    else
    CheckCode = 1
    end
    end
    end
    if CheckCode == 1 then
    Msg2Player("<color=yellow>M· Code nµy ®· ®­îc sö dông , vui lßng chän m· code kh¸c!")
    else
    Msg2Player("<color=metal>M· Code b¹n nhËp kh«ng hîp lÖ vui lßng liªn hÖ GM ®Ó ®­îc ph¸t code.")
    end
    end
    end

    function InputCheckCodeVip()
    if GetCurCamp() == 0 then
    Msg2Player("Gia nhËp m«n ph¸i míi cã thÓ nhËp ®­îc code")
    return
    end

    if GetTask(T_GiftCode) >= 1500 then
    Msg2Player("Ng­¬i ®· nhËn th­ëng råi kh«ng thÓ nhËn tiÕp ®­îc n÷a")
    return
    end

    AskClientForString("NhapCodeVip","",1,50,"Xin mêi nhËn GiftCode")

    function NhapCodeVip(str)
    local CheckCode = 0
    for i=501,getn(ListCode) do
    if ListCode[i][1] == str then
    if ListCode[i][2] == 0 then
    Msg2Player("<color=green>Chóc mõng!B¹n ®· nhËp thµnh c«ng m· Code!")
    local nTransLife = ST_GetTransLifeCount()
    if (nTransLife > 0) then
    SetTask(T_GiftCode,1501)
    AddItemS1()
    local nItemIdx = AddItem(0,10,18,1,0,0)
    ITEM_SetExpiredTime(nItemIdx,3000)
    SyncItem(nItemIdx)
    SetItemBindState(nItemIdx,-2)
    else
    local levelVip = GetTask(T_LEVEL_VIP)
    if (levelVip > 0) then
    SetTask(T_GiftCode,1501)
    AddGiftVip()
    else
    Say("§èi víi nh©n sü ch­a trïng sinh ph¶i quy ®æi Ýt nhÊt 20xu vµo game kÓ tõ ngµy 14/8 míi cã thÓ nhËn th­ëng",0)
    return
    end
    end
    UpdateData(i)
    return
    else
    CheckCode = 1
    end
    end
    end
    if CheckCode == 1 then
    Msg2Player("<color=yellow>M· Code nµy ®· ®­îc sö dông , vui lßng chän m· code kh¸c!")
    else
    Msg2Player("<color=metal>M· Code b¹n nhËp kh«ng hîp lÖ vui lßng liªn hÖ GM ®Ó ®­îc ph¸t code.")
    end
    end
    end

    function UpdateData(iViTri)
    local sTmp = {}
    ClearData("script/giftcode/code.lua","")
    SaveData("script/giftcode/code.lua","ListCode =\n{")
    for i=1,getn(ListCode) do
    if i == iViTri then
    ListCode[i][2] = 1
    SaveData("script/giftcode/code.lua","\n\t["..i.."]={")
    SaveData("script/giftcode/code.lua","'"..ListCode[i][1].."',")
    SaveData("script/giftcode/code.lua",ListCode[i][2].."},")
    else
    SaveData("script/giftcode/code.lua","\n\t["..i.."]={")
    SaveData("script/giftcode/code.lua","'"..ListCode[i][1].."',")
    SaveData("script/giftcode/code.lua",ListCode[i][2].."},")
    end
    end
    SaveData("script/giftcode/code.lua","\n}")
    return sTmp
    end

    function AddGift()
    local nMP = GetLastFactionNumber()
    if (nMP == 0) then --ThiÕu L©m
    for i=1,2 do
    local ran = random(1,15)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 1) then --TVB
    for i=1,2 do
    local ran = random(16,30)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 2) then -- §M
    for i=1,2 do
    local ran = random(71,90)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 3) then -- 5 §éc
    for i=1,2 do
    local ran = random(56,70)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 4) then --Nga Mi
    for i=1,2 do
    local ran = random(31,46)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 5) then --Thóy Yªn
    for i=1,2 do
    local ran = random(46,55)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 6) then --C¸i Bang
    for i=1,2 do
    local ran = random(91,100)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 7) then --Thiªn NhÉn
    for i=1,2 do
    local ran = random(101,115)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 8) then --Vâ §ang
    for i=1,2 do
    local ran = random(116,125)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 9) then --C«n L«n
    for i=1,2 do
    local ran = random(126,140)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 10) then --Hoa S¬n
    for i=1,2 do
    local ran = random(4643,4652)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    end
    end

    function AddGiftVip()
    local nMP = GetLastFactionNumber()
    if (nMP == 0) then --ThiÕu L©m
    local tab_Content = {
    "ThiÕu L©m QuyÒn/#SelectCode(1)",
    "ThiÕu L©m Bæng/#SelectCode(2)",
    "ThiÕu L©m §ao/#SelectCode(3)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 1) then --TVB
    local tab_Content = {
    "Thiªn V­¬ng Chïy/#SelectCode(4)",
    "Thiªn V­¬ng Th­¬ng/#SelectCode(5)",
    "Thiªn V­¬ng §ao/#SelectCode(6)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 2) then -- §M
    local tab_Content = {
    "§­êng M«n phi ®ao/#SelectCode(15)",
    "§­êng M«n tô tiÔn/#SelectCode(16)",
    "§­êng M«n phi tiªu/#SelectCode(17)",
    "§­êng M«n bÉy/#SelectCode(18)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 3) then -- 5 §éc
    local tab_Content = {
    "Ngò §éc Ch­ëng/#SelectCode(12)",
    "Ngò §éc §ao/#SelectCode(13)",
    "Ngò §éc Bïa/#SelectCode(14)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 4) then --Nga Mi
    local tab_Content = {
    "Nga My KiÕm/#SelectCode(7)",
    "Nga My Ch­ëng/#SelectCode(8)",
    "Nga My Buff/#SelectCode(9)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 5) then --Thóy Yªn
    local tab_Content = {
    "Thóy Yªn §ao/#SelectCode(10)",
    "Thóy Yªn Song §ao/#SelectCode(11)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 6) then --C¸i Bang
    local tab_Content = {
    "C¸i Bang rång/#SelectCode(19)",
    "C¸i Bang bæng/#SelectCode(20)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 7) then --Thiªn NhÉn
    local tab_Content = {
    "Thiªn NhÉn kÝch/#SelectCode(21)",
    "Thiªn NhÉn ®ao/#SelectCode(23)",
    "Thiªn NhÉn bïa/#SelectCode(22)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 8) then --Vâ §ang
    local tab_Content = {
    "Vâ §ang khÝ/#SelectCode(24)",
    "Vâ §ang kiÕm/#SelectCode(25)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 9) then --C«n L«n
    local tab_Content = {
    "C«n L«n ®ao/#SelectCode(26)",
    "C«n L«n kiÕm/#SelectCode(27)",
    "C«n L«n bïa/#SelectCode(28)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 10) then --Hoa S¬n
    for i=1,2 do
    local ran = random(4643,4652)
    local nItemIdx = AddGoldItem(0,ran)
    ITEM_SetExpiredTime(nItemIdx,1440*7)
    SyncItem(nItemIdx)
    SetItemBindState(nItemIdx,-2)
    end
    end
    end

    function SelectCode(nId)
    for i=1,2 do
    local mp = GetLastFactionNumber()
    --local ran = random(nId*5+1-5,nId*5)
    local ran = (nId*5+i-5)
    AddGoldItemLimit(ran,1440*7)
    end
    end

    function AddItemS1(sel)
    local tab_Content = {
    "[H¹n chÕ]ThiÕu L©m QuyÒn/#SelectS1(1)",
    "[H¹n chÕ]ThiÕu L©m Bæng/#SelectS1(2)",
    "[H¹n chÕ]ThiÕu L©m §ao/#SelectS1(3)",
    "[H¹n chÕ]Thiªn V­¬ng §ao/#SelectS1(4)",
    "[H¹n chÕ]§­êng M«n Ná/#SelectS1(5)",
    "[H¹n chÕ]Ngò §éc §ao/#SelectS1(6)",
    "[H¹n chÕ]Nga My KiÕm/#SelectS1(7)",
    "[H¹n chÕ]Nga My Ch­ëng/#SelectS1(8)",
    "[H¹n chÕ]Thóy Yªn §ao/#SelectS1(9)",
    "[H¹n chÕ]Thóy Yªn Song §ao/#SelectS1(10)",
    "[H¹n chÕ]C¸i Bang Rång/#SelectS1(11)",
    "[H¹n chÕ]Thiªn NhÉn KÝch/#SelectS1(12)",
    "[H¹n chÕ]Thiªn NhÉn §ao/#SelectS1(13)",
    "[H¹n chÕ]Vâ §ang KhÝ/#SelectS1(14)",
    "[H¹n chÕ]Vâ §ang KiÕm/#SelectS1(15)",
    "[H¹n chÕ]C«n L«n §ao/#SelectS1(16)",
    "[H¹n chÕ]C«n L«n KiÕm/#SelectS1(17)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    end

    function SelectS1(sel)
    local n = sel + 1
    local tab_GoldItem = {769,771,776,793,843,829,796,801,811,816,855,868,8 76,881,888,891,898}
    local ItemIndex = AddGoldItem(0,tab_GoldItem[n])
    ITEM_SetExpiredTime(ItemIndex, 1440 * 2)
    SyncItem(ItemIndex)
    SetItemBindState(ItemIndex,-2)
    end


    code.lua
    ListCode =
    {
    [1]={'BACNAMSUMVAY009',1},
    [2]={'BACNAMSUMVAY010',1},
    [3]={'BACNAMSUMVAY011',1},
    [4]={'BACNAMSUMVAY012',1},
    [5]={'BACNAMSUMVAY013',1},
    [6]={'BACNAMSUMVAY014',1},
    [7]={'BACNAMSUMVAY015',1},
    [8]={'BACNAMSUMVAY016',1},
    }
    Thiếu 1 cái end ở hàm bên trên thì phải !
    Khách viếng thăm hãy cùng huynhkim xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  5. The Following 2 Users Say Thank You to huynhkim For This Useful Post:

    cokiemhoalong (27-05-16), vuduymanh (27-05-16)

  6. #4
    Vi phạm quy định
    Ngày tham gia
    May 2016
    Bài viết
    58
    Thanks
    15
    Thanked 5 Times in 5 Posts

    Ðề: có ai biết lỗi này giúp mình mới

    ko được các bác à
    đoạn em bôi đỏ trong code bên dưới ai tét chỉ em mới
    làm theo như hướng dẫn trên nhưng ko dc

    Include("\\script\\giftcode\\code.lua")
    Include("\\script\\global\\vn\\head_vip.lua")
    Include("\\script\\global\\hamapi.lua")
    Include("\\script\\task\\task_addplayerexp.lua")
    Include("\\script\\dailogsys\\dailogsay.lua")
    Include("\\script\\lib\\awardtemplet.lua");
    IncludeLib("SETTING")
    IncludeLib("ITEM")

    T_GiftEXP = 998
    T_GiftCode = 999

    function main()
    dofile("script/giftcode/giftcodedata.lua")
    dofile("script/giftcode/code.lua")
    DoiThoai()
    end

    function DoiThoai()
    local nTransLife = ST_GetTransLifeCount()
    if (nTransLife > 0) then
    Say("Nh©n vËt ®· trïng sinh kh«ng thÓ nhËn th­ëng",0)
    return
    end

    if GetLevel() < 81 then
    Say("Nh©n vËt ®¹t cÊp 130 míi cã thÓ nhËp GiftCode.",0)
    return
    end

    local EMPTY = 30
    if (CalcFreeItemCellCount() < EMPTY) then
    Msg2Player(""..XungHo().." h·y thu dän hµnh trang "..EMPTY.." « trèng!")
    return
    end

    local szTitle = "<npc>"..GetPlayerSex().." t×m ta cã viÖc g×?"
    local tbOpt =
    {
    {"NhËp GiftCode",InputCheckCode},
    {"Tho¸t"},
    }
    CreateNewSayEx(szTitle, tbOpt)
    end

    function InputCheckCode()
    if GetCurCamp() == 0 then
    Msg2Player("Gia nhËp m«n ph¸i míi cã thÓ nhËp ®­îc code")
    return
    end

    if GetTask(T_GiftEXP) >= 1500 then
    Msg2Player("Ng­¬i ®· nhËn th­ëng råi kh«ng thÓ nhËn tiÕp ®­îc n÷a")
    return
    end

    AskClientForString("NhapCode","",1,50,"Xin mêi nhËn GiftCode")
    end

    function NhapCode(str)
    local CheckCode = 0
    for i=1,1500 do
    if ListCode[i][1] == str then -------đã làm theo và lại bị dòng này có bác nào tét code này chỉ em mới
    if ListCode[i][2] == 0 then
    Msg2Player("<color=green>Chóc mõng!B¹n ®· nhËp thµnh c«ng m· Code!")
    local Tab = {
    {szName="Kim M· LÔ Bao", tbProp={6,1,4089}, nCount = 7, nExpiredTime = 1440, nBindState = -2},
    --{szName="§¹i B¹ch CÇu Hoµn", tbProp={6,1,1766}, nCount = 2, nExpiredTime = 1440, nBindState = -2},
    {szName="§¹i Thµnh BÝ KÝp CÊp 90", tbProp={6,1,2424}, nCount = 1, nExpiredTime = 1440, nBindState = -2},
    {szName="BÝ KÝp 120", tbProp={6,1,1125}, nCount = 1, nExpiredTime = 1440, nBindState = -2},
    {szName="ChiÕn M· cÊp 80", tbProp={0,10,5,random(6,10),0,0}, nCount = 1, nExpiredTime = 1440*7, nBindState = -2},
    }
    for i = 1,getn(Tab) do
    tbAwardTemplet:GiveAwardByList(Tab[i], "PhÇn th­ëng t©n thñ");
    end

    AddGiftVip()
    local LEVEL = 190
    if (GetLevel() < LEVEL) then
    local nCurLevel = GetLevel()
    local nAddLevel = LEVEL - nCurLevel
    ST_LevelUp(nAddLevel)
    end
    SetTask(T_GiftEXP,1501)
    UpdateData(i)
    return
    else
    CheckCode = 1
    end
    end
    end
    if CheckCode == 1 then
    Msg2Player("<color=yellow>M· Code nµy ®· ®­îc sö dông , vui lßng chän m· code kh¸c!")
    else
    Msg2Player("<color=metal>M· Code b¹n nhËp kh«ng hîp lÖ vui lßng liªn hÖ GM ®Ó ®­îc ph¸t code.")
    end
    end

    function InputCheckCodeVip()
    if GetCurCamp() == 0 then
    Msg2Player("Gia nhËp m«n ph¸i míi cã thÓ nhËp ®­îc code")
    return
    end

    if GetTask(T_GiftCode) >= 1500 then
    Msg2Player("Ng­¬i ®· nhËn th­ëng råi kh«ng thÓ nhËn tiÕp ®­îc n÷a")
    return
    end

    AskClientForString("NhapCodeVip","",1,50,"Xin mêi nhËn GiftCode")
    end
    function NhapCodeVip(str)
    local CheckCode = 0
    for i=501,getn(ListCode) do
    if ListCode[i][1] == str then
    if ListCode[i][2] == 0 then
    Msg2Player("<color=green>Chóc mõng!B¹n ®· nhËp thµnh c«ng m· Code!")
    local nTransLife = ST_GetTransLifeCount()
    if (nTransLife > 0) then
    SetTask(T_GiftCode,1501)
    AddItemS1()
    local nItemIdx = AddItem(0,10,18,1,0,0)
    ITEM_SetExpiredTime(nItemIdx,3000)
    SyncItem(nItemIdx)
    SetItemBindState(nItemIdx,-2)
    else
    local levelVip = GetTask(T_LEVEL_VIP)
    if (levelVip > 0) then
    SetTask(T_GiftCode,1501)
    AddGiftVip()
    else
    Say("§èi víi nh©n sü ch­a trïng sinh ph¶i quy ®æi Ýt nhÊt 20xu vµo game kÓ tõ ngµy 14/8 míi cã thÓ nhËn th­ëng",0)
    return
    end
    end
    UpdateData(i)
    return
    else
    CheckCode = 1
    end
    end
    end
    if CheckCode == 1 then
    Msg2Player("<color=yellow>M· Code nµy ®· ®­îc sö dông , vui lßng chän m· code kh¸c!")
    else
    Msg2Player("<color=metal>M· Code b¹n nhËp kh«ng hîp lÖ vui lßng liªn hÖ GM ®Ó ®­îc ph¸t code.")
    end
    end


    function UpdateData(iViTri)
    local sTmp = {}
    ClearData("script/giftcode/code.lua","")
    SaveData("script/giftcode/code.lua","ListCode =\n{")
    for i=1,getn(ListCode) do
    if i == iViTri then
    ListCode[i][2] = 1
    SaveData("script/giftcode/code.lua","\n\t["..i.."]={")
    SaveData("script/giftcode/code.lua","'"..ListCode[i][1].."',")
    SaveData("script/giftcode/code.lua",ListCode[i][2].."},")
    else
    SaveData("script/giftcode/code.lua","\n\t["..i.."]={")
    SaveData("script/giftcode/code.lua","'"..ListCode[i][1].."',")
    SaveData("script/giftcode/code.lua",ListCode[i][2].."},")
    end
    end
    SaveData("script/giftcode/code.lua","\n}")
    return sTmp
    end


    function AddGift()
    local nMP = GetLastFactionNumber()
    if (nMP == 0) then --ThiÕu L©m
    for i=1,2 do
    local ran = random(1,15)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 1) then --TVB
    for i=1,2 do
    local ran = random(16,30)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 2) then -- §M
    for i=1,2 do
    local ran = random(71,90)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 3) then -- 5 §éc
    for i=1,2 do
    local ran = random(56,70)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 4) then --Nga Mi
    for i=1,2 do
    local ran = random(31,46)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 5) then --Thóy Yªn
    for i=1,2 do
    local ran = random(46,55)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 6) then --C¸i Bang
    for i=1,2 do
    local ran = random(91,100)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 7) then --Thiªn NhÉn
    for i=1,2 do
    local ran = random(101,115)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 8) then --Vâ §ang
    for i=1,2 do
    local ran = random(116,125)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 9) then --C«n L«n
    for i=1,2 do
    local ran = random(126,140)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    elseif (nMP == 10) then --Hoa S¬n
    for i=1,2 do
    local ran = random(4643,4652)
    local nIndex = AddGoldItem(0,ran)
    SetItemBindState(nIndex,-2)
    end
    end
    end

    function AddGiftVip()
    local nMP = GetLastFactionNumber()
    if (nMP == 0) then --ThiÕu L©m
    local tab_Content = {
    "ThiÕu L©m QuyÒn/#SelectCode(1)",
    "ThiÕu L©m Bæng/#SelectCode(2)",
    "ThiÕu L©m §ao/#SelectCode(3)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 1) then --TVB
    local tab_Content = {
    "Thiªn V­¬ng Chïy/#SelectCode(4)",
    "Thiªn V­¬ng Th­¬ng/#SelectCode(5)",
    "Thiªn V­¬ng §ao/#SelectCode(6)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 2) then -- §M
    local tab_Content = {
    "§­êng M«n phi ®ao/#SelectCode(15)",
    "§­êng M«n tô tiÔn/#SelectCode(16)",
    "§­êng M«n phi tiªu/#SelectCode(17)",
    "§­êng M«n bÉy/#SelectCode(18)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 3) then -- 5 §éc
    local tab_Content = {
    "Ngò §éc Ch­ëng/#SelectCode(12)",
    "Ngò §éc §ao/#SelectCode(13)",
    "Ngò §éc Bïa/#SelectCode(14)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 4) then --Nga Mi
    local tab_Content = {
    "Nga My KiÕm/#SelectCode(7)",
    "Nga My Ch­ëng/#SelectCode(8)",
    "Nga My Buff/#SelectCode(9)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 5) then --Thóy Yªn
    local tab_Content = {
    "Thóy Yªn §ao/#SelectCode(10)",
    "Thóy Yªn Song §ao/#SelectCode(11)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 6) then --C¸i Bang
    local tab_Content = {
    "C¸i Bang rång/#SelectCode(19)",
    "C¸i Bang bæng/#SelectCode(20)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 7) then --Thiªn NhÉn
    local tab_Content = {
    "Thiªn NhÉn kÝch/#SelectCode(21)",
    "Thiªn NhÉn ®ao/#SelectCode(23)",
    "Thiªn NhÉn bïa/#SelectCode(22)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 8) then --Vâ §ang
    local tab_Content = {
    "Vâ §ang khÝ/#SelectCode(24)",
    "Vâ §ang kiÕm/#SelectCode(25)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 9) then --C«n L«n
    local tab_Content = {
    "C«n L«n ®ao/#SelectCode(26)",
    "C«n L«n kiÕm/#SelectCode(27)",
    "C«n L«n bïa/#SelectCode(28)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    elseif (nMP == 10) then --Hoa S¬n
    for i=1,2 do
    local ran = random(4643,4652)
    local nItemIdx = AddGoldItem(0,ran)
    ITEM_SetExpiredTime(nItemIdx,1440*7)
    SyncItem(nItemIdx)
    SetItemBindState(nItemIdx,-2)
    end
    end
    end

    function SelectCode(nId)
    for i=1,2 do
    local mp = GetLastFactionNumber()
    --local ran = random(nId*5+1-5,nId*5)
    local ran = (nId*5+i-5)
    AddGoldItemLimit(ran,1440*7)
    end
    end

    function AddItemS1(sel)
    local tab_Content = {
    "[H¹n chÕ]ThiÕu L©m QuyÒn/#SelectS1(1)",
    "[H¹n chÕ]ThiÕu L©m Bæng/#SelectS1(2)",
    "[H¹n chÕ]ThiÕu L©m §ao/#SelectS1(3)",
    "[H¹n chÕ]Thiªn V­¬ng §ao/#SelectS1(4)",
    "[H¹n chÕ]§­êng M«n Ná/#SelectS1(5)",
    "[H¹n chÕ]Ngò §éc §ao/#SelectS1(6)",
    "[H¹n chÕ]Nga My KiÕm/#SelectS1(7)",
    "[H¹n chÕ]Nga My Ch­ëng/#SelectS1(8)",
    "[H¹n chÕ]Thóy Yªn §ao/#SelectS1(9)",
    "[H¹n chÕ]Thóy Yªn Song §ao/#SelectS1(10)",
    "[H¹n chÕ]C¸i Bang Rång/#SelectS1(11)",
    "[H¹n chÕ]Thiªn NhÉn KÝch/#SelectS1(12)",
    "[H¹n chÕ]Thiªn NhÉn §ao/#SelectS1(13)",
    "[H¹n chÕ]Vâ §ang KhÝ/#SelectS1(14)",
    "[H¹n chÕ]Vâ §ang KiÕm/#SelectS1(15)",
    "[H¹n chÕ]C«n L«n §ao/#SelectS1(16)",
    "[H¹n chÕ]C«n L«n KiÕm/#SelectS1(17)",
    }
    Say("Xin chµo <color=yellow>"..GetName().."<color>, h·y chän trang bÞ mµ b¹n muèn",getn(tab_Content),tab_Content)
    end

    function SelectS1(sel)
    local n = sel + 1
    local tab_GoldItem = {769,771,776,793,843,829,796,801,811,816,855,868,8 76,881,888,891,898}
    local ItemIndex = AddGoldItem(0,tab_GoldItem[n])
    ITEM_SetExpiredTime(ItemIndex, 1440 * 2)
    SyncItem(ItemIndex)
    SetItemBindState(ItemIndex,-2)
    end
    Khách viếng thăm hãy cùng cokiemhoalong xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  7. #5
    Thành Viên
    Ngày tham gia
    Jan 2007
    Bài viết
    224
    Thanks
    52
    Thanked 21 Times in 16 Posts

    Ðề: có ai biết lỗi này giúp mình mới

    Cái mảng Listcode đó ở đâu vậy ? Mình xem qua file này thì chưa thấy có khai báo. Nhưng mà, những lỗi như này, mình nghĩ bạn nên học code thêm. Cái này nếu hiểu code thì mò 1 lúc là ra thôi, chứ chưa biết j thì khó sửa lắm Nhiều khi thiếu dấu , thôi cũng là lỗi
    Khách viếng thăm hãy cùng huynhkim xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  8. Các thành viên gởi lời cảm ơn đến huynhkim vì bài viết này !

    cokiemhoalong (28-05-16)

 

 

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à 06:11 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ệ.