LoginPlayer

From GTA Network Wiki
Jump to: navigation, search

LoginPlayer
Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

Logs a player into ACL.

Syntax

LoginResult NAPI.ACL.LoginPlayer(Client player, string password);

Required Arguments

  • player: parameter input should be in Client type.
  • password: parameter input should be in string type.

Return type: LoginResult


LoginResult enum:

  • NoAccountFound
  • WrongPassword
  • LoginSuccessfulNoPassword
  • LoginSuccessful
  • AlreadyLoggedIn
  • ACLDisabled

Usage example(s)

[Command(ACLRequired = true, SensitiveInfo = true)]
public void AdminLogin(Client client, string password)
{
    string reason;
    var result = NAPI.ACL.LoginPlayer(client, password);
    switch (result)
    {
        case LoginResult.NoAccountFound:
            reason = "~r~ERROR: No account found.";
            break;

        case LoginResult.LoginSuccessfulNoPassword:
        case LoginResult.LoginSuccessful:
            reason = "~g~SUCCESS: You have successfully logged in.";
            break;

        case LoginResult.WrongPassword:
            reason = "~r~ERROR: Wrong password.";
            break;

        case LoginResult.AlreadyLoggedIn:
            reason = "~r~ERROR: You're already logged in.";
            break;

        case LoginResult.ACLDisabled:
            reason = "~r~ERROR: ACL is disabled.";
            break;
    }
    NAPI.Chat.SendChatMessageToPlayer(client, reason);
}

Changelog

Version Description
1.0 Release.

References