Raised This Month: $ Target: $400
 0% 

Specific Name on Each Team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cuttlas
Senior Member
Join Date: Jan 2015
Old 11-15-2023 , 12:57   Specific Name on Each Team
Reply With Quote #1

is there any plugin which player can choose name for playing on each team?

for example when he is playing on CT, his name is RoboCop and when He transfer to T, then his name changed to Jackal
Cuttlas is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 11-17-2023 , 16:09   Re: Specific Name on Each Team
Reply With Quote #2

of course, what about the duplicates, will they all have the same name?
__________________
mlibre is offline
Cuttlas
Senior Member
Join Date: Jan 2015
Old 11-17-2023 , 16:36   Re: Specific Name on Each Team
Reply With Quote #3

it will be used only for admins. while duplicates it should add numbers.

If it can read names from an ini files, it would be perfect.
__________________
To Infinity n Beyond
Cuttlas is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-17-2023 , 17:40   Re: Specific Name on Each Team
Reply With Quote #4

So each admin does this?

set_name "Bugsy_T" (while on T team)
set_name "Bugsy_CT" (while on CT team)

Then the next time I connect, it automatically sets my name based on the team I join?
__________________
Bugsy is offline
Cuttlas
Senior Member
Join Date: Jan 2015
Old 11-17-2023 , 22:03   Re: Specific Name on Each Team
Reply With Quote #5

for example I store names on an ini files like this:

CTName=RoboCop
TName=Jackal

then the plugin will read that ini file and in each round will check the player team, if he is on CT, then the CT name should be set, if he is on T, the T name.

also it is very good, if we can enable/disable team checking, if the plugin is disabled then it should not change the names, also it would be perfect if the enable/disable be a amx cvar.
__________________
To Infinity n Beyond
Cuttlas is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-18-2023 , 13:29   Re: Specific Name on Each Team
Reply With Quote #6

So if 2 CT admins connect, you would expect:

Robocop 1
Robocop 2

?
__________________
Bugsy is offline
Cuttlas
Senior Member
Join Date: Jan 2015
Old 11-18-2023 , 14:17   Re: Specific Name on Each Team
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
So if 2 CT admins connect, you would expect:

Robocop 1
Robocop 2

?
yeah, it would be nice
__________________
To Infinity n Beyond
Cuttlas is offline
Cuttlas
Senior Member
Join Date: Jan 2015
Old 11-18-2023 , 15:44   Re: Specific Name on Each Team
Reply With Quote #8

or we can think more publicly, that every player (admin or none-admin) can set CTName and TName in an ini file (in a specific folder with a specific name) on their client systems.

whenever any player wants to active this functionally he can call /teamnames.
__________________
To Infinity n Beyond
Cuttlas is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-18-2023 , 16:47   Re: Specific Name on Each Team
Reply With Quote #9

The server can't read a file like that. You would need to give them the ability to set the setting and store it on the server. However, this wouldn't really be much different than just them changing their own name.
__________________
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-18-2023 , 18:01   Re: Specific Name on Each Team
Reply With Quote #10

Here's most of it, I just need to hook team change CT <-> T to set the name accordingly when /teamnames is enabled for the player.

Edit: Updated with team change hook to apply name change when going CT <-> T. Not tested much.
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>

new const Version[] = "0.1";

new 
g_Vault;

enum TeamNameData
{
    
tnAuthID,
    
tnCurTeam,
    
bool:tnEnabled
}

new 
g_tnDataMAX_PLAYERS ][ TeamNameData ];

public 
plugin_init() 
{
    
register_plugin"Team Names" Version "bugsy" );
    
    
register_clcmd"tname" "SetTeamName" );
    
register_clcmd"ctname" "SetTeamName" );
    
register_clcmd"say /teamnames" "EnableTeamName" );
    
    
register_event"TeamInfo" "EventTeamInfo" "a" );
    
    if ( ( 
g_Vault nvault_open"TeamNames" ) ) == INVALID_HANDLE )
        
set_fail_state"Error opening vault" );
}

public 
plugin_end()
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    
get_user_authidid g_tnDataid ][ tnAuthID ] , charsmaxg_tnData[][ tnAuthID ] ) );
    
g_tnDataid ][ tnCurTeam ] = 'U';
    
g_tnDataid ][ tnEnabled ] = false;
}

public 
EnableTeamNameid )
{
    
g_tnDataid ][ tnEnabled ] = !g_tnDataid ][ tnEnabled ];
    
client_printid print_chat "* Team Names was %s" g_tnDataid ][ tnEnabled ]  ? "enabled" "disabled" );
    
    if ( 
g_tnDataid ][ tnEnabled ]  )
        
ChangePlayerNameid g_tnDataid ][ tnCurTeam ] == 'T' CS_TEAM_T CS_TEAM_CT );
    
    return 
PLUGIN_HANDLED;
}

public 
SetTeamNameid )
{
    new 
szCmd] ,  szName33 ] ,  szKey36 ];
    
    
read_argvszCmd charsmaxszCmd ) );
    
read_argvszName charsmaxszName ) );
    
    
formatexszKey charsmaxszKey ) , "%s_%s" szCmd] == 'c' "C" "T" g_tnDataid ][ tnAuthID ] );
    
nvault_setg_Vault szKey szName );
    
    
console_printid "%s name successfully set to '%s'" szCmd] == 'c' "CT" "T" szName );
    
UpdateNameid );
    
    return 
PLUGIN_HANDLED;
}

public 
UpdateNameid )
{

    if ( 
g_tnDataid ][ tnEnabled ] )
    {

        switch ( 
g_tnDataid ][ tnCurTeam ] )
        {
            case 
'T'ChangePlayerNameid CS_TEAM_T );
            case 
'C'ChangePlayerNameid CS_TEAM_CT  );
        }
    }
}

public 
ChangePlayerNameid CsTeams:csTeam )
{
    new 
szName35 ] ,  szKey36 ] ,  iNameLen iTS ,  iCounter szCurName33 ];
    
    
formatexszKey charsmaxszKey ) , "%s_%s" , ( csTeam == CS_TEAM_CT ) ? "C" "T" g_tnDataid ][ tnAuthID ] );
    
    if ( 
nvault_lookupg_Vault szKey szName charsmaxszName ) , iTS ) )
    {
        
iNameLen strlenszName );
        while ( 
cmd_targetid szName ) )
        {
            if ( 
szNameiNameLen ] == EOS )
                
szNameiNameLen ] = '_';
            
            
szNameiNameLen ] = '0' +  iCounter;
        }
        
        
get_user_nameid szCurName charsmaxszCurName ) );
        
        if ( !
equaliszName szCurName )  )
        {
            
console_cmdid "name ^"%s^"" szName );
        }
    }
    else
    {
        
client_printid print_chat "* You do not have a %s team name defined. Use the 'tname' & 'ctname' console commands to do so." , ( csTeam == CS_TEAM_CT ) ? "CT" "T" );
    }    
}

public 
EventTeamInfo( )
{
    static 
idid read_data);
    static 
szTeam]; read_dataszTeam charsmaxszTeam ) );
    
    if ( 
g_tnDataid ][ tnCurTeam ] != szTeam] )
    {
        
g_tnDataid ][ tnCurTeam ] = szTeam];
        
UpdateNameid );
    }

__________________

Last edited by Bugsy; 11-19-2023 at 14:11.
Bugsy is offline
Reply



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 01:10.


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