(Difference between revisions)
Return to current revision
-
Gets called when a client attempts to connect to the server.
[h="2"] Declaration [/h]
-
-
<code cpp>
VAULTSCRIPT bool OnClientAuthenticate(std::string, std::string);
-
+
[highlight=cpp]
VAULTSCRIPT VAULTSPACE State OnClientAuthenticate(VAULTSPACE cRawString, VAULTSPACE cRawString) _CPP(noexcept);
[/highlight]
[highlight=c]
-
forward OnClientAuthenticate(const name{}, const pwd{});
-
-
</code>
-
+
[/highlight]
-
[h="2"] Parameters [/h]
[image]Authenticate.png|right|thumb|This is what gets passed to the callback[/image]
-
-
[b]name[/b] - the name of the client (guaranteed to be at least 3 and at maximum [wiki]MAX_PLAYER_NAME[/wiki] characters long)
[b]pwd[/b] - the password of the client (guaranteed to be at maximum [wiki]MAX_PASSWORD_SIZE[/wiki] characters long)
-
+
[b][wiki]cRawString[/wiki][/b] - the name of the client (guaranteed to be at least 3 and at maximum [wiki]MAX_PLAYER_NAME[/wiki] characters long)
[b][wiki]cRawString[/wiki][/b] - the password of the client (guaranteed to be at maximum [wiki]MAX_PASSWORD_SIZE[/wiki] characters long)
-
[h="2"] Return value [/h]
-
-
When returned a non-zero value, the client is allowed to connect and play on this server. When returned zero, the client gets kicked (authentication denied).
[h="2"] Usage example (C++) [/h]
<code cpp>
bool VAULTSCRIPT OnClientAuthenticate(std::string name, std::string pwd)
-
+
If returned [wiki]True[/wiki], the client is allowed to connect and play on this server. If returned [wiki]False[/wiki], the client gets kicked (authentication denied).
[h="2"] Usage examples[/h]
[highlight=cpp]
State VAULTSCRIPT OnClientAuthenticate(cRawString name, cRawString pwd)
-
{
-
-
return true; // Everybody is allowed to connect
-
+
return True; // Everybody is allowed to connect
-
}
-
-
</code>
-
+
[/highlight]
[highlight=c]
public OnClientAuthenticate(const name {}, const pwd {})
{
return true; // Everybody is allowed to connect
}
[/highlight]
-
[category]VaultMP interface[/category]
[category]Scripting callbacks[/category]