Raised This Month: $12 Target: $400
 3% 

Solved [CSGO] !admins online


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-03-2019 , 10:22   [CSGO] !admins online
Reply With Quote #1

Hello! I tried to edit a !admins plugins , but i failded again. What i need to do? I wanted to make my own list , like:

sm_admins
★ Founders: AdminName1 , AdminName2
★ Owners: AdminName1 , AdminName2
★ Mods: AdminName1 , AdminName2
★ Admins: AdminName1 , AdminName2
★ Helpers: AdminName1 , AdminName2

sm_vips
{color}VIPs: VipName1 , VipName2

Surse:
PHP Code:
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo 
{
    
name "[CSGO] List of Online Admins",
    
author "",
    
description "Reply to sm_admins command the name of online admin",
    
version "",
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_admins"Command_ShowAdminsOnline);
    
RegConsoleCmd("sm_vips"Command_ShowVipsOnline);
}

public 
Action Command_ShowAdminsOnline(int clientint args)
{
    for (
int index 1index MaxClientsindex++)
    {
        if(
IsClientInGame(index))
        {
            
AdminId ClientAccess GetUserAdmin(index);
            
            if(
ClientAccess)
            {
                
int AdminGroupsCount GetAdminGroupCount(ClientAccess);
                
                for (
int x 0AdminGroupsCountx++)
                {
                    
char GroupName[32];
                    
                    if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_ROOT)
                    {                        
                        
PrintToChat(client"\x01★\x02 Founders: \x01 %N"client );                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_UNBAN)
                    {
                        
PrintToChat(client"\x01★\x07 Owners: \x01 %N"client );                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_CUSTOM3)
                    {
                        
PrintToChat(client"\x01★\x04 Mods: \x01 %N"client );                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_BAN)
                    {
                        
PrintToChat(client"\x01★\x05 Admins: \x01 %N"client );                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_GENERIC)
                    {
                        
PrintToChat(client"\x01★\x06 Helpers: \x01 %N"client );                        
                    }
                }
            }
        }
    }
}
public 
Action Command_ShowVipsOnline(int clientint args)
{
    for (
int index 1index MaxClientsindex++)
    {
        if(
IsClientInGame(index))
        {
            
AdminId ClientAccess GetUserAdmin(index);
            
            if(
ClientAccess)
            {
                
int AdminGroupsCount GetAdminGroupCount(ClientAccess);
                
                for (
int x 0AdminGroupsCountx++)
                {
                    
char GroupName[32];
                    
                    if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_CUSTOM6)
                    {                        
                        
PrintToChat(client"\x01★\x10 VIPs: \x01 %N"client );                        
                    }
                }
            }
        }
    }

On servers looks like this:
★ Founders: PorcusorulMagic
★ Founders: PorcusorulMagic
★ Founders: PorcusorulMagic
★ VIPs: PorcusorulMagic
★ VIPs: PorcusorulMagic
★ VIPs: PorcusorulMagic
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908

Last edited by PorcusorulMagic; 04-09-2019 at 10:11. Reason: Solved
PorcusorulMagic is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 04-03-2019 , 10:29   Re: [CSGO] !admins online
Reply With Quote #2

PrintToChat(client, "\x01★\x02 Founders: \x01 %N", client );

%N is client name, when u set "client" as argument for %N,
Command_ShowAdminsOnline(int client, int args) - client is you, when you are typing this command.
Try
PrintToChat(client, "\x01★\x02 Founders: \x01 Admin name1");
supertimor is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-03-2019 , 10:40   Re: [CSGO] !admins online
Reply With Quote #3

Quote:
Originally Posted by supertimor View Post
PrintToChat(client, "\x01★\x02 Founders: \x01 %N", client );

%N is client name, when u set "client" as argument for %N,
Command_ShowAdminsOnline(int client, int args) - client is you, when you are typing this command.
Try
PrintToChat(client, "\x01★\x02 Founders: \x01 Admin name1");
Doesn't work. It looks like:
★ Founders:
★ Founders:
★ Founders:
★ Founders:
★ Vips:

But i want to see this list everytime , like if Admins is not online to looks like:
★ Founders: PorcusorulMagic , NAME
★ Owners: no owner online
★ Mods: no mods online
★ Admins: no mods online
★ Helpers: no helpers online

★ VIPs: no vips online

Errors:
PHP Code:
//// ListaStaff.sp
//
// ListaStaff.sp(42) : warning 213: tag mismatch
// ListaStaff.sp(46) : warning 213: tag mismatch
// ListaStaff.sp(50) : warning 213: tag mismatch
// ListaStaff.sp(54) : warning 213: tag mismatch
// ListaStaff.sp(58) : warning 213: tag mismatch
// ListaStaff.sp(83) : warning 213: tag mismatch
// Code size:             6756 bytes
// Data size:             2956 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   26096 bytes
//
// 6 Warnings. 
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908
PorcusorulMagic is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 04-03-2019 , 10:50   Re: [CSGO] !admins online
Reply With Quote #4

6 Warnings. ..
You did sth wrong. Gimme code pls
supertimor is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-03-2019 , 10:53   Re: [CSGO] !admins online
Reply With Quote #5

Quote:
Originally Posted by supertimor View Post
6 Warnings. ..
You did sth wrong. Gimme code pls
PHP Code:
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo 
{
    
name "[CSGO] List of Online Admins",
    
author "",
    
description "Reply to sm_admins command the name of online admin",
    
version "1.0",
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_admins"Command_ShowAdminsOnline);
    
RegConsoleCmd("sm_vips"Command_ShowVipsOnline);
}

public 
Action Command_ShowAdminsOnline(int clientint args)
{
    for (
int index 1index MaxClientsindex++)
    {
        if(
IsClientInGame(index))
        {
            
AdminId ClientAccess GetUserAdmin(index);
            
            if(
ClientAccess)
            {
                
int AdminGroupsCount GetAdminGroupCount(ClientAccess);
                
                for (
int x 0AdminGroupsCountx++)
                {
                    
char GroupName[32];
                    
                    if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_ROOT)
                    {                        
                        
PrintToChat(client"\x01★\x02 Founders: \x01");                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_UNBAN)
                    {
                        
PrintToChat(client"\x01★\x07 Owners: \x01");                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_CUSTOM3)
                    {
                        
PrintToChat(client"\x01★\x04 Mods: \x01");                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_BAN)
                    {
                        
PrintToChat(client"\x01★\x05 Admins: \x01");                        
                    }
                    else if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_GENERIC)
                    {
                        
PrintToChat(client"\x01★\x06 Helpers: \x01");                        
                    }
                }
            }
        }
    }
}
public 
Action Command_ShowVipsOnline(int clientint args)
{
    for (
int index 1index MaxClientsindex++)
    {
        if(
IsClientInGame(index))
        {
            
AdminId ClientAccess GetUserAdmin(index);
            
            if(
ClientAccess)
            {
                
int AdminGroupsCount GetAdminGroupCount(ClientAccess);
                
                for (
int x 0AdminGroupsCountx++)
                {
                    
char GroupName[32];
                    
                    if(
GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_CUSTOM6)
                    {                        
                        
PrintToChat(client"\x01★\x10 VIPs: \x01");                        
                    }
                }
            }
        }
    }

__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908
PorcusorulMagic is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 04-03-2019 , 12:39   Re: [CSGO] !admins online
Reply With Quote #6

https://sm.alliedmods.net/new-api/admin/GetAdminGroup

Returns group information from an admin.
A GroupId index and a name pointer, or INVALID_GROUP_ID and NULL if an error occurred.

PHP Code:
if(GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_ROOT
this is so wrong ...

PHP Code:

AdminId admin 
GetUserAdmin(index); 

if (
admin != INVALID_ADMIN_ID// has flags
{
       
char group[64];
       if (
admin.GetGroup(0groupsizeof(group)) != INVALID_GROUP_ID// get his first group
       
{
              
PrintToChat(client"%s : %N"groupindex);
       }

__________________
Ilusion9 is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-04-2019 , 03:10   Re: [CSGO] !admins online
Reply With Quote #7

Quote:
Originally Posted by Ilusion9 View Post
https://sm.alliedmods.net/new-api/admin/GetAdminGroup

Returns group information from an admin.
A GroupId index and a name pointer, or INVALID_GROUP_ID and NULL if an error occurred.

PHP Code:
if(GetAdminGroup(ClientAccessxGroupNamesizeof(GroupName)) != ADMFLAG_ROOT
this is so wrong ...

PHP Code:

AdminId admin 
GetUserAdmin(index); 

if (
admin != INVALID_ADMIN_ID// has flags
{
       
char group[64];
       if (
admin.GetGroup(0groupsizeof(group)) != INVALID_GROUP_ID// get his first group
       
{
              
PrintToChat(client"%s : %N"groupindex);
       }

I didn't want this because i want to see admins list with all ranks and i want to put a variety of colors
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908
PorcusorulMagic is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 04-04-2019 , 06:47   Re: [CSGO] !admins online
Reply With Quote #8

Quote:
Originally Posted by PorcusorulMagic View Post
I didn't want this because i want to see admins list with all ranks and i want to put a variety of colors
And you want the different ranks to simply be based on the admin flags that the user has access to, in this order?

Flag Z (ROOT) = Founders
Flag E (UNBAN) = Owners
Flag Q (CUSTOM3) = Mods
Flag D (BAN) = Admins
Flag B (GENERIC) = Helpers

and in the mentioned order, where if I am matching Z (ROOT), then I will only show up in Founders, but not under Owners, and "Admins" would show up under Admins, but not the lower "Helpers"?

Short said, only show up once, in the highest ranked one (according to the list) that they have access to with the flags?
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-04-2019 , 06:50   Re: [CSGO] !admins online
Reply With Quote #9

Quote:
Originally Posted by DarkDeviL View Post
And you want the different ranks to simply be based on the admin flags that the user has access to, in this order?

Flag Z (ROOT) = Founders
Flag E (UNBAN) = Owners
Flag Q (CUSTOM3) = Mods
Flag D (BAN) = Admins
Flag B (GENERIC) = Helpers

and in the mentioned order, where if I am matching Z (ROOT), then I will only show up in Founders, but not under Owners, and "Admins" would show up under Admins, but not the lower "Helpers"?

Short said, only show up once, in the highest ranked one (according to the list) that they have access to with the flags?
Yeah ,in this order , like when i type !admins to show in chat

Founders: AdminName1 or no founders online
Owners: AdminName2 or no owners online
Mods: AdminName3 or no mods online
Admins: AdminName4 or no admins online
Helpers: AdminName5 or no helpers online

But with a variety colors
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908

Last edited by PorcusorulMagic; 04-09-2019 at 10:11. Reason: Solved :D
PorcusorulMagic is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode