Raised This Month: $ Target: $400
 0% 

[SOLVED] custom /admins "online" ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 02-23-2013 , 17:19   [SOLVED] custom /admins "online" ?
Reply With Quote #1

im using this method to assign ranks to clients...

PHP Code:
/* Rank Names */
enum
{
    
OWNER,
    
HADMIN,
    
ADMIN,
    
PLAYER,
    
    
AUTHORIZED
};

new const 
AccessType[AUTHORIZED][]=
{
    
"Manager",
    
"Head Admin",
    
"Admin",
    
"Player"
};
/* Rank Names End */ 
and how they get assigned to clients

PHP Code:
public client_connect(id)
{
    
    
rank1 get_user_flags(id) & ADMIN_LEVEL_B;
    
rank2 get_user_flags(id) & ADMIN_LEVEL_C;
    
rank3 get_user_flags(id) & ADMIN_LEVEL_D;
    
rank4 get_user_flags(id) & ADMIN_ALL;
    
    if(
rank1 rank2 rank3)
    {
        
RankName[id] = OWNER;
    }
    
    else if(
rank2 && rank3)
    {
        
RankName[id] = HADMIN;
    }
    
    else if(
rank3)
    {
        
RankName[id] = ADMIN;
    }        
        
    else if(
rank4)
    {
        
RankName[id] = PLAYER;
    } 
now my question is how to script this into a client_print ?

i know i havent tried yet... just need a shove in right direction ?

thanks,

Last edited by Blizzard_87; 02-23-2013 at 18:03.
Blizzard_87 is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-23-2013 , 17:39   Re: custom /admins "online" ?
Reply With Quote #2

hook the command that you want to use.. then loop through the players on the server... get_players method works well..

If you want to display something like this
Code:
[AMXX] Name: SavSin    Rank: Manager
PHP Code:
public cmdAdminsOnline(id)
{
    new 
iPlayers[32], iPlayersNum;
    
get_players(iPlayersiPlayersNum); //iPlayers is an array which holds the player id's of the only line players. iPlayersNum is number of players playing.
                                                        //if iPlayersNum was 5 then iPlayers would hold the id's for those players in cell's 0-4
    
new szName[32];
    
    for(new 
i=0iPlayersNumi++)
    {
        
get_user_name(iPlayers[i], szNamecharsmax(szName));
        
client_print(idprint_chat"[AMXX] Name: %s Rank: %s"szNameAccessType[RankName[iPlayers[i]]]);
    }


Last edited by Doc-Holiday; 02-23-2013 at 17:41.
Doc-Holiday is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 02-23-2013 , 17:55   Re: custom /admins "online" ?
Reply With Quote #3

Quote:
Originally Posted by Doc-Holiday View Post
hook the command that you want to use.. then loop through the players on the server... get_players method works well..

If you want to display something like this
Code:
[AMXX] Name: SavSin    Rank: Manager
PHP Code:
public cmdAdminsOnline(id)
{
    new 
iPlayers[32], iPlayersNum;
    
get_players(iPlayersiPlayersNum); //iPlayers is an array which holds the player id's of the only line players. iPlayersNum is number of players playing.
                                                        //if iPlayersNum was 5 then iPlayers would hold the id's for those players in cell's 0-4
    
new szName[32];
    
    for(new 
i=0iPlayersNumi++)
    {
        
get_user_name(iPlayers[i], szNamecharsmax(szName));
        
client_print(idprint_chat"[AMXX] Name: %s Rank: %s"szNameAccessType[RankName[iPlayers[i]]]);
    }

PHP Code:
public cmdAdminsOnline(id)
{
    new 
iPlayers[32], iPlayersNum;
    
get_players(iPlayersiPlayersNum);
    new 
szName[32];
    
    
get_pcvar_string(TAGPREFIXcharsmax(PREFIX));
    
    for(new 
i=0iPlayersNumi++)
    {
        
get_user_name(iPlayers[i], szNamecharsmax(szName));
        
client_printc(id"!g[%s]!n %s(!g%s!n) "PREFIXszNameAccessType[RankName[iPlayers[i]]]);
    }

works... but was hoping to display like this..

[PREFIX] Admins Online: Name1 (Rank), Name2 (Rank), Name3 (Rank), etc etc

and if g_HideRank is true then to only show admins who have NOT chosen to hide rank...

this explanation make sense?
Blizzard_87 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 02-23-2013 , 18:03   Re: custom /admins "online" ?
Reply With Quote #4

SOLVED:

PHP Code:
public onlineadmins(id) {
    new 
players[32],pnumplayer;
    
get_players(players,pnum);
    
    
get_pcvar_string(TAGPREFIXcharsmax(PREFIX));
        
    new 
temp[216],name[32], count
    
    
for( new ii<pnumi++ ) {
        if(!
g_HideRank[players[i]]) {
            
player players[i]
            
count++
            
get_user_name(player,name,31)
            
formatex(temp,215,"%s %s !n(!g%s!n),!t "tempnameAccessType[RankName[players[i]]])
        }
    }
    if(
count)
        
client_printc(id"!g[%s]!n Admins Online:!t %s!n"PREFIXtemp)
    else
        
client_printc(id"!g[%s]!n No admins online."PREFIX)
        
    return 
PLUGIN_HANDLED;

Blizzard_87 is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-23-2013 , 19:12   Re: Re: custom /admins "online" ?
Reply With Quote #5

Quote:
Originally Posted by Blizzard_87 View Post
SOLVED:

PHP Code:
public onlineadmins(id) {
new 
players[32],pnumplayer;
get_players(players,pnum);

get_pcvar_string(TAGPREFIXcharsmax(PREFIX));

new 
temp[216],name[32], count

for( new ii<pnumi++ ) {
if(!
g_HideRank[players[i]]) {
player players[i]
count++
get_user_name(player,name,31)
formatex(temp,215,"%s %s !n(!g%s!n),!t "tempnameAccessType[RankName[players[i]]])
}
}
if(
count)
client_printc(id"!g[%s]!n Admins Online:!t %s!n"PREFIXtemp)
else
client_printc(id"!g[%s]!n No admins online."PREFIX)

return 
PLUGIN_HANDLED;

Then formatex is what you want like you did
Doc-Holiday is offline
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 02-25-2013 , 15:26   Re: custom /admins "online" ?
Reply With Quote #6

Quote:
Originally Posted by Blizzard_87 View Post
SOLVED:

PHP Code:
public onlineadmins(id) {
    new 
players[32],pnumplayer;
    
get_players(players,pnum);
    
    
get_pcvar_string(TAGPREFIXcharsmax(PREFIX));
        
    new 
temp[216],name[32], count
    
    
for( new ii<pnumi++ ) {
        if(!
g_HideRank[players[i]]) {
            
player players[i]
            
count++
            
get_user_name(player,name,31)
            
formatex(temp,215,"%s %s !n(!g%s!n),!t "tempnameAccessType[RankName[players[i]]])
        }
    }
    if(
count)
        
client_printc(id"!g[%s]!n Admins Online:!t %s!n"PREFIXtemp)
    else
        
client_printc(id"!g[%s]!n No admins online."PREFIX)
        
    return 
PLUGIN_HANDLED;

Where have you defined g_HideRank?
My friend is interested in this too.
Send full code please
WeeZick is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 02-25-2013 , 15:58   Re: custom /admins "online" ?
Reply With Quote #7

Quote:
Originally Posted by WeeZick View Post
Where have you defined g_HideRank?
My friend is interested in this too.
Send full code please
defined above plugin_init ( )

new bool:g_HideRank [33];
Blizzard_87 is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 02-25-2013 , 16:02   Re: custom /admins "online" ?
Reply With Quote #8

Quote:
Originally Posted by Blizzard_87 View Post
defined above plugin_init ( )

new bool:g_HideRank [33];
A plugin like this already exist
Hiderank
Admin menu
Change tag
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.

Last edited by ironskillz1; 02-25-2013 at 16:02.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 02-25-2013 , 16:26   Re: custom /admins "online" ?
Reply With Quote #9

Quote:
Originally Posted by Blizzard_87 View Post
defined above plugin_init ( )

new bool:g_HideRank [33];
But you need to use g_HideRank somewhere, in a function?
or else it will be error g_HideRank have no effect
WeeZick is offline
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 02-25-2013 , 16:42   Re: custom /admins "online" ?
Reply With Quote #10

Quote:
Originally Posted by ironskillz1 View Post
A plugin like this already exist
Hiderank
Admin menu
Change tag
I know but i dont have it. It is Execute-Gaming menu
WeeZick is offline
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 21:47.


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