Jump to content

Bug - DCS.isServer() and DCS.isMultiplayer() not working


Recommended Posts

Posted

I couldn't find an appropriate place to put this where it would be visible, so I've put it here.

 

The DCS.isServer() and DCS.isMultiplayer() functions are not working correctly. If I host a multiplayer mission once, then exit from the mission, these functions still return true, even though the server has long since been stopped.

 

00071.033 INFO    LuaNET: KIHooks.onSimulationFrame running ...
00071.033 INFO    LuaNET: KIServer.IsRunning - TRUE - MP Server and Mission Name Match
00071.067 INFO    NET: server has stopped
00071.068 INFO    LuaNET: KIHooks.onSimulationFrame running ...
00071.068 INFO    LuaNET: KIServer.IsRunning - TRUE - MP Server and Mission Name Match
00071.136 INFO    LuaNET: KIHooks.onSimulationFrame running ...
00071.136 INFO    LuaNET: KIServer.IsRunning - TRUE - MP Server and Mission Name Match

 

the function KIServer.IsRunning looks like so:

 

KIServer.IsRunning = function()
 if not DCS.isServer() and not DCS.isMultiplayer() then
   net.log("KIServer.IsRunning - FALSE - Not MP Server")
   return false
 end
 
 local missionName = DCS.getMissionName()
 if string.match(DCS.getMissionName(), KIServer.Config.MissionName) then
   net.log("KIServer.IsRunning - TRUE - MP Server and Mission Name Match")
   return true
 end
 net.log("KIServer.IsRunning - FALSE - Not KI Mission")
 return false
end

 

I discovered this after updating to 1.5.7.11476 Update 5, as what was previously working suddenly stopped the moment I tried to start another mp server.

 

The workaround I found for the time being is to also check DCS.getModelTime() for 0 or nil which works, but I hope this does get fixed at some point as it can cause a lot of negative side effects for existing mods out there.

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...