Raised This Month: $32 Target: $400
 8% 

[REQ] Add Colors to this Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Syturio
BANNED
Join Date: Jul 2014
Location: Under your bed.
Old 08-14-2014 , 02:07   [REQ] Add Colors to this Plugin
Reply With Quote #1

I wanna add chat colors to this plugin.
Right now it is like this:

I want it to be like this

*GREEN*
[Admins]
[Moderadores]
[VIPs]
[Patrocinadores]

*YELLOW*
Player1, Player2
Player 3
Player 4

I also wanna remove the space behind the word
[ Admin] (and all outhers) if possible

Here is the code of the plugin:

PHP Code:
#include <amxmodx>  

#define ADMIN_CHECK ADMIN_LEVEL_A
#define MOD_CHECK ADMIN_LEVEL_B  
#define VIP_CHECK ADMIN_LEVEL_C 
#define PATROCINADOR_CHECK ADMIN_LEVEL_D

static const COLOR[] = "^x04";
static const 
CONTACT[] = "";  

new 
maxplayers;  
new 
gmsgSayText;  

new 
sv_contactinfo;  

public 
plugin_init() {  
    
register_plugin("BSGD""1.2""PoLiCe");  
    
gmsgSayText get_user_msgid("SayText");  
      
    
register_clcmd("say /admin""print_list");  
      
    
sv_contactinfo register_cvar("sv_contactinfo"CONTACTFCVAR_SERVER);  
}  

public 
print_list(user) {  
    
set_task(0.1"task_print_list"user);  
}  

public 
task_print_list(user) {  
    new 
players[32], pnum;  
    
get_players(playerspnum);  
      
    new 
player;  
    new 
flags[32];  
    static 
names[32][32];  
      
    for(new 
0pnumi++) {  
        
player players[i];  
        
flags[i] = get_user_flags(player);  
        
get_user_name(playernames[i], charsmax(names[]));  
    }  
      
    static const 
admin_flags[] = {ADMIN_CHECKMOD_CHECKVIP_CHECKPATROCINADOR_CHECK};  
    static const 
admin_names[][] = {"Admins""Moderadores""VIPs""Patrocinadores"};  
      
    static 
message[256];  
    new 
len;  
    new 
admin_flag;  
    new 
admins[32];  
    new 
count;  
      
    for(new 
0jsizeof(admin_flags); i++) {  
        
len formatex(messagecharsmax(message), "[%s%s] "COLORadmin_names[i]);  
          
        
admin_flag admin_flags[i];  
        
count 0;  
          
        for(
0pnumj++) {  
            if(
flags[j] & admin_flag) {  
                
admins[count++] = j;  
            }  
        }  
          
        if(
count 0) {  
            for(
0countj++) {  
                
len += formatex(message[len], charsmax(message) - len"%s%s"names[admins[j]], (< (count 1)) ? ", " "");  
                  
                if(
len 96 && (< (count 1))) {  
                    
print_message(usermessage);  
                    
len formatex(messagecharsmax(message), "%s "COLOR);  
                }  
            }  
        } else {  
            
len += formatex(message[len], charsmax(message) - len"Nao ha nenhum online."admin_names[i]);  
        }  
          
        
print_message(usermessage);  
    }  
      
    static 
contact[64];  
    
get_pcvar_string(sv_contactinfocontactcharsmax(contact));  
      
    if(
contact[0])  {  
        static 
contactinfo[256];  
        
formatex(contactinfo111""COLORcontact);  
        
print_message(usercontactinfo);  
    }  
}  

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


Last edited by Syturio; 08-14-2014 at 02:08.
Syturio is offline
Syturio
BANNED
Join Date: Jul 2014
Location: Under your bed.
Old 08-14-2014 , 02:16   Re: [REQ] Add Colors to this Plugin
Reply With Quote #2

I managed to fix the space by changing:

PHP Code:
 len formatex(messagecharsmax(message), "[%s%s] "COLORadmin_names[i]); 
to
PHP Code:
 len formatex(messagecharsmax(message), "%s[%s] "COLORadmin_names[i]); 
Now everything is Green.
But i just want the players to have yellow name.
Syturio 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 11:51.


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