Raised This Month: $12 Target: $400
 3% 

Removing Team Join Messages (CSGO)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 06-24-2015 , 19:49   Removing Team Join Messages (CSGO)
Reply With Quote #1

Hi everyone, im trying to remove the team join messages, but don't seem to be having any luck.
I want to avoid setting broadcast false inside a join team hook because this has some undesirable effects in CSGO such as breaking defuse kits for CT.

Here's my current code, although it does not seem to do anything..

PHP Code:
#include <sourcemod>

public Plugin myinfo 
{
    
name "Remove Team Join Messages"
    
author "SM9"
};

public 
void OnPluginStart()
{
    
HookUserMessage(GetUserMessageId("TextMsg"), MsgHook_Messagestrue);
}

public 
Action MsgHook_Messages(UserMsg msg_idHandle msg, const players[], playersNumbool reliablebool init)
{
    
decl String:buffer[64];
    
PbReadString(msg"params"buffersizeof(buffer), 0);
    
    if (
StrEqual(buffer"#Cstrike_TitlesTXT_Game_join_ct"))
    {
        return 
Plugin_Handled;
    }
    
    if (
StrEqual(buffer"#Cstrike_TitlesTXT_Game_join_ct_auto"))
    {
        return 
Plugin_Handled;
    }
    
    if (
StrEqual(buffer"#Cstrike_TitlesTXT_Game_join_terrorist"))
    {
        return 
Plugin_Handled;
    }
    
    if (
StrEqual(buffer"#Cstrike_TitlesTXT_Game_join_terrorist_auto"))
    {
        return 
Plugin_Handled;
    }
    
    if (
StrEqual(buffer"#Cstrike_game_join_spectators"))
    {
        return 
Plugin_Handled;
    }
    
    if (
StrEqual(buffer"#Cstrike_game_join_terrorist"))
    {
        return 
Plugin_Handled;
    }
    
    if (
StrEqual(buffer"#Cstrike_game_join_ct"))
    {
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;

Thanks.

Last edited by SM9; 06-24-2015 at 19:50.
SM9 is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 06-24-2015 , 23:23   Re: Removing Team Join Messages (CSGO)
Reply With Quote #2

Are you talking about the message: Player X is joining the Terrorist Force?

Edit: Nevermind, the method I used is the one you want to avoid using.

Last edited by Darkness_; 06-24-2015 at 23:24.
Darkness_ is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 06-25-2015 , 02:44   Re: Removing Team Join Messages (CSGO)
Reply With Quote #3

PHP Code:
/***********************************************************/
/********************** PLAYER CONNECT *********************/
/***********************************************************/
public Action PlayerConnect(Handle event, const char[] namebool dontBroadcast)
{
    if(
B_active_zombie_riot)
    {
        if(!
dontBroadcast)
        {
            
char S_name[32], networkID[22], address[26];
            
GetEventString(event"name"S_namesizeof(S_name)-1);
            
GetEventString(event"networkid"networkIDsizeof(networkID)-1);
            
GetEventString(event"address"addresssizeof(address)-1);
            
            
Handle new_event CreateEvent("player_connect"true);
            
SetEventString(new_event"name"S_name);
            
SetEventInt(new_event"index"GetEventInt(event"index"));
            
SetEventInt(new_event"userid"GetEventInt(event"userid"));
            
SetEventString(new_event"networkid"networkID);
            
SetEventString(new_event"address"address);
            
            
FireEvent(new_eventtrue);
            
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;
}

/***********************************************************/
/********************* PLAYER DISCONNECT *******************/
/***********************************************************/
public Action PlayerDisconnect(Handle event, const char[] namebool dontBroadcast)
{
    if(
B_active_zombie_riot)
    {
        if(!
dontBroadcast)
        {
            
char S_name[32], networkID[22], address[26];
            
GetEventString(event"name"S_namesizeof(S_name)-1);
            
GetEventString(event"networkid"networkIDsizeof(networkID)-1);
            
GetEventString(event"address"addresssizeof(address)-1);
            
            
Handle new_event CreateEvent("player_disconnect"true);
            
SetEventString(new_event"name"S_name);
            
SetEventInt(new_event"index"GetEventInt(event"index"));
            
SetEventInt(new_event"userid"GetEventInt(event"userid"));
            
SetEventString(new_event"networkid"networkID);
            
SetEventString(new_event"address"address);
            
            
FireEvent(new_eventtrue);
            
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;

Dr. Api is offline
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 06-25-2015 , 08:33   Re: Removing Team Join Messages (CSGO)
Reply With Quote #4

Thanks for your reply Dr Api, although im wanting to block the team messages and not the connect ones.
SM9 is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 06-25-2015 , 11:28   Re: Removing Team Join Messages (CSGO)
Reply With Quote #5

Quote:
Originally Posted by xCoderx View Post
Thanks for your reply Dr Api, although im wanting to block the team messages and not the connect ones.
You can do exactly the same for team join.
Dr. Api is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 06-25-2015 , 11:29   Re: Removing Team Join Messages (CSGO)
Reply With Quote #6

PHP Code:
/***********************************************************/
/*********************** PLAYER TEAM PRE********************/
/***********************************************************/
public Action PlayerTeam_Pre(Handle event, const char[] namebool dontBroadcast)
{
    if(
B_active_zombie_riot)
    {
        
        if(!
dontBroadcast)
        {
            
Handle new_event CreateEvent("player_team"true);
            
            
SetEventInt(new_event"userid"GetEventInt(event"userid"));
            
SetEventInt(new_event"team"GetEventInt(event"team"));
            
SetEventInt(new_event"oldteam"GetEventInt(event"oldteam"));
            
SetEventBool(new_event"disconnect"GetEventBool(event"disconnect"));
            
            
FireEvent(new_eventtrue);
            
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;

Dr. Api is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-25-2015 , 11:51   Re: Removing Team Join Messages (CSGO)
Reply With Quote #7

Have you tried logging what data you're getting from TextMsg to see what might be going on?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 06-25-2015 , 13:47   Re: Removing Team Join Messages (CSGO)
Reply With Quote #8

Quote:
Originally Posted by Dr. Api View Post
PHP Code:
/***********************************************************/
/*********************** PLAYER TEAM PRE********************/
/***********************************************************/
public Action PlayerTeam_Pre(Handle event, const char[] namebool dontBroadcast)
{
    if(
B_active_zombie_riot)
    {
        
        if(!
dontBroadcast)
        {
            
Handle new_event CreateEvent("player_team"true);
            
            
SetEventInt(new_event"userid"GetEventInt(event"userid"));
            
SetEventInt(new_event"team"GetEventInt(event"team"));
            
SetEventInt(new_event"oldteam"GetEventInt(event"oldteam"));
            
SetEventBool(new_event"disconnect"GetEventBool(event"disconnect"));
            
            
FireEvent(new_eventtrue);
            
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;

That worked thanks
SM9 is offline
'-_-'<3zok<3'-_-'
Senior Member
Join Date: Feb 2010
Location: Norway
Old 11-12-2015 , 18:45   Re: Removing Team Join Messages (CSGO)
Reply With Quote #9

Hey, need some help with this code.. Tried fixing it but I have no idea of what I'm missing.

Quote:
//// hideteamchange.sp
//
// C:\steamcmd\csgo\csgo\addons\sourcemod\script ing\hideteamchange.sp(11) : erro
r 130: cannot coerce functions to values
// C:\steamcmd\csgo\csgo\addons\sourcemod\script ing\hideteamchange.sp(29) : warn
ing 217: loose indentation
//
// 1 Error.
//
// Compilation Time: 0,08 sec
// ----------------------------------------

Press enter to exit ...
PHP Code:
#include <sourcemod>

public Plugin myinfo 
{
    
name "Remove Team Join Messages"
    
author "SM9"
};

public 
void OnPluginStart()
{
    
GetFunctionByName(PlayerTeam_Pre);
}

public 
Action PlayerTeam_Pre(Handle event, const char[] namebool dontBroadcast

        if(!
dontBroadcast
        { 
            
Handle new_event CreateEvent("player_team"true); 
             
            
SetEventInt(new_event"userid"GetEventInt(event"userid")); 
            
SetEventInt(new_event"team"GetEventInt(event"team")); 
            
SetEventInt(new_event"oldteam"GetEventInt(event"oldteam")); 
            
SetEventBool(new_event"disconnect"GetEventBool(event"disconnect")); 
             
            
FireEvent(new_eventtrue); 
             
            return 
Plugin_Handled
        } 
    return 
Plugin_Continue

'-_-'<3zok<3'-_-' is offline
Send a message via Skype™ to '-_-'<3zok<3'-_-'
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 00:07.


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