Jump to content

mirq

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by mirq

  1. Well, i guessed.
  2. OMG, Cfrag The solution is fckin trivial. All this <profanity> for nothing It is the fourth way I discover to send commands from mission to hooks. It is stupid simple. You can restart anytime from mission. Wanna know ? Are you here ?
  3. Ok, All good, net.dostringin works in mission, but "GUI" is reported to be "invalid state name". We should find the correct state name to access GUI. Conclusion : there are only 3 state names that are allowed in dogsting_in: misison, export and config. But server works too. if we run with "mission" or "server" then net. is reported as nil value. The net. from inside the string . there is no net. in mission's net. space. Clear ? there is Group or Unit in mission but no net. Pretty strange. if we using "GUI" or anything else, the state is reported as "invalid state name" anyway, it is cool that dostring works in mission, you may run code from mission functions like get units, groups etc
  4. As it was not strange enough, i tried the following command: bullsmth.dostring_in("mission", "net.send_chat('asdad', true)") It reports that bullsmth is nil value So net. is not nil in mission. that's cool
  5. I am testing now. 1 minute So, it doesnt raise any erro, but does nothing. Absolutely nothing. Like it even does not exist in code. I checked this one: net.dostring_in("GUI", "net.send_chat('asdad', true)") Maybe "GUI" is not good there, let me check with "server" and others
  6. You are saying that net.dostring_in() is working from mission env ? Doesn't it raise an error ? like net. is nil ? I am curious, never tried. I am trying now
  7. I understand, so you need to restart the mission when a certain flag is triggered in mission. In my case i only start it periodically., dont care about flags. For that, you need that dostring return a value form mission . Theoretically it returns a string. You are trying to cast that string to a number. From my experiments I couldnt figure it out what dostring returns. Better log the return value and see what it is. Then decide if that's a number or a text. Your code should work if dostring behaves. Oh, by the way, shouldnt you write net.dostring_in('mission', ... instead of net.dostring_in('server', ... ? flags are defined in mission, maybe 'server' is ok, but lot of things are happening on clients part and reported back to server. Dunno, just asking. P.S. I checked docs, and there is no option for 'server', how did that land in your code ? Why did put all functions in smr table ? Get them out of there. They are not callbacks. Leave only on/simulationFrame(), and make all others local or global fucntions and variables The following I dont understand at all: net.doString_in("GUI", str) with str being "mn = DCS.getMissionFilename( ); success = net.load_mission(mn); return success" net.dostring_in is a function that runs only in GUI already. in net. space more precisely. This can be write only in a hook file, not miision file. If you write it in a hook file than it makes no sense. load_mission can be run directly without dostring. so there is no place for dostring_in in any mission file. you want to restart the mission from mission logic, not GUI. Ok, then you need to send info from misison to HOOKS. dostring can't do that, excepting the case it returns a value when run from HOOKS, but you need to write "mission" there not "server". Other than that, I know a method to make run code in HOOKS, directly from misiion. Any time, anything. You can check the flag in misison and send information to HOOKS to a function that will restart the mission.
  8. The code for restart: local Timer = 0 local PERIOD = 36000 -- seconds local PERIOD_MIN = PERIOD -120 function restart.onSimulationFrame() Timer = DCS.getModelTime() if (Timer < PERIOD_MIN ) then return else if (Timer < PERIOD ) then return else Timer=0 net.load_next_mission() -- you need to set your sever for "loop" -ing missions, and then you dont botter with lfs. If you have only one mission -- or --net.load_mission(lfs.writeDir() .. 'Scripts\\Hooks\\Missions\\' .. 'mission_name.miz') end end end As regards separation between hooks and msision, this is so well made that even if you block the GUI by a wrong function call in hooks, lets say this results in an infinite loop and framerate in GUI drops to 0, still in mision env those who are spawned and are playing already, they wont feel the drop of framerate in GUI at all, until they move to specs or another slot. They will freeze then. So the framerate drop that occurs in net.onSiulationFrame is absolutely negligible, it doesnt even exist. You can write all the logic for restarting in that callback
  9. Restart itself is much simpler. I can even do a restart with all players slot preserved. I will send the code for restart. As regards preserved slots it is complicated and it involves much logic. You can do it if study the order in which callbacks work in hooks. But why the hack would you invoke do_string for restarting mission? Hooks can officialy load a mission or load next mission by net.load_mission(). You dont need mission env for that. I will send the code.
  10. I will send you the exact code that does that
  11. Do_string works for anything. There is a missconception that this is for flags only. Dont believe everything they say
  12. But why do you need to run code from mission still ? What is exactly your aim ? I bet it can be solved in GUI only, and you will forget about mission. For example you can spawn AI from GUI hooks, you can destroy AI, everyhing you can do in mission youcan do from GUI hooks. You can send triiger text from GUI, and many more. So there are two kind of approacehs: 1. Run code from HOOKS to mission -> that's possible oficially via a_do_script 2. Run code from mission to HOOKS -> that's imposible oficially, but there are workarounds. Several Which one are you up to, and for what purpose ?
  13. That will never happen. I did it, as you already know, but in an un-orthodox way. For laymen , that's impossible. And here is why: iff you mean a lua file from hooks, than I suppose this contains code from net. and DCS. space. These spaces are not accessible in mission env, so if you import those hook ffiles in a mission file, a lot of errors will occur, as net. and DCS. are nil things there.
  14. But wait a minute. You are running a server or a client ? I you are making a server than there no risk for you. The risk is on the clients who de-sanitize access to folders and missions from servers run mallicious code on clients. On server you are supposed to be clean. Though I just discovered that clients can run code also, it cant reach the server. Yet
  15. If you meaan by regular lua files from miision env, then cand do this net. call. In mission you can only find the playername, not the playerId. Id exists only in GUI. orget about ucid in mission. But you dont need them. You can play exclusively in GUI. You dont need anything fro mission yes there is I tried with this code. It seems it works. Looks like relative path is good enough. If you dont need acces to io or os libs then you can survive with this. The last resort is to make one single file. But if you need mist, your screwed MissIncludesDir ="/MissionIncludes/" dofile(MissIncludesDir .. 'mist_4_4_90.lua')
  16. Before you can do require you need to de-sanitize the MissionScripting.lua file from DCS game\Scripts folder. Like this: dofile('Scripts/ScriptingSystem.lua') --Sanitize Mission Scripting environment --This makes unavailable some unsecure functions. --Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions. --You can remove the code below and make availble these functions at your own risk. local function sanitizeModule(name) --_G[name] = nil --package.loaded[name] = nil end do --sanitizeModule('os') --sanitizeModule('io') --sanitizeModule('lfs') --_G['require'] = nil --_G['loadlib'] = nil --_G['package'] = nil end Then you can require anything in hooks or mission files, like this: local dcsSr=require('lfs') InccludeDir =dcsSr.writedir() .. "Scripts/Hooks/AnotherLuaFilesFolder/" dofile(InccludeDir .. 'a_file_from_that_folder.lua')
  17. Scenario is confirmed. Each time players refresh Multiplayer Servers List (MP), a query is sent to all servers listed there. On UDP.
  18. Thats a good explanation. I will check this scenario. Hopefuly its like that. Stilll , the main concern is about dcs vulnerability. I cant see in changelogs fixes of some problems. It is a blackbox. Some guys might exploit it.
  19. Good topic, but discussing only about Windows security it's a little off topic here. I would like to hear about DCS server vulnerabilities and exploits. leave alone Windows, there are plenty of resources about Windows on google to learn about. What about DCS server (stable and beta) vulnerabilities ? Does anybody know anything about it ? I observed players who stay connected for hours being spectators. Do they use an established connection to my server to run custom commands on server ? Also I noticed around 30 IP addresses that DCS sever are connected to via UDP. They might be CDN sources, but my server only transmits data, never receives anything from them.
  20. net.send_chat_to is the simplest way. and capture the event onPlayerConnect and onPlayerChangeSlot in net hooks. Unless there is something else you need to achieve , the solution to your problem is nothing special. It is there and easy.
  21. Ah no, you didnt get the point. It is something that only my server does. I want to promote it, not to share.
  22. Where can I find an actualized verison of net API documentation ?
  23. For the moment I want to finish my server and make it great again.
  24. Yeah, it took me 6 years to find the solution. I was bussy They can communicate without modifications. Just need to think out of the box.
×
×
  • Create New...