LoginPlayer

From GT-MP
Jump to: navigation, search
LoginPlayer
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

Logs a player into ACL.

Dialog-warning.png Using ACL is currently not recommended because of certain issues.

Syntax

API.loginPlayer(Client player, string password);

Required Arguments

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

Return values

  • 0: No Account Found
  • 1: Login Successful (No Password)
  • 2: Wrong Password
  • 3: Login Successful
  • 4: Already Logged In
  • 5: ACL Disabled

Usage example(s)

[Command(ACLRequired = true, SensitiveInfo = true)]
public void AdminLogin(Client client, string password)
{
    string reason;
    int result = API.loginPlayer(client, password);
    switch (result)
    {
        case 0:
            reason = "~r~ERROR: No account found.";
            break;
        case 1:
        case 3:
            reason = "~g~SUCCESS: You have successfully logged in.";
            break;
        case 2:
            reason = "~r~ERROR: Wrong password.";
            break;
        case 4:
            reason = "~r~ERROR: You're already logged in.";
            break;
        case 5:
            reason = "~r~ERROR: ACL is disabled.";
            break;
        default:
            reason = "~r~ERROR: Unknown error occurred.";
            break;
    }
    API.sendChatMessageToPlayer(client, reason);
}

References