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

Automatically team TAG during the mix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cusy23
Junior Member
Join Date: Aug 2010
Old 11-14-2022 , 11:22   Automatically team TAG during the mix
Reply With Quote #1

Hello,

It's my first topic here, so I apologize if I'm breaking any rule. I need your help in the following matter (i've searched before here and couldn't find anything related).
- I found here a plugin which adds/removes a customized TAG for each team (@T, @CT) or for a specific player.

Here is it:
https://forums.alliedmods.net/showthread.php?t=69307

We are using it when we are playing some kind of mix but on a public server(just having some fun). We have a plugin for the mix but it doesn't contain also the TAGs option(only start/end/warm/spec all/restart options), so I'm using a separate plugin for this.

The problem with it is that it doesn't work for players which have special characters in the name(for example: fᵰntoʍ).

Secondly, it would be great that if someone will join a team while the mix it's ongoing, to automatically set the TAG, depending the team he has joined (T or CT)

Thank you very much in advance !

Cheers all !
cusy23 is offline
cusy23
Junior Member
Join Date: Aug 2010
Old 11-17-2022 , 14:57   Re: Automatically team TAG during the mix
Reply With Quote #2

No one ?
cusy23 is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-19-2022 , 14:52   Re: Automatically team TAG during the mix
Reply With Quote #3

PHP Code:
#include <amxmodx>

#define START_CMD "/start"
#define END_CMD "/end"
#define MAX_TAG_LENGTH 10

enum _:DATA
{
    
szName[MAX_NAME_LENGTH],
    
szTag[MAX_TAG_LENGTH]
}

enum _:CVARS 
{
    
CT[MAX_TAG_LENGTH],
    
T[MAX_TAG_LENGTH],
    
SPEC[MAX_TAG_LENGTH]
}

enum
{
    
ADD_TAG 0,
    
REMOVE_TAG 1
}

enum
{
    
TERRORISTS 1,
    
COUNTER_TERRORISTS 2
}

new 
g_eUserData[MAX_PLAYERS 1][DATA];
new 
g_eCvars[CVARS]
new 
g_sayText;

public 
plugin_init()
{
    
register_plugin("MIX Tags""0.1""AMXX Community");

    new 
data register_cvar("tag_ct""CT");
    
get_pcvar_string(datag_eCvars[CT], charsmax(g_eCvars[CT]));

    
data register_cvar("tag_t""T");
    
get_pcvar_string(datag_eCvars[T], charsmax(g_eCvars[T]));

    
data register_cvar("tag_spec""SPEC");
    
get_pcvar_string(datag_eCvars[SPEC], charsmax(g_eCvars[SPEC]));

    
register_clcmd("say""sayHook");
    
register_clcmd("say_team""sayHook");

    
g_sayText get_user_msgid("SayText");
}

public 
client_authorized(id)
{
    
g_eUserData[id][szTag][0] = EOS;
    
get_user_name(idg_eUserData[id][szName], charsmax(g_eUserData[][szName]));
}

public 
sayHook(id)
{
    new 
szArg[192];
    
read_args(szArgcharsmax(szArg));
    
remove_quotes(szArg)
    
trim(szArg)

    if(
equal(szArgSTART_CMD))
    {
        
setTags(ADD_TAG)
    }

    if(
equal(szArgEND_CMD))
    {
        
setTags(REMOVE_TAG)
    }

    if (
g_eUserData[id][szTag][0] != EOS)
        
send_msg(id"^4[%s]^3 %s^4 :^1 %s"g_eUserData[id][szTag], g_eUserData[id][szName], szArg)
    else 
        
send_msg(id"^3%s^4 :^1 %s"g_eUserData[id][szName], szArg)

    return 
PLUGIN_HANDLED
}

setTags(const type)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch");

    for(new 
iiPlayeriTeamiNumi++)
    {
        
iPlayer iPlayers[i];

        if(!
is_user_connected(iPlayer))
            continue;

        switch(
type)
        {
            case 
ADD_TAG:
            {
                
iTeam get_user_team(iPlayer);
                switch(
iTeam)
                {
                    case 
TERRORISTScopy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[T]);
                    case 
COUNTER_TERRORISTScopy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[CT]);
                    default: 
g_eUserData[iPlayer][szTag] = "SPEC";
                }
            }
            
            case 
REMOVE_TAG:
            {
                
arrayset(g_eUserData[iPlayer][szTag], 0charsmax(g_eUserData[][szTag]));
            }
        }
    }
}

stock send_msg(const id, const input[], any:...) {
    new 
iNum 1iPlayers[MAX_PLAYERS];
    static 
szMsg[191];
    
vformat(szMsg190input3);

    if(
idiPlayers[0] = id;
    else 
get_players(iPlayersiNum"ch"); {
        for(new 
iiPlayeriNumi++) {
            
iPlayer iPlayers[i]
            if(
is_user_connected(iPlayer)) {
                
message_begin(MSG_ONE_UNRELIABLEg_sayText_iPlayer);
                
write_byte(iPlayer);
                
write_string(szMsg);
                
message_end();
            }
        }
    }
}

public 
client_infochanged(id

    
get_user_info(id"name"g_eUserData[id][szName], charsmax(g_eUserData[][szName])); 

try this one

edit: put it the last one in plugins.ini

Last edited by lexzor; 11-19-2022 at 15:04.
lexzor is offline
cusy23
Junior Member
Join Date: Aug 2010
Old 11-20-2022 , 18:26   Re: Automatically team TAG during the mix
Reply With Quote #4

Hi lexzor,

Thank you very much for your help. Can you please provide me more details about what exactly it's doing and how it works?

Do i need to remove the old plugin for TAGS? If so, how can I set the tags using this plugin(i didn't saw any command registered).

Thank you in advance for your explanations !
cusy23 is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-20-2022 , 20:35   Re: Automatically team TAG during the mix
Reply With Quote #5

yes, you must disable that one. when command /start is typed in the chat a tag will be provided for the all players from the server (u have 3 cvars tag_spec tag, tag_t tag, tag_ct tag). when command /end is called in the chat the tag is removed. if you want some changes for this plugins you can reply here.
lexzor is offline
Old 11-21-2022, 14:56
cusy23
This message has been deleted by cusy23.
cusy23
Junior Member
Join Date: Aug 2010
Old 11-21-2022 , 14:57   Re: Automatically team TAG during the mix
Reply With Quote #6

Quote:
Originally Posted by lexzor View Post
yes, you must disable that one. when command /start is typed in the chat a tag will be provided for the all players from the server (u have 3 cvars tag_spec tag, tag_t tag, tag_ct tag). when command /end is called in the chat the tag is removed. if you want some changes for this plugins you can reply here.
It seems it's working only for Amxmodx 1.9.0. On Amxmodx 1.8.2 (my current version) it fails to compile:

Code:
tag_custom.sma(9) : error 017: undefined symbol "MAX_NAME_LENGTH"
tag_custom.sma(32) : error 017: undefined symbol "MAX_PLAYERS"
tag_custom.sma(88) : error 017: undefined symbol "MAX_PLAYERS"
tag_custom.sma(88) : error 029: invalid expression, assumed zero
tag_custom.sma(88) : error 017: undefined symbol "iNum"
tag_custom.sma(88) : fatal error 107: too many error messages on one line
Additionally, I have one question: with this plugin, if a player will join on the server after I've typed /start will he get automatically the tag ? Or it's setting the tags only for the players which are on the server at the moment I'm typeing /start ?

Thanks you !
cusy23 is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 11-21-2022 , 15:07   Re: Automatically team TAG during the mix
Reply With Quote #7

Add this item
PHP Code:
#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH 32
#endif

#if !defined MAX_PLAYERS
const MAX_PLAYERS 32
#endif 
amirwolf is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-21-2022 , 15:58   Re: Automatically team TAG during the mix
Reply With Quote #8

Quote:
Originally Posted by cusy23 View Post
Additionally, I have one question: with this plugin, if a player will join on the server after I've typed /start will he get automatically the tag ? Or it's setting the tags only for the players which are on the server at the moment I'm typeing /start ?
Thanks you !
No, but the below one will

PHP Code:
#include <amxmodx>

#define START_CMD "/start"
#define END_CMD "/end"
#define MAX_TAG_LENGTH 10

#if !defined MAX_NAME_LENGTH
    
const MAX_NAME_LENGTH 32
#endif

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32
#endif 

enum _:DATA
{
    
szName[MAX_NAME_LENGTH],
    
szTag[MAX_TAG_LENGTH]
}

enum _:CVARS 
{
    
CT[MAX_TAG_LENGTH],
    
T[MAX_TAG_LENGTH],
    
SPEC[MAX_TAG_LENGTH]
}

enum
{
    
ADD_TAG 0,
    
REMOVE_TAG 1
}

enum
{
    
TERRORISTS 1,
    
COUNTER_TERRORISTS 2
}

new 
g_eUserData[MAX_PLAYERS 1][DATA];
new 
g_eCvars[CVARS]
new 
g_sayText;
new 
bool:g_bStarted;

public 
plugin_init()
{
    
register_plugin("MIX Tags""0.1""AMXX Community");

    new 
data register_cvar("tag_ct""CT");
    
get_pcvar_string(datag_eCvars[CT], charsmax(g_eCvars[CT]));

    
data register_cvar("tag_t""T");
    
get_pcvar_string(datag_eCvars[T], charsmax(g_eCvars[T]));

    
data register_cvar("tag_spec""SPEC");
    
get_pcvar_string(datag_eCvars[SPEC], charsmax(g_eCvars[SPEC]));

    
register_clcmd("say""sayHook");
    
register_clcmd("say_team""sayHook");

    
register_event"TeamInfo" "fw_EvTeamInfo" "a" );

    
g_sayText get_user_msgid("SayText");
}

public 
fw_EvTeamInfo( )
{
    if(!
g_bStarted)
        return 
PLUGIN_HANDLED_MAIN;

    static 
id;
    
id read_data(1);
    static 
szTeam[2];
    
read_data(2szTeamcharsmax(szTeam));

    switch(
szTeam[0])
    {
        case 
'T':   copy(g_eUserData[id][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[T]);
        case 
'C':   copy(g_eUserData[id][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[CT]);
        default:    
copy(g_eUserData[id][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[SPEC]);
    }

    return 
PLUGIN_CONTINUE;


public 
client_authorized(id)
{
    
g_eUserData[id][szTag][0] = EOS;
    
get_user_name(idg_eUserData[id][szName], charsmax(g_eUserData[][szName]));
}

public 
sayHook(id)
{
    new 
szArg[192];
    
read_args(szArgcharsmax(szArg));
    
remove_quotes(szArg)
    
trim(szArg)

    if(
equal(szArgSTART_CMD))
    {
        
setTags(ADD_TAG)
    }

    if(
equal(szArgEND_CMD))
    {
        
setTags(REMOVE_TAG)
    }

    if (
g_eUserData[id][szTag][0] != EOS)
        
send_msg(id"^4[^3%s^4]^3 %s^4 :^1 %s"g_eUserData[id][szTag], g_eUserData[id][szName], szArg)
    else 
        
send_msg(id"^3%s^4 :^1 %s"g_eUserData[id][szName], szArg)

    return 
PLUGIN_HANDLED
}

setTags(const type)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch");

    for(new 
iiPlayeriTeamiNumi++)
    {
        
iPlayer iPlayers[i];

        if(!
is_user_connected(iPlayer))
            continue;

        switch(
type)
        {
            case 
ADD_TAG:
            {
                
g_bStarted true;
                
iTeam get_user_team(iPlayer);
                switch(
iTeam)
                {
                    case 
TERRORISTS:                copy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[T]);
                    case 
COUNTER_TERRORISTS:        copy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[CT]);
                    default:                        
copy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[SPEC]);
                }
            }
            
            case 
REMOVE_TAG:
            {
                
g_bStarted false
                arrayset
(g_eUserData[iPlayer][szTag], 0charsmax(g_eUserData[][szTag]));
            }
        }
    }
}

stock send_msg(const id, const input[], any:...) {
    new 
iNum 1iPlayers[MAX_PLAYERS];
    static 
szMsg[191];
    
vformat(szMsg190input3);

    if(
idiPlayers[0] = id;
    else 
get_players(iPlayersiNum"ch"); {
        for(new 
iiPlayeriNumi++) {
            
iPlayer iPlayers[i]
            if(
is_user_connected(iPlayer)) {
                
message_begin(MSG_ONE_UNRELIABLEg_sayText_iPlayer);
                
write_byte(iPlayer);
                
write_string(szMsg);
                
message_end();
            }
        }
    }
}

public 
client_infochanged(id

    
get_user_info(id"name"g_eUserData[id][szName], charsmax(g_eUserData[][szName])); 


Last edited by lexzor; 11-21-2022 at 16:00.
lexzor is offline
cusy23
Junior Member
Join Date: Aug 2010
Old 11-24-2022 , 19:31   Re: Automatically team TAG during the mix
Reply With Quote #9

Quote:
Originally Posted by lexzor View Post
No, but the below one will

PHP Code:
#include <amxmodx>

#define START_CMD "/start"
#define END_CMD "/end"
#define MAX_TAG_LENGTH 10

#if !defined MAX_NAME_LENGTH
    
const MAX_NAME_LENGTH 32
#endif

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32
#endif 

enum _:DATA
{
    
szName[MAX_NAME_LENGTH],
    
szTag[MAX_TAG_LENGTH]
}

enum _:CVARS 
{
    
CT[MAX_TAG_LENGTH],
    
T[MAX_TAG_LENGTH],
    
SPEC[MAX_TAG_LENGTH]
}

enum
{
    
ADD_TAG 0,
    
REMOVE_TAG 1
}

enum
{
    
TERRORISTS 1,
    
COUNTER_TERRORISTS 2
}

new 
g_eUserData[MAX_PLAYERS 1][DATA];
new 
g_eCvars[CVARS]
new 
g_sayText;
new 
bool:g_bStarted;

public 
plugin_init()
{
    
register_plugin("MIX Tags""0.1""AMXX Community");

    new 
data register_cvar("tag_ct""CT");
    
get_pcvar_string(datag_eCvars[CT], charsmax(g_eCvars[CT]));

    
data register_cvar("tag_t""T");
    
get_pcvar_string(datag_eCvars[T], charsmax(g_eCvars[T]));

    
data register_cvar("tag_spec""SPEC");
    
get_pcvar_string(datag_eCvars[SPEC], charsmax(g_eCvars[SPEC]));

    
register_clcmd("say""sayHook");
    
register_clcmd("say_team""sayHook");

    
register_event"TeamInfo" "fw_EvTeamInfo" "a" );

    
g_sayText get_user_msgid("SayText");
}

public 
fw_EvTeamInfo( )
{
    if(!
g_bStarted)
        return 
PLUGIN_HANDLED_MAIN;

    static 
id;
    
id read_data(1);
    static 
szTeam[2];
    
read_data(2szTeamcharsmax(szTeam));

    switch(
szTeam[0])
    {
        case 
'T':   copy(g_eUserData[id][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[T]);
        case 
'C':   copy(g_eUserData[id][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[CT]);
        default:    
copy(g_eUserData[id][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[SPEC]);
    }

    return 
PLUGIN_CONTINUE;


public 
client_authorized(id)
{
    
g_eUserData[id][szTag][0] = EOS;
    
get_user_name(idg_eUserData[id][szName], charsmax(g_eUserData[][szName]));
}

public 
sayHook(id)
{
    new 
szArg[192];
    
read_args(szArgcharsmax(szArg));
    
remove_quotes(szArg)
    
trim(szArg)

    if(
equal(szArgSTART_CMD))
    {
        
setTags(ADD_TAG)
    }

    if(
equal(szArgEND_CMD))
    {
        
setTags(REMOVE_TAG)
    }

    if (
g_eUserData[id][szTag][0] != EOS)
        
send_msg(id"^4[^3%s^4]^3 %s^4 :^1 %s"g_eUserData[id][szTag], g_eUserData[id][szName], szArg)
    else 
        
send_msg(id"^3%s^4 :^1 %s"g_eUserData[id][szName], szArg)

    return 
PLUGIN_HANDLED
}

setTags(const type)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch");

    for(new 
iiPlayeriTeamiNumi++)
    {
        
iPlayer iPlayers[i];

        if(!
is_user_connected(iPlayer))
            continue;

        switch(
type)
        {
            case 
ADD_TAG:
            {
                
g_bStarted true;
                
iTeam get_user_team(iPlayer);
                switch(
iTeam)
                {
                    case 
TERRORISTS:                copy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[T]);
                    case 
COUNTER_TERRORISTS:        copy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[CT]);
                    default:                        
copy(g_eUserData[iPlayer][szTag], charsmax(g_eUserData[][szTag]), g_eCvars[SPEC]);
                }
            }
            
            case 
REMOVE_TAG:
            {
                
g_bStarted false
                arrayset
(g_eUserData[iPlayer][szTag], 0charsmax(g_eUserData[][szTag]));
            }
        }
    }
}

stock send_msg(const id, const input[], any:...) {
    new 
iNum 1iPlayers[MAX_PLAYERS];
    static 
szMsg[191];
    
vformat(szMsg190input3);

    if(
idiPlayers[0] = id;
    else 
get_players(iPlayersiNum"ch"); {
        for(new 
iiPlayeriNumi++) {
            
iPlayer iPlayers[i]
            if(
is_user_connected(iPlayer)) {
                
message_begin(MSG_ONE_UNRELIABLEg_sayText_iPlayer);
                
write_byte(iPlayer);
                
write_string(szMsg);
                
message_end();
            }
        }
    }
}

public 
client_infochanged(id

    
get_user_info(id"name"g_eUserData[id][szName], charsmax(g_eUserData[][szName])); 

Hi lexzor. I think I was misunderstood. This plugin set a tag which is visible only when you are writing something. Moreover, it doesn't work also in this way, after I'm activating it with /start, I can see my tag, but others no, and worse, they cannot see anything anymore from what I'm writing till i'm doing /end.

But my request wasn't to set a tag which is visible only when you are writing something. I want to use it for mix and in order to do that, I need the tag to be visible in the player nickname(also in the scoreboard) while mix it's ongoing for all players from the server and also for the new players which are joining on server after I'm setting the tags. Please check the attached screenshot for example. Basically, it will change the name during the mix.

To achieve the tags like in the attached screenshot, currently, I'm using the plugin from the below link but it has some issues:
1. It doesn't work for players which have special characters in the name(for example: fᵰntoʍ).
2. If someone it's joining after setting the tags, it will remain without tag unless we are doing it manually for him.

https://forums.alliedmods.net/showthread.php?t=69307
Attached Files
File Type: zip de_dust2_20060000.zip (4.01 MB, 40 views)

Last edited by cusy23; 11-25-2022 at 08:35.
cusy23 is offline
cusy23
Junior Member
Join Date: Aug 2010
Old 12-08-2022 , 14:21   Re: Automatically team TAG during the mix
Reply With Quote #10

Hello to everyone. No one can help me with this?
cusy23 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 21:00.


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