Hello guys!
I'm actually coding for our private server a script who load a submenu for changing the running mission. It will give the possibility to all players to choose a mission registered on a table, and load it.
Exemple of the submenu's :
local Mmenu= missionCommands.addSubMenu("LOAD MISSION MENU")
local subMn1= missionCommands.addCommand("RESTART MISSION", Mmenu, Restart, {MissNumb = 0})
local subTRG1 = missionCommands.addSubMenu("TRAININGS PACK 1", Mmenu)
local subTRG11= missionCommands.addSubMenu("NEVADA", subTRG1)
local subTRG111= missionCommands.addCommand("GOOD WEATHER", subTRG11, LoadMiss, {MissNumb = 1})
local subTRG112= missionCommands.addCommand("MID WEATHER", subTRG11, LoadMiss, {MissNumb = 2})
local subTRG113= missionCommands.addCommand("BAD WEATHER", subTRG11, LoadMiss, {MissNumb = 3})
However, i'm unable to run the command net.load_mission(my_mission.miz). The function run properly (all the debug text appears except the last) but the net.load_mission() doesn't execute.
the load function :
local function LoadMiss(val)
trigger.action.outText("**Launching LoadFunc...**",5 ,0) --debug text
Missval = val.MissNumb
trigger.action.outText("**Missval = "..tostring(Missval).."**",5 ,0) --debug text
trigger.action.outText("**Changing mission... **"..tostring(MissTBL[Missval]).."**",5 ,0) --debug text
net.load_mission(lfs.writeDir() .. "Missions\\SERVEUR\\" .. ""..tostring(MissTBL[Missval]).."")
trigger.action.outText("**Load command sent...**",5 ,0) --debug text
end
Accord to the documentation found on wiki.hoggitworld.com, it seems that I have to use a hook to enable this function.
My level on lua coding is quite poor, so how can I do this hook? And what I have to write on this hook?
Thanks for your help!