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

Add Green Color to any Words Pls


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 06-18-2018 , 16:11   Add Green Color to any Words Pls
Reply With Quote #1

Can anyone add colorchat pls...

client_print(0, print_chat, "* Best player of the round is %s!", name);
client_print(0, print_chat, "* He killed %d players, including %d headshots.", Kills[best], Headshots[best]);

Green Words should be: Best Player , Round , NAME
Green Words for second line: Killed Players, Headshots

Big THX.

Code:
#include <amxmodx>

#define MIN_KILLS 1

new Kills[33];
new Headshots[33];

public plugin_init()
{
    register_plugin("Best Player of the Round", "1.0", "hleV");
    
    register_event("HLTV", "OnHltv", "a", "1=0", "2=0");
    register_event("DeathMsg", "OnDeathMsg", "a");
    
    register_logevent("OnRoundEnd", 2, "1=Round_End");
}

public client_disconnect(id)
    Kills[id] = Headshots[id] = 0;
    
public OnHltv()
{
    arrayset(Kills, 0, sizeof Kills);
    arrayset(Headshots, 0, sizeof Headshots);
}
    
public OnDeathMsg()
{
    new id = read_data(1);
    
    if (!is_user_connected(id))
        return;
        
    Kills[id]++;
    
    if (read_data(3))
        Headshots[id]++;
}

public OnRoundEnd()
{
    new players[32], num;
    get_players(players, num);
    
    if (!num)
        return;
    
    new best = players[0];
    
    for (new i = 1, id; i < num; i++)
    {
        id = players[i];
        
        if (Kills[id] > Kills[best] || (Kills[id] == Kills[best] && Headshots[id] > Headshots[best]))
            best = id;
    }
    
    if (Kills[best] < MIN_KILLS) // Minimum amount of kills
        return;

    new name[32];
    get_user_name(best, name, charsmax(name));    
    client_print(0, print_chat, "* Best player of the round is %s!", name);
    client_print(0, print_chat, "* He killed %d players, including %d headshots.", Kills[best], Headshots[best]);
}
Godofwar is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-18-2018 , 16:26   Re: Add Green Color to any Words Pls
Reply With Quote #2

Here you go, this should work with the default stock if you compile locally. Also as you can see add ^4 for a green color ^1 for a normal color, to color something, if i colored it wrong.

PHP Code:
#include <amxmodx>
#include <colorchat>

#define MIN_KILLS 1

new Kills[33];
new 
Headshots[33];

public 
plugin_init()
{
    
register_plugin("Best Player of the Round""1.0""hleV");
    
    
register_event("HLTV""OnHltv""a""1=0""2=0");
    
register_event("DeathMsg""OnDeathMsg""a");
    
    
register_logevent("OnRoundEnd"2"1=Round_End");
}

public 
client_disconnect(id)
    
Kills[id] = Headshots[id] = 0;
    
public 
OnHltv()
{
    
arrayset(Kills0sizeof Kills);
    
arrayset(Headshots0sizeof Headshots);
}
    
public 
OnDeathMsg()
{
    new 
id read_data(1);
    
    if (!
is_user_connected(id))
        return;
        
    
Kills[id]++;
    
    if (
read_data(3))
        
Headshots[id]++;
}

public 
OnRoundEnd()
{
    new 
players[32], num;
    
get_players(playersnum);
    
    if (!
num)
        return;
    
    new 
best players[0];
    
    for (new 
1idnumi++)
    {
        
id players[i];
        
        if (
Kills[id] > Kills[best] || (Kills[id] == Kills[best] && Headshots[id] > Headshots[best]))
            
best id;
    }
    
    if (
Kills[best] < MIN_KILLS// Minimum amount of kills
        
return;

    new 
name[32];
    
get_user_name(bestnamecharsmax(name));    
   
/* client_print(0, print_chat, "* Best player of the round is %s!", name);
    client_print(0, print_chat, "* He killed %d players, including %d headshots.", Kills[best], Headshots[best]);*/
    
ColorChat0NORMAL"*^4 Best player^1 of the^4 round^1  is^4 %s^1!"name);
    
ColorChat0NORMAL"* He^4 killed %d players^1, including^4 %d headshots^1 ."Kills[best], Headshots[best]); 

__________________
stuff
maqi is offline
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 06-23-2018 , 06:34   Re: Add Green Color to any Words Pls
Reply With Quote #3

THANKS
Godofwar is offline
Reply


Thread Tools
Display Modes

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 15:18.


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