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

Admin Check Restyle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Artifact
Veteran Member
Join Date: Jul 2010
Old 02-04-2015 , 07:39   Admin Check Restyle
Reply With Quote #1

PHP Code:
#include <amxmodx>

/*---------------EDIT ME------------------*/
#define ADMIN_CHECK ADMIN_KICK

static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
/*----------------------------------------*/

new maxplayers
new gmsgSayText

public plugin_init() {
    
register_plugin("Admin Check""1.51""OneEyed")
    
maxplayers get_maxplayers()
    
gmsgSayText get_user_msgid("SayText")
    
register_clcmd("say""handle_say")
    
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
}

public 
handle_say(id) {
    new 
said[192]
    
read_args(said,192)
    if( ( 
containi(said"who") != -&& containi(said"admin") != -) || contain(said"/admin") != -)
        
set_task(0.1,"print_adminlist",id)
    return 
PLUGIN_CONTINUE
}

public 
print_adminlist(user
{
    new 
adminnames[33][32]
    new 
message[256]
    new 
contactinfo[256], contact[112]
    new 
idcountxlen
    
    
for(id id <= maxplayers id++)
        if(
is_user_connected(id))
        if(
get_user_flags(id) & ADMIN_CHECK)
        
get_user_name(idadminnames[count++], 31)
    
    if(
get_pcvar_num("amx_show_activity") == 0)
        return 
PLUGIN_HANDLED;
    else if(
get_pcvar_num("amx_show_activity") == 1)
    {
        
len format(message255"%s THERE IS ADMINS ONLINE",COLOR)
        if(
count 0) {
            
len format(message255"%s THERE IS ADMINS ONLINE",COLOR)
            
print_message(usermessage)
        }
        else {
            
len += format(message[len], 255-len"No admins online.")
            
print_message(usermessage)
        }
        
        
get_cvar_string("amx_contactinfo"contact63)
        if(
contact[0])  {
            
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
            
print_message(usercontactinfo)
        }
        return 
PLUGIN_HANDLED
    
}
    else {
        
        
len format(message255"%s ADMINS ONLINE: ",COLOR)
        if(
count 0) {
            for(
count x++) {
                
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
                if(
len 96 ) {
                    
print_message(usermessage)
                    
len format(message255"%s ",COLOR)
                }
            }
            
print_message(usermessage)
        }
    }
    else {
        
len += format(message[len], 255-len"No admins online.")
        
print_message(usermessage)
    }
    
    
get_cvar_string("amx_contactinfo"contact63)
    if(
contact[0])  {
        
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
        
print_message(usercontactinfo)
    }
}

print_message(idmsg[]) {
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()

And if someone can give me example of fu**ing pcvar -.- Everytime when I put pcvar there is and error in plugin.... I'm really sick of pcvar
__________________
Artifact is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-04-2015 , 09:13   Re: Admin Check Restyle
Reply With Quote #2

PHP Code:
new Cvar register_cvar("gsdgSDF""1")
new 
Value get_pcvar_num(Cvar
__________________
HamletEagle is online now
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-04-2015 , 18:06   Re: Admin Check Restyle
Reply With Quote #3

Look at existing documentation and other plugins. This is how self-learning works which is the way that most good scripters here probably started out.
__________________
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-04-2015 , 20:34   Re: Admin Check Restyle
Reply With Quote #4

This is your friend: http://www.amxmodx.org/api/

If you are curious on how to do something, look at existing plugins that may do the same thing to help you figure it out. You can also search since I guarantee any question you may have has already been asked multiple times. As fysiks said, if you're trying to learn you have to put in the effort to investigate things and do trial and error. Plenty of people are willing to help, but basic things like this are easy to figure out on your own.

I think you're confused with get_pcvar_num() and get_cvar_num(). Get get_pcvar_num() expects a pointer to the cvar while get_cvar_num() will take the string name of the cvar you want to reference. If you want to use the pcvar flavor, do what HamletEagle showed you above. To use pcvar variants with existing cvars (one's that you do not register) you would do:

PHP Code:
public plugin_init()
{
     
pCVar_ShowActivity get_cvar_pointer"amx_show_activity" );
}

if ( 
get_pcvar_numpCVar_ShowActivity ) == )
     
//do stuff 
__________________

Last edited by Bugsy; 02-04-2015 at 20:35.
Bugsy 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 10:17.


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