Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server admin where are you??
#1
Lightbulb 
Is it possible to make a plugin to tell at clients if admins are on the server if they type !admins and the console answer : console: No admins on this server or Server admins Moder.gr are/is ( if one admin ) on this server. ( server admins must set with their xuids )
Reply

#2
Yes, it is possible

I think :S
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#3
Yes
Reply

#4
if anyone can fix it because i dont know how to programm C
Reply

#5
To fix what?
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#6
(08-18-2012, 17:23)G-Man Wrote: To fix what?
the plugin for me Smile
Reply

#7
Hello,

It uses the admins from permission plugin.

Installation:
- Extract the zip file attached.
- Put the .dll in the plugin folder.
- Add "!admins" to the command allowed in permission's plugin.

Source code:
CSHARP Code
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Addon;
  6.  
  7. namespace ShowAdmins
  8. {
  9. public class ShowAdmins: CPlugin
  10. {
  11. // List of admins xuids
  12. private ArrayList Admins_Xuids = new ArrayList();
  13.  
  14. // On Server load
  15. public override void OnServerLoad()
  16. {
  17. try
  18. {
  19. // Split the admins xuids from permission
  20. String[] Get_Admins = GetServerCFG("Permission", "Admin_xuids", "0").Split(',');
  21.  
  22. // Loop the admijns list
  23. foreach (String admin in Get_Admins)
  24. {
  25. // Add the admin to the list
  26. this.Admins_Xuids.Add(admin);
  27. }
  28.  
  29. // Indicate that the plugin is correctly loaded
  30. ServerPrint("Plugin ShowAdmins loaded!");
  31. }
  32. catch(Exception e)
  33. {
  34. // Wtf
  35. ServerPrint("Plugin ShowAdmins: OnServerLoad catched exception: " + e.Message);
  36. }
  37. }
  38.  
  39. // On Say
  40. public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  41. {
  42. try
  43. {
  44. // If the message starts with !admins
  45. if (Message.StartsWith("!admins"))
  46. {
  47. // Will store the string with the admins
  48. String admins = "";
  49.  
  50. // Get the list of players
  51. List<ServerClient> Clients = GetClients();
  52.  
  53. // If the list is not null
  54. if (Clients != null)
  55. {
  56. // Needed to know the first admin added
  57. Boolean first = true;
  58. int Admins_nbr = 0;
  59. // Loop the player list
  60. foreach (ServerClient player in Clients)
  61. {
  62. // If the player is an admin
  63. if (Admins_Xuids.Contains(player.XUID))
  64. {
  65. if (first)
  66. {
  67. // First admin to add
  68. admins += player.Name;
  69. first = false;
  70. }
  71. else
  72. {
  73. // Other admins
  74. admins += ", " + player.Name;
  75. }
  76. Admins_nbr++;
  77. }
  78. }
  79.  
  80. if (Admins_nbr == 0)
  81. {
  82. // No admins
  83. TellClient(Client.ClientNum, "No admins on this server", true);
  84. }
  85. else if (Admins_nbr == 1)
  86. {
  87. // Show 1 admin present
  88. TellClient(Client.ClientNum, "Server admins " + admins +" is on this server", true);
  89. }
  90. else
  91. {
  92. // Show that more than one admin present
  93. TellClient(Client.ClientNum, "Server admins " + admins +" are on this server", true);
  94. }
  95. }
  96. }
  97. }
  98. catch(Exception e)
  99. {
  100. // Wtf
  101. ServerPrint("Plugin ShowAdmins: OnSay catched exception: " + e.Message);
  102. }
  103. return ChatType.ChatContinue;
  104. }
  105. }
  106. }


Attached Files
.zip   ShowAdmins.zip (Size: 2.45 KB / Downloads: 113)
Reply

#8
Thanks a lot narkos Smile
Reply

#9
(08-19-2012, 11:29)narkos Wrote: Hello,

It uses the admins from permission plugin.

Installation:
- Extract the zip file attached.
- Put the .dll in the plugin folder.
- Add "!admins" to the command allowed in permission's plugin.

Source code:
CSHARP Code
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Addon;
  6.  
  7. namespace ShowAdmins
  8. {
  9. public class ShowAdmins: CPlugin
  10. {
  11. // List of admins xuids
  12. private ArrayList Admins_Xuids = new ArrayList();
  13.  
  14. // On Server load
  15. public override void OnServerLoad()
  16. {
  17. try
  18. {
  19. // Split the admins xuids from permission
  20. String[] Get_Admins = GetServerCFG("Permission", "Admin_xuids", "0").Split(',');
  21.  
  22. // Loop the admijns list
  23. foreach (String admin in Get_Admins)
  24. {
  25. // Add the admin to the list
  26. this.Admins_Xuids.Add(admin);
  27. }
  28.  
  29. // Indicate that the plugin is correctly loaded
  30. ServerPrint("Plugin ShowAdmins loaded!");
  31. }
  32. catch(Exception e)
  33. {
  34. // Wtf
  35. ServerPrint("Plugin ShowAdmins: OnServerLoad catched exception: " + e.Message);
  36. }
  37. }
  38.  
  39. // On Say
  40. public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  41. {
  42. try
  43. {
  44. // If the message starts with !admins
  45. if (Message.StartsWith("!admins"))
  46. {
  47. // Will store the string with the admins
  48. String admins = "";
  49.  
  50. // Get the list of players
  51. List<ServerClient> Clients = GetClients();
  52.  
  53. // If the list is not null
  54. if (Clients != null)
  55. {
  56. // Needed to know the first admin added
  57. Boolean first = true;
  58. int Admins_nbr = 0;
  59. // Loop the player list
  60. foreach (ServerClient player in Clients)
  61. {
  62. // If the player is an admin
  63. if (Admins_Xuids.Contains(player.XUID))
  64. {
  65. if (first)
  66. {
  67. // First admin to add
  68. admins += player.Name;
  69. first = false;
  70. }
  71. else
  72. {
  73. // Other admins
  74. admins += ", " + player.Name;
  75. }
  76. Admins_nbr++;
  77. }
  78. }
  79.  
  80. if (Admins_nbr == 0)
  81. {
  82. // No admins
  83. TellClient(Client.ClientNum, "No admins on this server", true);
  84. }
  85. else if (Admins_nbr == 1)
  86. {
  87. // Show 1 admin present
  88. TellClient(Client.ClientNum, "Server admins " + admins +" is on this server", true);
  89. }
  90. else
  91. {
  92. // Show that more than one admin present
  93. TellClient(Client.ClientNum, "Server admins " + admins +" are on this server", true);
  94. }
  95. }
  96. }
  97. }
  98. catch(Exception e)
  99. {
  100. // Wtf
  101. ServerPrint("Plugin ShowAdmins: OnSay catched exception: " + e.Message);
  102. }
  103. return ChatType.ChatContinue;
  104. }
  105. }
  106. }


I Think i might add this to god plugin ...
Reply

#10
this is my code it will show u all the admins and mods online and insted of the text showing in the chat messgae it will show u in the HUD message

the command is
Quote:!admins

sv_config.ini settings
PHP Code:
//You can add more user groups here
Usergroups=Admin,Moderator,User,Trainee_Moderator,Senior_Moderator







//Add all xuids here (Go ingame and use !getxuid)

Admin_xuids=

Moderator_xuids=

Trainee_Moderator_xuids=

Senior_Moderator_xuids=


//Add commands moderators can use here


Admin_commands=*ALL

Moderator_commands=       

Trainee_Moderator_commands=      

Senior_Moderator_commands
and the code is here

PHP Code:
using Addon;
using System;
using System.Collections;
using System.Collections.Generic;
namespace 
ShowAdmins
{
    public class 
ShowAdmins CPlugin
    
{
        private 
ArrayList Admin_Xuids = new ArrayList();
        private 
ArrayList Moderator_Xuids = new ArrayList();
        private 
ArrayList Senior_Moderator_Xuids = new ArrayList();
        private 
ArrayList Trainee_Moderator_Xuids = new ArrayList();
        public 
override void OnServerLoad()
        {
            try
            {
                
string[] array = base.GetServerCFG("Permission""Admin_xuids""0").Split(new char[]
                {
                    
','
                
});
                
string[] array2 base.GetServerCFG("Permission""Moderator_xuids""0").Split(new char[]
                {
                    
','
                
});
                
string[] array3 base.GetServerCFG("Permission""Senior_Moderator_xuids""0").Split(new char[]
                {
                    
','
                
});
                
string[] array4 base.GetServerCFG("Permission""Trainee_Moderator_xuids""0").Split(new char[]
                {
                    
','
                
});
                
string[] array5 = array;
                for (
int i 0array5.Lengthi++)
                {
                    
string value array5[i];
                    
this.Admin_Xuids.Add(value);
                }
                
string[] array6 array2;
                for (
int j 0array6.Lengthj++)
                {
                    
string value2 array6[j];
                    
this.Moderator_Xuids.Add(value2);
                }
                
string[] array7 array3;
                for (
int k 0array7.Lengthk++)
                {
                    
string value3 array7[k];
                    
this.Senior_Moderator_Xuids.Add(value3);
                }
                
string[] array8 array4;
                for (
int l 0array8.Lengthl++)
                {
                    
string value4 array8[l];
                    
this.Trainee_Moderator_Xuids.Add(value4);
                }
                
base.ServerPrint("Plugin ShowAdmins loaded!");
            }
            catch (
Exception ex)
            {
                
base.ServerPrint("Plugin ShowAdmins: OnServerLoad catched exception: " ex.Message);
            }
        }
        public 
override ChatType OnSay(string MessageServerClient Clientbool TeamChat)
        {
            try
            {
                
ChatType result;
                if (!
Message.StartsWith("!admins"))
                {
                    
ChatType chatType ChatType.ChatContinue;
                    
result chatType;
                    return 
result;
                }
                
Message.Split(new char[]
                {
                    
' '
                
});
                
string text "";
                List<
ServerClientclients base.GetClients();
                if (
clients != null)
                {
                    
bool flag true;
                    
int num 0;
                    foreach (
ServerClient current in clients)
                    {
                        if (
this.Admin_Xuids.Contains(current.XUID))
                        {
                            if (
flag)
                            {
                                
text += current.Name;
                                
flag false;
                            }
                            else
                            {
                                
text text ", " current.Name;
                            }
                            
num++;
                        }
                        if (
this.Moderator_Xuids.Contains(current.XUID))
                        {
                            if (
flag)
                            {
                                
text += current.Name;
                                
flag false;
                            }
                            else
                            {
                                
text text ", " current.Name;
                            }
                            
num++;
                        }
                        if (
this.Senior_Moderator_Xuids.Contains(current.XUID))
                        {
                            if (
flag)
                            {
                                
text += current.Name;
                                
flag false;
                            }
                            else
                            {
                                
text text ", " current.Name;
                            }
                            
num++;
                        }
                        if (
this.Trainee_Moderator_Xuids.Contains(current.XUID))
                        {
                            if (
flag)
                            {
                                
text += current.Name;
                                
flag false;
                            }
                            else
                            {
                                
text text ", " current.Name;
                            }
                            
num++;
                        }
                    }
                    if (
num == 0)
                    {
                        
base.iPrintLnBold("^2No Admins or Mods are ^1ONLINE^2 on this server"Client);
                    }
                    else
                    {
                        if (
num == 1)
                        {
                            
base.iPrintLnBold("^2Admin^1/^2Mod  ^1[" text " ]^2is on this server"Client);
                        }
                        else
                        {
                            
base.iPrintLnBold("^2Admins^1&^2 Mods^1[" text "]^2 are on this server"Client);
                        }
                    }
                }
                
result ChatType.ChatNone;
                return 
result;
            }
            catch (
Exception ex)
            {
                
base.ServerPrint("Plugin ShowAdmins: OnSay catched exception: " ex.Message);
            }
            return 
ChatType.ChatContinue;
        }
    }



Attached Files
.rar   ShowAdmins.rar (Size: 5.86 KB / Downloads: 27)
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] Windows 8.1 Fix for MW3 Server Addon master131 16 18,317 09-29-2014, 23:08
Last Post: SuperNovaAO
Brick [Release] MW3 Server Administration Addon iRoNinja 5 9,050 11-10-2013, 15:46
Last Post: Casper
Exclamation Help cmdlist, dvarlist server crash Nerus 17 12,004 11-09-2013, 23:54
Last Post: Nerus
  Our Level Fastfile is Different from the Server. CheeseToast 6 11,370 11-03-2013, 17:52
Last Post: CheeseToast
  Dedicated Server External (public) IP Nerus 3 5,922 11-02-2013, 14:16
Last Post: Casper
  MW3 Server Version superg1973 7 12,821 10-28-2013, 01:15
Last Post: kotyra972
  Help how to turn off map in dedicated server pero123 8 7,216 10-15-2013, 19:00
Last Post: Nekochan
  Issue with server addon and NAT dimitrifrom31 3 5,115 10-08-2013, 18:11
Last Post: iRoNinja
Question Help Admin menu koren30 4 5,142 10-07-2013, 20:17
Last Post: Yamato
  GETTING SERVER ONLINE raym 6 5,834 09-28-2013, 22:42
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.