| Line | |
|---|
| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 |
|
|---|
| 4 | public class AdminToolsStuff
|
|---|
| 5 | {
|
|---|
| 6 | public static string[] GetAllowedCommandsList (AdminTools admTools, string _steamID)
|
|---|
| 7 | {
|
|---|
| 8 | AdminToolsClientInfo tmpInfo = admTools.GetClientCommandInfo (_steamID);
|
|---|
| 9 |
|
|---|
| 10 | List<AdminToolsCommandPermissions> perms = admTools.commandPermissions;
|
|---|
| 11 | List<string> allowed = new List<string> ();
|
|---|
| 12 |
|
|---|
| 13 | ConsoleSdtd console = ConnectionManager.Instance.gameManager.m_GUIConsole;
|
|---|
| 14 |
|
|---|
| 15 | foreach (AdminToolsCommandPermissions atcp in perms) {
|
|---|
| 16 | if (tmpInfo.SteamID != null && tmpInfo.SteamID.Length > 0) {
|
|---|
| 17 | if ((atcp.PermissionLevel >= tmpInfo.PermissionLevel) || (atcp.PermissionLevel >= 1000)) {
|
|---|
| 18 | addAllowed (console, allowed, atcp.Command);
|
|---|
| 19 | }
|
|---|
| 20 | } else {
|
|---|
| 21 | if (atcp.PermissionLevel >= 1000) {
|
|---|
| 22 | addAllowed (console, allowed, atcp.Command);
|
|---|
| 23 | }
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | return allowed.ToArray ();
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | private static void addAllowed (ConsoleSdtd console, List<string> list, string cmd)
|
|---|
| 31 | {
|
|---|
| 32 | ConsoleCommand cc = console.getCommand (cmd);
|
|---|
| 33 | if (cc != null) {
|
|---|
| 34 | foreach (string ccName in cc.Names()) {
|
|---|
| 35 | if (!list.Contains (ccName)) {
|
|---|
| 36 | list.Add (ccName);
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 | } else {
|
|---|
| 40 | list.Add (cmd);
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.