Description:
|
Adds the functions defined in the table to be run when the given event is called from the GameGUI environment. File is placed in Users\%YOURWINDOWSUSERNAME%\Saved Games\DCS\Scripts\Hooks folder. If this folder does not exist create it.
VERY IMPORTANT
Some callbacks can have a return value. If returned in your code then that value will take precedence over any other callback that might be checking the same thing. It is best to return nothing unless you want to force a given action to occur. For example the callback onPlayerTryChangeSlot is used by the DCS UI for the prompt that occurs when trying to join another player's multicrew aircraft. If true or false is returned the pilot will never get the prompt to allow or deny the seat.
List of Hooks: onMissionLoadBegin, onMissionLoadProgress, onMissionLoadEnd, onSimulationStart, onSimulationStop, onSimulationFrame, onSimulationPause, onSimulationResume, onGameEvent, onNetConnect, onNetMissionChanged, onNetConnect, onNetDisconnect, onPlayerConnect, onPlayerDisconnect, onPlayerStart, onPlayerStop, onPlayerChangeSlot, onPlayerTryConnect, onPlayerTrySendChat, onPlayerTryChangeSlot
|
Examples:
|
The following saves and modifies global values for the current mission name and a list of connected clients.
local myCall = {}
clients = {}
function myCall.onMissionLoadBegin()
current_mission = DCS.getMissionName()
end
function myCall.onPlayerConnect(id)
clients[id] = {id = id, addr = net.get_player_info(id, 'ipaddr'), name = net.get_player_info(id, 'name'), ucid = net.get_player_info(id, 'ucid'), ip = net.get_player_info(id, 'ipaddr')}
end
function myCall.onPlayerDisconnect(id)
clients[id] = nil
end
DCS.setUserCallbacks(myCall)
|