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

Hud Admin Check Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Joker.
Member
Join Date: Mar 2011
Old 07-28-2011 , 04:58   Hud Admin Check Problem
Reply With Quote #1

Code:
#include <amxmodx> 
#include <amxmisc> 

public plugin_init() { 
    register_plugin("Admin HUD List","1.0","Wa7Ne.1aW") 
    register_clcmd("say /admin","clcmd_admins",-1," - Shows The Online Admins In The Server") 
} 

public clcmd_admins(id) {     
    new adminlist[2048] = "Online Admin^n" 

    new temp[64],adminnames[32],players[32],num,player,i  
    get_players(players,num) 
     
    for(i = 0;i < num;i++) { 
        player = players[i] 
        if(is_user_connected(player) && is_user_admin(player)) 
        {  
            get_user_name(player,adminnames,31) 
            format(temp,63,"【Admin】%s^n",adminnames) 
            add(adminlist,2047,temp) 
        } 
        else if(is_user_connected(player) && get_user_flags(player) & ADMIN_LEVEL_A) 
        {  
            get_user_name(player,adminnames,31) 
            format(temp,63,"【VIP】%s^n",adminnames) 
            add(adminlist,2047,temp) 
        } 
    } 

    if(strfind(adminlist,"-") == -1) { 
        add(adminlist,2047,"") 
    } 

    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
    show_hudmessage(id,adminlist) 
    return PLUGIN_HANDLED 
}

When I say /admin and check this , have ADMIN_LEVEL_A 's admin will show
【Admin】. It will not be 【VIP】. How to fix that??
Sorry For My Bad English!
Joker. is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 07-28-2011 , 05:29   Re: Hud Admin Check Problem
Reply With Quote #2

Quote:
Originally Posted by Joker. View Post
Code:
#include <amxmodx> 
#include <amxmisc> 

public plugin_init() { 
    register_plugin("Admin HUD List","1.0","Wa7Ne.1aW") 
    register_clcmd("say /admin","clcmd_admins",-1," - Shows The Online Admins In The Server") 
} 

public clcmd_admins(id) {     
    new adminlist[2048] = "Online Admin^n" 

    new temp[64],adminnames[32],players[32],num,player,i  
    get_players(players,num) 
     
    for(i = 0;i < num;i++) { 
        player = players[i] 
        if(is_user_connected(player) && is_user_admin(player)) 
        {  
            get_user_name(player,adminnames,31) 
            format(temp,63,"【Admin】%s^n",adminnames) 
            add(adminlist,2047,temp) 
        } 
        else if(is_user_connected(player) && get_user_flags(player) & ADMIN_LEVEL_A) 
        {  
            get_user_name(player,adminnames,31) 
            format(temp,63,"【VIP】%s^n",adminnames) 
            add(adminlist,2047,temp) 
        } 
    } 

    if(strfind(adminlist,"-") == -1) { 
        add(adminlist,2047,"") 
    } 

    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
    show_hudmessage(id,adminlist) 
    return PLUGIN_HANDLED 
}

When I say /admin and check this , have ADMIN_LEVEL_A 's admin will show
【Admin】. It will not be 【VIP】. How to fix that??
Sorry For My Bad English!
Im not really sure but i think
PHP Code:
is_user_admin(id
checks if he have any flags except ADMIN_USER so admin immunity is included too..
but im not sure im noob :]
Dr7sTyLe is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-28-2011 , 07:43   Re: Hud Admin Check Problem
Reply With Quote #3

Code:
if( is_user_connected( id ) && is_user_admin( id ) ) {             get_user_name(player,adminnames,31)             format(temp,63,"%s%s^n", get_user_flags( id ) & ADMIN_LEVEL_A  ? "【Admin】" : "【VIP】", adminnames)             add(adminlist,2047,temp) }
SnoW is offline
Send a message via MSN to SnoW
Joker.
Member
Join Date: Mar 2011
Old 07-29-2011 , 00:51   Re: Hud Admin Check Problem
Reply With Quote #4

Quote:
Originally Posted by SnoW View Post
Code:
if( is_user_connected( id ) && is_user_admin( id ) ) { get_user_name(player,adminnames,31)
format(temp,63,"%s%s^n", get_user_flags( id ) & ADMIN_LEVEL_A ? "【Admin】" : "【VIP】", adminnames) add(adminlist,2047,temp)
}

There is a bug. All player in the server will show they are admin too when i say /admin to check online admin. And ADMIN_LEVEL_A 's admin still show is 【Admin】 Not 【VIP】.
Sorry For My Bad English


Last edited by Joker.; 07-29-2011 at 01:00. Reason: Move Bug In The plugin
Joker. is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-29-2011 , 08:09   Re: Hud Admin Check Problem
Reply With Quote #5

I am pretty sure the bug is not in the part I gave you but in the whole code you should now show.
SnoW is offline
Send a message via MSN to SnoW
Joker.
Member
Join Date: Mar 2011
Old 07-29-2011 , 12:43   Re: Hud Admin Check Problem
Reply With Quote #6

Quote:
Originally Posted by SnoW View Post
I am pretty sure the bug is not in the part I gave you but in the whole code you should now show.

Code:
#include <amxmodx> 
#include <amxmisc> 


public plugin_init() { 
    register_plugin("Admin HUD List","1.0","Wa7Ne.1aW") 
    register_clcmd("say /admin","clcmd_admins",-1," - Shows The Online Admins In The Server") 
} 

public clcmd_admins(id) {     
    new adminlist[2048] = "Online Admin^n" 

    new temp[64],adminnames[32],players[32],num,player,i  
    get_players(players,num) 
     
    for(i = 0;i < num;i++) { 
        player = players[i] 
        if( is_user_connected(id) && is_user_admin(id) )
        {  
            get_user_name(player,adminnames,31) 
            format(temp,63,"%s%s^n", get_user_flags(id) & ADMIN_LEVEL_A  ? "【Admin】" : "【VIP】", adminnames) 
            add(adminlist,2047,temp)
        } 
    } 

    if(strfind(adminlist,"-") == -1) { 
        add(adminlist,2047,"") 
    } 

    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
    show_hudmessage(id,adminlist) 
    return PLUGIN_HANDLED 
}

Last edited by Joker.; 07-29-2011 at 12:44. Reason: change something
Joker. is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-29-2011 , 12:53   Re: Hud Admin Check Problem
Reply With Quote #7

You should use "player" instead of "id" inside the loop.
SnoW is offline
Send a message via MSN to SnoW
Joker.
Member
Join Date: Mar 2011
Old 07-29-2011 , 12:56   Re: Hud Admin Check Problem
Reply With Quote #8

Quote:
Originally Posted by SnoW View Post
You should use "player" instead of "id" inside the loop.
If i change to "player" all people in the server will show they are admin too
Joker. is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-29-2011 , 13:00   Re: Hud Admin Check Problem
Reply With Quote #9

Use this:
PHP Code:
for(0;num;i++) { 
        
player players[i
        if( 
is_user_connected(player) && is_user_admin(player) )
        {  
            
get_user_name(player,adminnames,31
            
format(temp,63,"%s%s^n"get_user_flags(id) & ADMIN_LEVEL_A  "[VIP]" "[ADMIN]"adminnames
            
add(adminlist,2047,temp)
        } 
    } 
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-29-2011 , 17:09   Re: Hud Admin Check Problem
Reply With Quote #10

You just made it worse, nikhilgupta. You need to use the index "player" in the get_user_flags native as well. You also switched the places of "[vip]" and "[admin]" opers which was obviously wrong.
SnoW is offline
Send a message via MSN to SnoW
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 09:50.


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