魔兽地图服务器存档修改本地存档,【Jass】Preload存档系统,本地写入文件并读取...
該樓層疑似違規已被系統折疊?隱藏此樓查看此樓
把下面的所有Jass復制到這里即可,Name=“preload” 這個引號里面的名字可以改成你想要的存檔文件名
//[Jass]
library PreSystem initializer Pre_Init
globals
private string MapName = "preload" //存檔名
private integer Key
private string Str_temp
private hashtable HT
endglobals
function Pre_SaveInt takes integer key, integer value returns nothing
if value >= 0 then
call Preload("\" )
call SetPlayerTechMaxAllowed(Player(14),"+I2S(key)+",1)
call SetPlayerTechMaxAllowed(Player(15),"+I2S(key)+","+I2S(value)+")
//")
else
call Preload("\" )
call SetPlayerTechMaxAllowed(Player(14),"+I2S(key)+",2)
call SetPlayerTechMaxAllowed(Player(15),"+I2S(key)+","+I2S(-value)+")
//")
endif
endfunction
function Pre_SaveStr_Get takes nothing returns nothing
call SaveStr(HT, Key, GetPlayerTechMaxAllowed(Player(13),Key), GetPlayerName(Player(15)))
endfunction
function Pre_SaveStr takes integer key, string value returns nothing
call Preload("\" )
call SetPlayerName(Player(15),\""+value+"\")
call SetPlayerTechMaxAllowed(Player(13),"+I2S(Key)+","+I2S(key)+")
call ExecuteFunc(\"Pre_SaveStr_Get")
//")
endfunction
function Pre_SaveStart takes nothing returns nothing
call PreloadGenClear()
call PreloadGenStart()
endfunction
function Pre_SaveEnd takes nothing returns nothing
call PreloadGenEnd("save\\"+MapName+"\\Data.txt") //注意你讀取的路徑要和你存檔的路徑一致
endfunction
function Pre_LoadInt takes integer key returns integer
local integer var_type = GetPlayerTechMaxAllowed(Player(14), key)
if var_type == 1 then
return GetPlayerTechMaxAllowed(Player(15), key)
elseif var_type == 2 then
return -GetPlayerTechMaxAllowed(Player(15), key)
else
return 0
endif
endfunction
function Pre_LoadStr takes integer key returns string
return LoadStr(HT, Key, key)
endfunction
function Pre_LoadStart takes nothing returns nothing
set Str_temp = GetPlayerName(Player(15))
call Preloader("save\\"+MapName+"\\Data.txt") //這里可以填寫任意你想要寫存檔的路徑
endfunction
function Pre_LoadEnd takes nothing returns nothing
call SetPlayerName(Player(15),Str_temp)
call FlushChildHashtable(HT, Key)
endfunction
function Pre_LocalLoadJudge takes nothing returns boolean
call PreloadGenClear()
call PreloadGenStart()
call Pre_SaveInt(0, 1)
call PreloadGenEnd("save\\"+MapName+"\\Test.txt")
call Preloader("save\\"+MapName+"\\Test.txt")
return Pre_LoadInt(0) == 1
endfunction
function Pre_Init takes nothing returns nothing
set HT = InitHashtable()
set Key = StringHash(MapName)
if Key < 0 then
set Key = -Key
endif
endfunction
endlibrary
//[Jass]
總結
以上是生活随笔為你收集整理的魔兽地图服务器存档修改本地存档,【Jass】Preload存档系统,本地写入文件并读取...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阿里珍贵技术资料免费下载
- 下一篇: java信息管理系统总结_java实现科