Junior Member
|
11-24-2022
, 19:31
Re: Automatically team TAG during the mix
|
#9
|
Quote:
Originally Posted by lexzor
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(data, g_eCvars[CT], charsmax(g_eCvars[CT]));
data = register_cvar("tag_t", "T"); get_pcvar_string(data, g_eCvars[T], charsmax(g_eCvars[T]));
data = register_cvar("tag_spec", "SPEC"); get_pcvar_string(data, g_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(2, szTeam, charsmax(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(id, g_eUserData[id][szName], charsmax(g_eUserData[][szName])); }
public sayHook(id) { new szArg[192]; read_args(szArg, charsmax(szArg)); remove_quotes(szArg) trim(szArg)
if(equal(szArg, START_CMD)) { setTags(ADD_TAG) }
if(equal(szArg, END_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(iPlayers, iNum, "ch");
for(new i, iPlayer, iTeam; i < iNum; i++) { 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], 0, charsmax(g_eUserData[][szTag])); } } } }
stock send_msg(const id, const input[], any:...) { new iNum = 1, iPlayers[MAX_PLAYERS]; static szMsg[191]; vformat(szMsg, 190, input, 3);
if(id) iPlayers[0] = id; else get_players(iPlayers, iNum, "ch"); { for(new i, iPlayer; i < iNum; i++) { iPlayer = iPlayers[i] if(is_user_connected(iPlayer)) { message_begin(MSG_ONE_UNRELIABLE, g_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
Last edited by cusy23; 11-25-2022 at 08:35.
|
|