Envrioment:
|
Server
|
|
Function:
|
onPlayerTryConnect
|
Added with: 2.5.0
|
|
Member Of:
|
hook
|
Syntax:
|
nothing hook.onPlayerTryConnect(string addr, string ucid, string name, number playerId )
|
Description:
|
Occurs when a player initially attempts to connect to the server. Can be used to force allow or deny access. Passed values are the users ip address, unique DCS identifier, their name, and the id that the player would have if they connected. Can be used to ban players from entering your server due to inappropriate name or past actions committed.
IMPORTANT: If any value is returned with this function then any other callback that uses it will be ignored. If no choice is to be made, then do NOT return any value.
|
|
Return Value:
|
nothing
|
Return Actions:
|
Value 1: boolean
Return true will force allow the player into the server
Return false rejects the player from entering the server
Value 2: String
Message for why the player is not allowed into the server.
|
|
Examples:
|
Checks the ucid of a user attempting to connect to see if that ucid is present in that table. If it is then it returns false thus preventing them from joining the server and displaying a message that they have been banned.
function myCall.onPlayerTryConnect(addr, name, ucid, id)
if someBannedList[ucid] then
return false, "Dude you have been banned")
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:
|
|