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

Force Team via steam ID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TCB_WyattEarp
Member
Join Date: Sep 2013
Old 05-24-2020 , 14:57   Force Team via steam ID
Reply With Quote #1

Is there a plugin that will stop a player from joining a specific team based on steam ID?
Ever have a player that ALWAYS joins T side and them camps spawn every round.
Looking for a way to stop this and if they can't join T< problem solved..

???
TCB_WyattEarp is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-24-2020 , 16:54   Re: Force Team via steam ID
Reply With Quote #2

Not sure how you are storing the steam-id for these players. Hard-coded for now.
PHP Code:

#include <amxmodx>
#include <cstrike>

new const Version[] = "0.1";

new const 
ForceToCT[][] = 
{
    
"STEAM_0:0:12345",
    
"STEAM_0:0:67890"
}

new const 
g_TeamInfoCsTeams ][] =
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
};

public 
plugin_init()
{
    
register_plugin"Force Team" Version "bugsy" );
    
    
register_messageget_user_msgid"TeamInfo" ) , "MessageTeamInfo" );
}

public 
MessageTeamInfomsgid dest receiver )
{
    if ( 
dest != MSG_ALL && dest != MSG_BROADCAST 
        return;
    
    new 
szTeam] , iPlayer szAuthID34 ] , bool:bForceToCT;
    
    
iPlayer get_msg_arg_int);
    
get_user_authidiPlayer szAuthID charsmaxszAuthID ) );
    
    for ( new 
sizeofForceToCT ) ; i++ )
    {
        if ( 
equaliszAuthID ForceToCT] ) )
        {
            
bForceToCT true;
            break;
        }
    }
    
    if ( 
bForceToCT )
    {
        
get_msg_arg_stringszTeamcharsmaxszTeam ) );
        
        if ( 
szTeam] == 'T' )
        {
            
cs_set_user_teamiPlayer CS_TEAM_CT );
            
set_msg_arg_stringg_TeamInfoCS_TEAM_CT ] );
        }
    }

__________________
Bugsy is online now
TCB_WyattEarp
Member
Join Date: Sep 2013
Old 05-24-2020 , 18:05   Re: Force Team via steam ID
Reply With Quote #3

This works, will it still work if limit teams is enabled ?

Would be better if steam ID's could be stored in an INI but this does work

Last edited by TCB_WyattEarp; 05-24-2020 at 18:06.
TCB_WyattEarp is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-24-2020 , 18:23   Re: Force Team via steam ID
Reply With Quote #4

This only sets the team, you will need to adjust team balancing accordingly.
__________________
Bugsy is online now
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 05-25-2020 , 02:25   Re: Force Team via steam ID
Reply With Quote #5

Quote:
Originally Posted by TCB_WyattEarp View Post
This works, will it still work if limit teams is enabled ?

Would be better if steam ID's could be stored in an INI but this does work
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new const Version[] = "0.1";

new const 
g_TeamInfoCsTeams ][] =
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
};

new Array:
a_steamIds
new szFile[64]

public 
plugin_init()
{
    
register_plugin"Force Team" Version "bugsy" );
    
a_steamIds ArrayCreate(32)
    
get_configsdir(szFilecharsmax(szFile))
    
formatex(szFilecharsmax(szFile), "%s/force_team.ini"szFile)
    
register_messageget_user_msgid"TeamInfo" ) , "MessageTeamInfo" );
}

public 
plugin_cfg()
{
    new 
szData[33]
    new 
file fopen(szFile"rt")

    while(!
feof(file))
    {
        
fgets(fileszDatacharsmax(szData))
        
trim(szData)
        if( !
szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/' 
            continue;
        
        
remove_quotes(szData)
        
ArrayPushString(a_steamIdsszData)
    }
    
fclose(file)
}

public 
MessageTeamInfomsgid dest receiver )
{
    if ( 
dest != MSG_ALL && dest != MSG_BROADCAST 
        return;
    
    new 
szTeam] , iPlayer szAuthID34 
    
    
iPlayer get_msg_arg_int);
    
get_user_authidiPlayer szAuthID charsmaxszAuthID ) );
    
    if ( 
ArrayFindString(a_steamIdsszAuthID) != -)
    {
        
get_msg_arg_stringszTeamcharsmaxszTeam ) );
        
        if ( 
szTeam] == 'T' )
        {
            
cs_set_user_teamiPlayer CS_TEAM_CT );
            
set_msg_arg_stringg_TeamInfoCS_TEAM_CT ] );
        }
    }

Here you go, enter steamIDs in file `force_team.ini` under configs folder in amxmodx dir
instinctpt1 is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 05-25-2020 , 10:50   Re: Force Team via steam ID
Reply With Quote #6

Just to satisfy my curiosity: If that guy is such a, let's call it: "bad teamplayer", why do you bother about him at all? Just ban him. Problem solved. No plugin needed, nothing, just a amx_addban "ID" "moron" "0" (if that is correct, i regulary ban through amxbans).
__________________

Mordekay 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 14:55.


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