NAPI.ACL.DoesPlayerHaveAccessToCommand: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 2: Line 2:


==Syntax==
==Syntax==
<pre>bool NAPI.ACL.DoesPlayerHaveAccessToCommand(Client player, string command);</pre>
<pre>void NAPI.ACL.LogoutPlayer(Client player);</pre>


=== Required Arguments ===
=== Required Arguments ===
*'''player:''' parameter input should be in '''Client''' type
*'''player:''' parameter input should be in '''Client''' type
*'''command:''' parameter input should be in '''string''' type


==Example==
==Example==
Line 12: Line 11:
{{Parameters}}
{{Parameters}}
*'''player:''' parameter input should be in '''Client''' type
*'''player:''' parameter input should be in '''Client''' type
*'''command:''' parameter input should be in '''string''' type


{{Example}}
{{Example}}
<syntaxhighlight lang="C#">
<syntaxhighlight lang="C#">
if (NAPI.ACL.DoesPlayerHaveAccessToCommand(player, "kick")) {
[Command("logout", ACLRequired = true)]
   // Do stuff...
public void LogoutCommand(Client sender)
{
    if (!NAPI.ACL.IsPlayerLoggedIn(sender))
    {
        sender.SendChatMessage("~r~You are not logged in.");
        return;
    }
    
    NAPI.ACL.LogoutPlayer(sender);
    sender.SendChatMessage("~g~You have been logged out.");
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 18:54, 25 November 2019

Checks whether a player has access to the given command based on the ACL.

Syntax

void NAPI.ACL.LogoutPlayer(Client player);

Required Arguments

  • player: parameter input should be in Client type

Example

C# Syntax

Parameters

  • player: parameter input should be in Client type

Example

[Command("logout", ACLRequired = true)]
public void LogoutCommand(Client sender)
{
    if (!NAPI.ACL.IsPlayerLoggedIn(sender)) 
    {
        sender.SendChatMessage("~r~You are not logged in.");
        return;
    }
  
    NAPI.ACL.LogoutPlayer(sender);
    sender.SendChatMessage("~g~You have been logged out.");
}