Raised This Month: $ Target: $400
 0% 

How to get admin's information from users.ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 05-27-2015 , 13:18   How to get admin's information from users.ini
Reply With Quote #1

Hello everyone,

I'll like if someone can make tutorial and an example code for following:

When any admin or player type: /admins in chat, then thet person can see motd with all admins from users.ini file. Example:



And I want to know is possible to change page in motd?
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
wickedd
Veteran Member
Join Date: Nov 2009
Old 05-27-2015 , 18:40   Re: How to get admin's information from users.ini
Reply With Quote #2

1.Post your question in the right forum.
2.Search the forum. No one is going to write tutorial for you when there's 100s of examples on the forum.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-27-2015 , 19:54   Re: How to get admin's information from users.ini
Reply With Quote #3

As long as you consistently store the users name in the first field (I don't) then this can work.
Code:
; Format of admin account:
; <name|ip|steamid> <password> <access flags> <account flags>

; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"
; "123.45.67.89" "" "abcdefghijklmnopqrstu" "de"
If you find your MOTD is getting cut-off before showing all admins, increase the size of MOTD_BUFFER. If you have more than 20 admins, increase MAX_ADMINS accordingly.
PHP Code:
#include <amxmodx>
#include <amxmisc>

new const Version[] = "0.1";

const 
MAX_ADMINS 20;
const 
MOTD_BUFFER 1024;

public 
plugin_init() 
{
    
register_plugin"Show Admins.ini" Version "bugsy" );
    
    
register_clcmd"say admins" "ShowAdmins" );
}

public 
ShowAdminsid )
{    
    new 
szAdminsMAX_ADMINS ][ ][ 32 ] , szMOTDMOTD_BUFFER ] , iNumAdmins;
    
    
iNumAdmins GetAdminInfoszAdmins sizeofszAdmins ) , charsmaxszAdmins[][] ) );
    
BuildMOTDszMOTD charsmaxszMOTD ) , szAdmins iNumAdmins );
    
    
show_motdid szMOTD );
}

GetAdminInfoszAdminArray[][][] , iMaxAdmins iMaxChars )
{
    new 
szUsersFile64 ] , iFile  szLine64 ] , iAdminIndex szTmp];
    
    
copyszUsersFileget_configsdirszUsersFile charsmaxszUsersFile ) ) ] , charsmaxszUsersFile ) , "/users.ini" );
    
    if ( ( 
iFile fopenszUsersFile "r" ) ) )
    {
        while ( ( 
iAdminIndex iMaxAdmins ) && fgetsiFile szLine charsmaxszLine ) ) )
        {
            if ( 
szLine] && szLine] != ';' && szLine] != '^n' )
            {
                
parseszLine szAdminArrayiAdminIndex ][ ] , iMaxChars szTmp szAdminArrayiAdminIndex ][ ] , iMaxChars );
                
iAdminIndex++;
            }
        }
        
        
fcloseiFile );
    }
    
    return 
iAdminIndex;
}

BuildMOTDszMOTD[] , iMaxChars , const szAdminArray[][][] , iNumAdmins )
{
    new 
iPos copyszMOTD iMaxChars "<html><b><font size=5>Server Admins</font></b><br><table style=^"width:100%^"><tr><th align=^"left^">Name</th><th align=^"left^">Flags</th></tr>" );
    
    for ( new 
iNumAdmins i++ )
        
iPos += formatexszMOTDiPos ] , iMaxChars iPos "<tr><td>%s</td><td>%s</td></tr>" szAdminArray][ ] , szAdminArray][ ] );
    
    
copyszMOTDiPos ] , iMaxChars iPos "</table></body></html>" );

__________________

Last edited by Bugsy; 05-27-2015 at 22:48.
Bugsy is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 05-28-2015 , 04:29   Re: How to get admin's information from users.ini
Reply With Quote #4

THXX Bugsy but can you say me how it's print Name and Flags... Why code doesn't print admin's password too ?
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-28-2015 , 09:31   Re: How to get admin's information from users.ini
Reply With Quote #5

Quote:
Originally Posted by BaD CopY View Post
THXX Bugsy but can you say me how it's print Name and Flags... Why code doesn't print admin's password too ?
  1. Why would you want to show passwords?
  2. Admins shouldn't have passwords and should be assigned by SteamID (Always).
  3. You can use my include to get a piece of information after the standard info in users.ini

Also, the MOTD cannot interact directly with a plugin that easily so making pages as you suggest is not really that easy.
__________________

Last edited by fysiks; 05-28-2015 at 09:33.
fysiks is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 05-28-2015 , 05:17   Re: How to get admin's information from users.ini
Reply With Quote #6

1. My server have more then 20 admins but motd print just 10 admins.
2. Can you add BG COLOR #000000 and font color #FFFFFF
3. Is possible to make motd who can change pages ? Exampe:

On one page code will print 15 admins... If server have more then 15 admins, then code will create more more motd (page)

BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 05-28-2015 , 15:34   Re: How to get admin's information from users.ini
Reply With Quote #7

@fyskis: Why would you want to show passwords?

I don't want to show password but I want to know how did he show only nick and flags...

And, can anyone add bgcolor to black and text to white in motd plzz..
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-28-2015 , 15:38   Re: How to get admin's information from users.ini
Reply With Quote #8

Look up how parse works. Where password is stored, I pass a temp/unused variable szTmp to read 1 character from it just to bypass it to get to flags.
__________________
Bugsy is offline
Old 06-01-2015, 16:15
BaD CopY
This message has been deleted by BaD CopY.
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 06-07-2015 , 16:40   Re: How to get admin's information from users.ini
Reply With Quote #10

Bugsy, sorry but again I don't understend how did you do it...

Can you help me about motd. I want if you can make and if is it possible, next page to motd (See my second photo, #5 comment)
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
Reply



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 20:05.


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