LoginPlayer: Difference between revisions
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Logs a player into ACL. | Logs a player into ACL. | ||
{{CSharpContainer| | |||
{{#tag:pre|LoginResult {{Template:CSharp_Serverside_namespace}}ACL.LoginPlayer(Client player, string password);}} | {{#tag:pre|LoginResult {{Template:CSharp_Serverside_namespace}}ACL.LoginPlayer(Client player, string password);}} | ||
{{Parameters}} | |||
*'''player:''' parameter input should be in '''Client''' type | *'''player:''' parameter input should be in '''Client''' type | ||
*'''password:''' parameter input should be in '''string''' type | *'''password:''' parameter input should be in '''string''' type | ||
{{Example}} | {{Example}} | ||
{{#tag:syntaxhighlight| | |||
[Command(ACLRequired = true, SensitiveInfo = true)] | [Command(ACLRequired = true, SensitiveInfo = true)] | ||
public void AdminLogin(Client client, string password) | public void AdminLogin(Client client, string password) | ||
{ | { | ||
string reason; | string reason; | ||
var result = | var result = {{Template:CSharp_Serverside_namespace}}ACL.LoginPlayer(client, password); | ||
switch (result) | switch (result) | ||
{ | { | ||
| Line 47: | Line 43: | ||
client.SendChatMessage(reason); | client.SendChatMessage(reason); | ||
} | } | ||
|lang=csharp}} | |||
}} | }} | ||
[[Category:Serverside API]] | [[Category:Serverside API]] | ||
Latest revision as of 18:16, 28 November 2019
Logs a player into ACL.
C# Syntax
LoginResult NAPI.ACL.LoginPlayer(Client player, string password);
Parameters
- player: parameter input should be in Client type
- password: parameter input should be in string type
Example
[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;
}
client.SendChatMessage(reason);
}