This site has been archived and made available for preservation purposes. No edits can be made.

OnClientAuthenticate

(Difference between revisions)
Return to current revision
  1.  
    Gets called when a client attempts to connect to the server.
    [h="2"] Declaration [/h]
  2. -
    <code cpp>
    VAULTSCRIPT bool OnClientAuthenticate(std::string, std::string);
  3. +
    [highlight=cpp]
    VAULTSCRIPT vaultmp::State OnClientAuthenticate(vaultmp::String, vaultmp::String);
  4.  
    forward OnClientAuthenticate(const name{}, const pwd{});
  5. -
    </code>
  6. +
    [/highlight]
  7.  
    [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)
    [h="2"] Return value [/h]
  8. -
    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).
  9. +
    When returned [wiki]True[/wiki], the client is allowed to connect and play on this server. When returned [wiki]False[/wiki], the client gets kicked (authentication denied).
  10.  
    [h="2"] Usage example (C++) [/h]
  11. -
    <code cpp>
    bool VAULTSCRIPT OnClientAuthenticate(std::string name, std::string pwd)
  12. +
    [highlight=cpp]
    vaultmp::String VAULTSCRIPT OnClientAuthenticate(vaultmp::String name, vaultmp::String pwd)
  13.  
    {
  14. -
    return true; // Everybody is allowed to connect
  15. +
    return True; // Everybody is allowed to connect
  16.  
    }
  17. -
    </code>
  18. +
    [/highlight]
  19.  
    [category]VaultMP interface[/category]
    [category]Scripting callbacks[/category]