發新話題
打印

求解決return bug

[Close]

求解決return bug

如何解決return bug(係我搵到既其中一個sl系統)
佢咁寫
function H2S takes handle h returns string    return I2S(H2I(h))endfunction


我del左佢又讀取唔到呢個

function Load takes player PL,string PassWord returns nothing
local integer NID = PlayerName_S2I(GetPlayerName(PL))   
// 以玩者名稱的編號做為運算的主要數值,方便榜定
local string St = SFilter(PassWord)
local string GarmeSt = GarmeChangePos(4,udg_SL_SystemString[100],NID,false)
local integer ID = GetPlayerId(PL)
local unit U = udg_SL_Hero_Unit[ID]
local boolean IsLocalPlayer = PL == GetLocalPlayer()
local integer A = 0
local integer B = 0
local integer C = 0
local string S
local item It

    if U != null then
        if IsLocalPlayer then
            call DisplayTimedTextToPlayer(PL,0,0,15,"已經選取角色!")
        endif
        return
    endif

    // 解密
    set udg_SL_SystemString[102] = GarmeSt
    call GarmeChangeNL_CreateSA()   
    // 建立玩者專屬轉換字串!
    set St = GarmeStart(St,NID,true)
    // 解密至原始資料    詳見 GarmeStart 與相關函數

    // 校驗
    set A = StringLength(St)
    set B = A-10
    if GarmeKey(SubString(St,0,B)) == SubString(St,B,A) then
        if IsLocalPlayer then
            call DisplayTimedTextToPlayer(PL,0,0,15,"|cff00ff00密碼正確!")
        endif
    else
        if IsLocalPlayer then
            call DisplayTimedTextToPlayer(PL,0,0,15,"|cffff0000密碼錯誤!")
        endif
        return
    endif

    // 讀取資料

    set B = 0
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[100]))
    set B = B+udg_SL_I[100]
    set U = CreateUnit(PL,udg_SL_Job_ID[A],0,0,0)
    // 職業
    call HeroStart(U,PL)
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[101]))
    // 等級
    set B = B+udg_SL_I[101]
    call SetHeroLevel(U,A,false)
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[102]))
    // 三圍
    set B = B+udg_SL_I[102]
    call SetHeroStr(U,A,false)
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[102]))
    // 三圍
    set B = B+udg_SL_I[102]
    call SetHeroAgi(U,A,false)
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[102]))
    // 三圍
    set B = B+udg_SL_I[102]
    call SetHeroInt(U,A,false)
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[103]))
    // 金錢
    set B = B+udg_SL_I[103]
    call SetPlayerState(PL,PLAYER_STATE_RESOURCE_GOLD,A)
    set A = S2I_2G(SubString(St,B,B+udg_SL_I[104]))
    // 木材
    set B = B+udg_SL_I[104]
    call SetPlayerState(PL,PLAYER_STATE_RESOURCE_LUMBER,A)

    // 創造物品並且榜定
    set S = H2S(U)
    loop
        exitwhen C > 5
        set A = S2I_2G(SubString(St,B,B+udg_SL_I[105]))
        set B = B+udg_SL_I[105]
        set It = UnitAddItemById(U,udg_SL_Item_ID[A])
        call StoreString(bj_lastCreatedGameCache,H2S(It),"IsLoad",S)   
        // 榜定
        set C = C+1
    endloop
endfunction


function Trig_LoadedItemCheck_Actions takes nothing returns nothing
local item It = GetManipulatedItem()
local unit U = GetTriggerUnit()
local player PL = GetTriggerPlayer()
local string S = GetStoredString(bj_lastCreatedGameCache,H2S(It),"IsLoad")
    if S == null or S == H2S(U) then
        return
    else
        call UnitDropItemPoint(U,It,GetUnitX(U),GetUnitY(U))
        if PL == GetLocalPlayer() then
            call DisplayTimedTextToPlayer(PL,0,0,15,"|cffff0000物品已綁定於其他角色!")
        endif
    endif
endfunction

TOP

呢個區果然夠靜

TOP

你試下用GetHandleId吧 z_z"

格式係 GetHandleId(handle)


難得我耐冇來we區 過來望望
http://www.tsdm.me/forum.php
天使動漫論壇 各種資源應有盡有 owo

TOP

引用:
原帖由 x00900 於 2015-1-30 16:52 發表
你試下用GetHandleId吧 z_z"

格式係 GetHandleId(handle)


難得我耐冇來we區 過來望望
要用係邊到

其實點用

[ 本帖最後由 古物.帝 於 2015-1-30 19:53 編輯 ]

TOP

你試下將H2S(xxx)果d 換晒
I2S(GetHandleId(xxx))

咁就應該得的了
http://www.tsdm.me/forum.php
天使動漫論壇 各種資源應有盡有 owo

TOP

發新話題