AnswerPlayerJoin
Lets a join in, or refuses it with a message.
The answer to OnPlayerJoinRequest when the mode did not answer at once: from a web request’s callback (GetDiscordMemberRoles,
HttpRequest) or a database’s. Within 15 seconds of the ask, or the join was refused already.
Syntax
Section titled “Syntax”AnswerPlayerJoin(ask, allowed [, message])| Parameter | Type | |
|---|---|---|
ask |
number | the question OnPlayerJoinRequest gave |
allowed |
boolean | true lets them in, false refuses |
message |
string | what a refused player reads, 300 characters at most; left out, a plain “The server refused the join.” (optional) |
Returns
Section titled “Returns”boolean - false when this question was answered already or it is too late
Example
Section titled “Example”function OnPlayerJoinRequest(ask, join) db:Query("SELECT 1 FROM whitelist WHERE uid = @uid", { uid = join.uid }, function(rows, err) if err then AnswerPlayerJoin(ask, false, "The whitelist could not be checked - try again in a minute.") else AnswerPlayerJoin(ask, rows[1] ~= nil, "You are not whitelisted on this server.") end end)endSee also
Section titled “See also”OnPlayerJoinRequest · GetDiscordMemberRoles · the Joins and Discord group of the index
