Перейти к содержанию

DoesPlayerHaveAccessToCommand

Материал из RAGE MP Wiki Archive
Версия от 20:41, 27 ноября 2019; imported>Xabi
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

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


<syntaxhighlight lang="csharp">bool NAPI.ACL.DoesPlayerHaveAccessToCommand(Client player, string cmd);</syntaxhighlight>

Parameters

  • player: parameter input should be in Client type
  • cmd: parameter input should be in string type


Example

<syntaxhighlight lang="csharp"> [Command("logout", ACLRequired = true)] public void LogoutCommand(Client sender) {

   if (!NAPI.ACL.DoesPlayerHaveAccessToCommand(sender, "logout")) 
   {
       sender.SendChatMessage("~r~You can't use that command.");
       return;
   }
 
   NAPI.ACL.LogoutPlayer(sender);
   sender.SendChatMessage("~g~You have been logged out.");

} </syntaxhighlight>