Ranga przed nickiem
Maliko
21.07.2025
Witam, bardzo dawno nic nie pisałem i mam mały problem, chce dodać rangę przed nickiem,
[Ranga] - zielony kolor
nick gracza - kolor druzyyny
tekst - standard
napisałem coś takiego, może macie krótszy sposób na takie cudo ![]()
public handle_say(id)
{
if (!is_user_connected(id)) return PLUGIN_CONTINUE;
static message[192];
read_args(message, charsmax(message));
remove_quotes(message);
if (message[0] == 0) return PLUGIN_HANDLED;
static name[32], ranga[30];
get_user_name(id, name, charsmax(name));
rank(id, ranga);
// Wysyłamy osobno do każdego gracza, z kolorem drużyny NADAWCY
for (new i = 1; i <= get_maxplayers(); i++)
{
if (!is_user_connected(i)) continue;
ColorChat(i, TEAM_COLOR, "^4[%s] ^3%s^1: %s", ranga, name, message);
}
return PLUGIN_HANDLED;
}
// Obsługa czatu drużynowego
public handle_say_team(id)
{
if (!is_user_connected(id)) return PLUGIN_CONTINUE;
static message[192];
read_args(message, charsmax(message));
remove_quotes(message);
if (message[0] == 0) return PLUGIN_HANDLED;
static name[32], ranga[30];
get_user_name(id, name, charsmax(name));
rank(id, ranga);
new team = get_user_team(id);
for (new i = 1; i <= 32; i++)
{
if (is_user_connected(i) && get_user_team(i) == team)
{
ColorChat(i, TEAM_COLOR, "^4[%s]^3 %s (team): ^1%s", ranga, name, message);
}
}
return PLUGIN_HANDLED;
}
Użytkownik Maliko edytował ten post 21.07.2025 15:15
Anonymuss
21.07.2025
public plugin_init()
{
register_message(get_user_msgid("SayText"), "msg_saytext");
}
public msg_saytext(msgid, dest, id)
{
new target = get_msg_arg_int(1);
if(!is_user_connected(target))
{
return;
}
new text[192];
get_msg_arg_string(2, text, charsmax(text));
new ranga[30];
rank(target, ranga);
if(!equal(text, "#Cstrike_Chat_All"))
{
set_msg_arg_string(2, fmt("^4[%s]^3 %s", ranga, text));
}
else
{
get_msg_arg_string(4, text, charsmax(text));
set_msg_arg_string(4, "");
set_msg_arg_string(2, fmt("^4[%s]^3 %n^1 : %s", ranga, target, text));
}
}
Użytkownik Anonymuss edytował ten post 21.07.2025 20:53
Maliko
22.07.2025
public plugin_init() { register_message(get_user_msgid("SayText"), "msg_saytext"); } public msg_saytext(msgid, dest, id) { new target = get_msg_arg_int(1); if(!is_user_connected(target)) { return; } new text[192]; get_msg_arg_string(2, text, charsmax(text)); new ranga[30]; rank(target, ranga); if(!equal(text, "#Cstrike_Chat_All")) { set_msg_arg_string(2, fmt("^4[%s]^3 %s", ranga, text)); } else { get_msg_arg_string(4, text, charsmax(text)); set_msg_arg_string(4, ""); set_msg_arg_string(2, fmt("^4[%s]^3 %n^1 : %s", ranga, target, text)); } }
a fmt ? jest mi to nie znane ![]()
xSPECJALSx
28.07.2025
public plugin_init() { register_message(get_user_msgid("SayText"), "msg_saytext"); } public msg_saytext(msgid, dest, id) { new target = get_msg_arg_int(1); if(!is_user_connected(target)) { return; } new text[192]; get_msg_arg_string(2, text, charsmax(text)); new ranga[30]; rank(target, ranga); if(!equal(text, "#Cstrike_Chat_All")) { set_msg_arg_string(2, fmt("^4[%s]^3 %s", ranga, text)); } else { get_msg_arg_string(4, text, charsmax(text)); set_msg_arg_string(4, ""); set_msg_arg_string(2, fmt("^4[%s]^3 %n^1 : %s", ranga, target, text)); } }
a fmt ? jest mi to nie znane
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define COLOR_RANK "3" // Zielony kolor w AMX (zielony: 3)
#define COLOR_TEAM_RED "4" // Czerwony (terro)
#define COLOR_TEAM_BLUE "1" // Niebieski (CT)
#define COLOR_STANDARD "7" // Standardowy (biały)
public plugin_init()
{
register_plugin("Rank Prefix", "1.0", "xZANDARMx");
}
public client_putinserver(id)
{
// Przykładowa ranga - możesz to zrobić dynamicznie z pliku lub bazy
new const rank[] = "[Ranga]";
new team = get_user_team(id);
new nick[32];
get_user_name(id, nick, charsmax(nick));
new colorTeam[2];
if (team == 2) // Terror
{
colorTeam[0] = COLOR_TEAM_RED[0];
colorTeam[1] = 0;
}
else if (team == 3) // CT
{
colorTeam[0] = COLOR_TEAM_BLUE[0];
colorTeam[1] = 0;
}
else
{
colorTeam[0] = COLOR_STANDARD[0];
colorTeam[1] = 0;
}
// Formatowanie: [Ranga] (zielony) + nick (kolor drużyny)
// Wyświetlamy to w czacie
client_print(0, print_chat, "\x03[%s]\x01 \x0%s%s\x01 joined the game", COLOR_RANK, nick);
}




