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

Block team join, spectate problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jonatat
Senior Member
Join Date: Dec 2017
Old 01-20-2018 , 07:05   Block team join, spectate problem
Reply With Quote #1

Hi guys. I have a plugin, this plugin block teamjoin but it has 1 problem. If player in spectator, he cannot watch first person and cannot use freelock. Any suggestions? Thanks! Sorry for bad english

PHP Code:
#include <amxmodx>
#include <cstrike>

#define PLUGIN "Block Team Change"
#define VERSION "2.0"
#define AUTHOR "CAMEL"
//Symbols
new blockit

    
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
blockit register_cvar("amx_blockteams","0")
    
register_clcmd("chooseteam""cmdChooseTeam")
    
register_clcmd("jointeam""cmdChooseTeam")

}
    public 
cmdChooseTeam(id)
{
    if(!
get_pcvar_num(blockit))  // cvar detect
    
return PLUGIN_CONTINUE
    
if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    return 
PLUGIN_HANDLED;
    
client_printcolor(id"/gblock:/y You cannot choose team at the moment.");
    return 
PLUGIN_HANDLED;
}
stock client_printcolor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg,190,input,3);
    
replace_all(msg,190,"/g","^4");// green txt
    
replace_all(msg,190,"/y","^1");// orange txt
    
replace_all(msg,190,"/ctr","^3");// team txt
    
replace_all(msg,190,"/w","^0");// team txt
    
if (idplayers[0] = id; else get_players(players,count,"ch");
    for (new 
i=0;i<count;i++)
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }

jonatat is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-20-2018 , 07:16   Re: Block team join, spectate problem
Reply With Quote #2

Remove this
PHP Code:
    if (cs_get_user_team(id) == CS_TEAM_SPECTATOR
    return 
PLUGIN_HANDLED
__________________
edon1337 is offline
jonatat
Senior Member
Join Date: Dec 2017
Old 01-20-2018 , 07:19   Re: Block team join, spectate problem
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
Remove this
PHP Code:
    if (cs_get_user_team(id) == CS_TEAM_SPECTATOR
    return 
PLUGIN_HANDLED
Still exist
jonatat is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-20-2018 , 07:24   Re: Block team join, spectate problem
Reply With Quote #4

I don't get the point of this plugin, it's buggy and you're still using it.
__________________
edon1337 is offline
jonatat
Senior Member
Join Date: Dec 2017
Old 01-20-2018 , 07:52   Re: Block team join, spectate problem
Reply With Quote #5

Any more suggestions?
jonatat is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-20-2018 , 07:55   Re: Block team join, spectate problem
Reply With Quote #6

Quote:
Originally Posted by edon1337 View Post
I don't get the point of this plugin, it's buggy and you're still using it.
^^^
__________________
Relaxing is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-20-2018 , 09:09   Re: Block team join, spectate problem
Reply With Quote #7

This plugin do nothing with the spectating mode.
Look at CVars: mp_forcecamera and mp_forcechasecam
__________________
My English is A0
E1_531G is offline
jonatat
Senior Member
Join Date: Dec 2017
Old 01-20-2018 , 10:16   Re: Block team join, spectate problem
Reply With Quote #8

Quote:
Originally Posted by E1_531G View Post
This plugin do nothing with the spectating mode.
Look at CVars: mp_forcecamera and mp_forcechasecam
mp_forcecamera 1
mp_forcechasecam 2

If i on spectate, i cannot see enemies on first person mode. If i delete this plugin from plugins.ini i can spectate all players in spectate.
jonatat is offline
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 02-10-2018 , 08:11   Re: Block team join, spectate problem
Reply With Quote #9

Try this ... just delete the 5v5 team lock stuff if you don't want it ...

This blocks MOTD, and Team VGUI menu and puts you straight into spectator and fixes the bug your talking about , where you cant freelook or first person spec.


Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
 
#define VGUI_SELECT_TEAM            2
#define MENU_JOINTEAM           1
#define GAMESTATE_JOINTEAM      4
 
#define XO_PLAYER           5
 
#define m_iPlayerTeam           114
#define m_iJoiningState         121
#define m_bHasChangeTeamThisRound   125
#define m_iMenu             205
 
new g_pcvarTeamLimit;
 
public plugin_init()
{
    register_plugin( "Auto Spec + Team Limiter", "0.0.1", "hornet" );
   
    register_clcmd( "jointeam", "ClientCommand_Team" );
    register_clcmd( "chooseteam", "ClientCommand_Team" );
    register_clcmd( "menuselect", "ClientCommand_Team" );
   
    register_message( get_user_msgid( "MOTD" ), "Message_MOTD" );
    register_message( get_user_msgid( "ShowMenu" ), "Message_ShowMenu" );
    register_message( get_user_msgid( "VGUIMenu" ), "Message_VGUIMenu" );
   
    g_pcvarTeamLimit = register_cvar( "pug_team_limit", "5" );
}
 
public client_disconnected( id )
{
    remove_task( id );
}
 
public ClientCommand_Team( id )
{
    if( ( get_pdata_int( id, m_iMenu ) == MENU_JOINTEAM && get_pdata_int( id, m_iJoiningState ) == GAMESTATE_JOINTEAM ) || get_pdata_int( id, m_iPlayerTeam ) == 3 )
    {
        new Players[ 32 ], iNum[ 3 ];
        get_players( Players, iNum[ 2 ], "e", "CT" );
        get_players( Players, iNum[ 1 ], "e", "TERRORIST" );
       
        new szArg[ 4 ];
        read_argv( 1, szArg, charsmax( szArg ) );
       
        new iTeam = str_to_num( szArg );
       
        if( iNum[ iTeam ] >= get_pcvar_num( g_pcvarTeamLimit ) )
        {
            client_print( id, print_center, "The team is full!" );
            engclient_cmd( id, "jointeam", "3" );
           
            return PLUGIN_HANDLED;
        }
    }
   
    return PLUGIN_CONTINUE;
}
 
public Message_MOTD()
{
    return PLUGIN_HANDLED;
}
 
public Message_ShowMenu( iMsg, iDest, id )
{
    if( cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )
        return PLUGIN_CONTINUE;
   
    static MESSAGE[] = "#Team_Select", szMsg[ charsmax( MESSAGE ) ];
    get_msg_arg_string( 4, szMsg, charsmax( szMsg ) );
 
    if( equal( szMsg, MESSAGE ) )
    {
        static data[ 2 ];
        data[ 0 ] = iMsg;
        set_task(0.1, "task_JoinTeam", id, data, sizeof(  data ) );
       
        return PLUGIN_HANDLED;
    }
   
    return PLUGIN_CONTINUE;
}
 
public Message_VGUIMenu( iMsg, iDest, id )
{  
    if( get_msg_arg_int( 1 ) != VGUI_SELECT_TEAM || cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )
        return PLUGIN_CONTINUE;
   
    static data[ 2 ];
    data[ 0 ] = iMsg;
    set_task(0.1, "task_JoinTeam", id, data, sizeof(  data ) );
   
    return PLUGIN_HANDLED;
}
 
public task_JoinTeam( data[], id )
{
    static block;
   
    block = get_msg_block( data[ 0 ] );
    set_msg_block( data[0], BLOCK_SET );
    engclient_cmd( id, "jointeam", "6" );
    set_msg_block( data[0], block );
   
    set_pdata_int( id, m_bHasChangeTeamThisRound, 0, XO_PLAYER )
}
__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me
CookieCrumbler is offline
jonatat
Senior Member
Join Date: Dec 2017
Old 05-04-2018 , 11:13   Re: Block team join, spectate problem
Reply With Quote #10

Getting error:

L 05/04/2018 - 18:09:14: [AMXX] Run time error 4: index out of bounds
L 05/04/2018 - 18:09:14: [AMXX] [0] block.sma::ClientCommand_Team (line 52)
jonatat 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 18:54.


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