DCS hook onPlayerTryChangeSlot
From DCS World Wiki - Hoggitworld.com
Envrioment: | Server | ||
Function: | onPlayerTryChangeSlot | Added with: 2.5.0 | |
Member Of: | hook | ||
Syntax: | nothing hook.onPlayerTryChangeSlot(number playerId, number side, string slotId ) | ||
Description: | Occurs when a player clicks on a new slot to try and enter a given aircraft. Can be used for slot blocking purposes within a mission or to force players access to one team or the other.
playerId is who is attempting to join a slot side is the coalition the aircraft belongs to slotId is an identifier for the slot the player is trying to join. The identifier is based on the unitID for a given aircraft. However with multicrew seats the slotId has an additional "_x" added to the unitId to specify which seat it is.
| ||
Return Value: | nothing | ||
Return Actions: | Value 1: boolean
True: Allows the user into the slot False prevents the user from entering the slot. | ||
Examples: | Checks a list of players indexed by UCID to see if they have a coalition value assigned to them. If they do and the side is not the same then it denies the request. Otherwise it creates the entry with the specified side and does not return the function as to allow any other callback that might check for onPlayerTryChangeSlot to do its code.
function myCall.onPlayerTryChangeSlot(playerId, side, slotId) local ucid = net.get_player_info(id, 'ucid') if someList[ucid] and someList[ucid].coa ~= side then return false else someList[ucid] = {coa = side} end end | ||
Related Functions: | List of Callbacks: onMissionLoadBegin, onMissionLoadProgress, onMissionLoadEnd, onSimulationStart, onSimulationStop, onSimulationFrame, onSimulationPause, onSimulationResume, onGameEvent, onNetConnect, onNetMissionChanged, onNetConnect, onNetDisconnect, onPlayerConnect, onPlayerDisconnect, onPlayerStart, onPlayerStop, onPlayerChangeSlot, onPlayerTryConnect, onPlayerTrySendChat, onPlayerTryChangeSlot | ||
Notes: |