Posts: 19
Threads: 2
Joined: Oct 2011
Reputation:
0
08-18-2012, 17:00
(This post was last modified: 08-18-2012, 17:02 by Moder.gr .)
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 )
Posts: 3,054
Threads: 268
Joined: Feb 2011
Reputation:
63
08-18-2012, 17:02
(This post was last modified: 08-18-2012, 17:02 by Arteq .)
Yes, it is possible
I think :S
Posts: 5,320
Threads: 300
Joined: Feb 2011
Reputation:
149
Posts: 19
Threads: 2
Joined: Oct 2011
Reputation:
0
if anyone can fix it because i dont know how to programm C
Posts: 3,054
Threads: 268
Joined: Feb 2011
Reputation:
63
Posts: 19
Threads: 2
Joined: Oct 2011
Reputation:
0
(08-18-2012, 17:23) G-Man Wrote: To fix what?the plugin for me
Posts: 165
Threads: 14
Joined: Jul 2011
Reputation:
8
08-19-2012, 11:29
(This post was last modified: 08-19-2012, 11:38 by narkos .)
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
using System ;
using System.Collections ;
using System.Collections.Generic ;
using System.Text ;
using Addon ;
namespace ShowAdmins
{
public class ShowAdmins: CPlugin
{
// List of admins xuids
private ArrayList Admins_Xuids
= new ArrayList
( ) ;
// On Server load
public override void OnServerLoad( )
{
try
{
// Split the admins xuids from permission
String [ ] Get_Admins = GetServerCFG( "Permission" , "Admin_xuids" , "0" ) .Split ( ',' ) ;
// Loop the admijns list
foreach ( String admin in Get_Admins)
{
// Add the admin to the list
this .Admins_Xuids .Add ( admin) ;
}
// Indicate that the plugin is correctly loaded
ServerPrint( "Plugin ShowAdmins loaded!" ) ;
}
catch ( Exception e)
{
// Wtf
ServerPrint( "Plugin ShowAdmins: OnServerLoad catched exception: " + e.Message ) ;
}
}
// On Say
public override ChatType OnSay( string Message, ServerClient Client, bool Teamchat)
{
try
{
// If the message starts with !admins
if ( Message.StartsWith ( "!admins" ) )
{
// Will store the string with the admins
String admins = "" ;
// Get the list of players
List< ServerClient> Clients = GetClients( ) ;
// If the list is not null
if ( Clients != null )
{
// Needed to know the first admin added
Boolean first = true;
int Admins_nbr = 0 ;
// Loop the player list
foreach ( ServerClient player in Clients)
{
// If the player is an admin
if ( Admins_Xuids.Contains ( player.XUID ) )
{
if ( first)
{
// First admin to add
admins += player.Name ;
first = false;
}
else
{
// Other admins
admins += ", " + player.Name ;
}
Admins_nbr++;
}
}
if ( Admins_nbr == 0 )
{
// No admins
TellClient( Client.ClientNum , "No admins on this server" , true ) ;
}
else if ( Admins_nbr == 1 )
{
// Show 1 admin present
TellClient( Client.ClientNum , "Server admins " + admins + " is on this server" , true ) ;
}
else
{
// Show that more than one admin present
TellClient( Client.ClientNum , "Server admins " + admins + " are on this server" , true ) ;
}
}
}
}
catch ( Exception e)
{
// Wtf
ServerPrint( "Plugin ShowAdmins: OnSay catched exception: " + e.Message ) ;
}
return ChatType.ChatContinue ;
}
}
}
Attached Files
ShowAdmins.zip (Size: 2.45 KB / Downloads: 113)
Posts: 19
Threads: 2
Joined: Oct 2011
Reputation:
0
Thanks a lot narkos
Posts: 338
Threads: 19
Joined: Jan 2012
Reputation:
32
(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
using System ;
using System.Collections ;
using System.Collections.Generic ;
using System.Text ;
using Addon ;
namespace ShowAdmins
{
public class ShowAdmins: CPlugin
{
// List of admins xuids
private ArrayList Admins_Xuids
= new ArrayList
( ) ;
// On Server load
public override void OnServerLoad( )
{
try
{
// Split the admins xuids from permission
String [ ] Get_Admins = GetServerCFG( "Permission" , "Admin_xuids" , "0" ) .Split ( ',' ) ;
// Loop the admijns list
foreach ( String admin in Get_Admins)
{
// Add the admin to the list
this .Admins_Xuids .Add ( admin) ;
}
// Indicate that the plugin is correctly loaded
ServerPrint( "Plugin ShowAdmins loaded!" ) ;
}
catch ( Exception e)
{
// Wtf
ServerPrint( "Plugin ShowAdmins: OnServerLoad catched exception: " + e.Message ) ;
}
}
// On Say
public override ChatType OnSay( string Message, ServerClient Client, bool Teamchat)
{
try
{
// If the message starts with !admins
if ( Message.StartsWith ( "!admins" ) )
{
// Will store the string with the admins
String admins = "" ;
// Get the list of players
List< ServerClient> Clients = GetClients( ) ;
// If the list is not null
if ( Clients != null )
{
// Needed to know the first admin added
Boolean first = true;
int Admins_nbr = 0 ;
// Loop the player list
foreach ( ServerClient player in Clients)
{
// If the player is an admin
if ( Admins_Xuids.Contains ( player.XUID ) )
{
if ( first)
{
// First admin to add
admins += player.Name ;
first = false;
}
else
{
// Other admins
admins += ", " + player.Name ;
}
Admins_nbr++;
}
}
if ( Admins_nbr == 0 )
{
// No admins
TellClient( Client.ClientNum , "No admins on this server" , true ) ;
}
else if ( Admins_nbr == 1 )
{
// Show 1 admin present
TellClient( Client.ClientNum , "Server admins " + admins + " is on this server" , true ) ;
}
else
{
// Show that more than one admin present
TellClient( Client.ClientNum , "Server admins " + admins + " are on this server" , true ) ;
}
}
}
}
catch ( Exception e)
{
// Wtf
ServerPrint( "Plugin ShowAdmins: OnSay catched exception: " + e.Message ) ;
}
return ChatType.ChatContinue ;
}
}
}
I Think i might add this to god plugin ...
Posts: 25
Threads: 3
Joined: Nov 2012
Reputation:
3
01-22-2013, 02:25
(This post was last modified: 01-22-2013, 02:47 by abidullah .)
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 = 0 ; i < array5 . Length ; i ++) { string value = array5 [ i ]; this . Admin_Xuids . Add ( value ); } string [] array6 = array2 ; for ( int j = 0 ; j < array6 . Length ; j ++) { string value2 = array6 [ j ]; this . Moderator_Xuids . Add ( value2 ); } string [] array7 = array3 ; for ( int k = 0 ; k < array7 . Length ; k ++) { string value3 = array7 [ k ]; this . Senior_Moderator_Xuids . Add ( value3 ); } string [] array8 = array4 ; for ( int l = 0 ; l < array8 . Length ; l ++) { 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 Message , ServerClient Client , bool TeamChat ) { try { ChatType result ; if (! Message . StartsWith ( "!admins" )) { ChatType chatType = ChatType . ChatContinue ; result = chatType ; return result ; } Message . Split (new char [] { ' ' }); string text = "" ; List< ServerClient > clients = 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
ShowAdmins.rar (Size: 5.86 KB / Downloads: 25)