Add color green pls

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
Infamous2018
Извън линия
Foreigner
Foreigner
Мнения: 522
Регистриран на: 08 Апр 2018, 16:56
Се отблагодари: 14 пъти
Получена благодарност: 21 пъти

Add color green pls

Мнение от Infamous2018 » 18 Юни 2018, 23:08

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.

Код за потвърждение: Избери целия код

#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]);
}  

Аватар
1Life1Dead
Извън линия
Потребител
Потребител
Мнения: 145
Регистриран на: 30 Май 2018, 21:38
Се отблагодари: 4 пъти
Получена благодарност: 11 пъти

Add color green pls

Мнение от 1Life1Dead » 19 Юни 2018, 14:23

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cromchat>

#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));    
    CC_LogMessage(0, print_chat, "&x04* Best player of the round is %s!", name);
    CC_LogMessage(0, print_chat, "&x04* He killed %d players, including %d headshots.", Kills[best], Headshots[best]);
}  
This is my first try to edit plugin, i dont understand so much, you can try this! Its Green like:

* Best player of the round is Alex!
* He killed 10 players, including 6 headshots.

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Add color green pls

Мнение от OciXCrom » 19 Юни 2018, 14:42

It's a good attempt, but you didn't use the correct function. Here's how it should be:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cromchat>

#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));    
    CC_SendMessage(0, "* &x04Best player &x01of the &x04round &x01is &x04%s!", name);
    CC_SendMessage(0, "* He &x04killed %d players&x01, including &x04%d headshots.", Kills[best], Headshots[best]);
}
PS: I'm aware you already got an answer in alliedmods, but I highly suggest you use this one because it uses the "cromchat" include instead of "colorchat" which contains bugs. Also, you may consider using this plugin - https://forums.alliedmods.net/showthread.php?t=302153

Аватар
Infamous2018
Извън линия
Foreigner
Foreigner
Мнения: 522
Регистриран на: 08 Апр 2018, 16:56
Се отблагодари: 14 пъти
Получена благодарност: 21 пъти

Add color green pls

Мнение от Infamous2018 » 23 Юни 2018, 13:35

Thanks.

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 9 госта