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

[CS:GO] surpressing event "player_team" will lead to not closing the teamselect page


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 08-25-2018 , 04:48   [CS:GO] surpressing event "player_team" will lead to not closing the teamselect page
Reply With Quote #1

This is a thing since PanormaUI.

I'm using this code:
Code:
public void OnPluginStart()
{
    HookEvent("player_team", PlayerTeam_Pre, EventHookMode_Pre)
}

public Action PlayerTeam_Pre(Handle event, const char[] name, bool dontBroadcast)
{
    SetEventBroadcast(event,true);
    return Plugin_Continue;
}
Is there any way to surpress the message "PlayerXY is joining the Counter-Terrorist force", without disturbing the PanoramaUI of the client?
fragnichtnach is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-25-2018 , 06:19   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #2

PHP Code:
public void OnPluginStart()
{
    
HookUserMessage(GetUserMessageId("TextMsg"), Event_TextMsgtrue);
}

public 
Action Event_TextMsg(UserMsg msg_idBfRead msg, const int[] playersint playersNumbool reliablebool init)
{
    
char Text[64];
    
PbReadString(msg"params"Textsizeof(Text), 0);
    
    if(
StrContains(Text"SavePlayer") != -1// change saveplayer with your pattern
    
{
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;


Last edited by Ilusion9; 08-25-2018 at 06:19.
Ilusion9 is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 08-25-2018 , 07:03   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #3

Thanks, but it didn't work out.

Code:
public void OnPluginStart()
{
    HookUserMessage(GetUserMessageId("TextMsg"), Event_TextMsg, true);
}

public Action Event_TextMsg(UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init)
{
    char Text[128];
    PbReadString(msg, "params", Text, sizeof(Text), 0);
    
    if(StrContains(Text, "is joining the Counter-Terrorist force") != -1) // change saveplayer with your pattern
    {
        return Plugin_Handled;
    }
    else if(StrContains(Text, "is joining the Terrorist force") != -1) // change saveplayer with your pattern
    {
        return Plugin_Handled;
    }
    else if(StrContains(Text, "is joining the Spectators") != -1) // change saveplayer with your pattern
    {
        return Plugin_Handled;
    }
    return Plugin_Continue;
}
Still getting the messages! Is my code correct?

(Also I think there would be a problem for people who are running the game not in English.)
fragnichtnach is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-25-2018 , 07:18   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #4

PHP Code:

#Cstrike_game_join_spectators
#Cstrike_game_join_terrorist
#Cstrike_game_join_ct 
PHP Code:

    
if(StrContains(Text"Cstrike_game_join_") != -1)
    {
        return 
Plugin_Handled;
    } 
or

PHP Code:

    
if(StrEqual(Text"#Cstrike_game_join_ct") != -1)
    {
        return 
Plugin_Handled;
    }

    if(
StrEqual(Text"#Cstrike_game_join_terrorist") != -1)
    {
        return 
Plugin_Handled;
    }

    if(
StrEqual(Text"#Cstrike_game_join_spectators") != -1)
    {
        return 
Plugin_Handled;
    } 
Ilusion9 is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 08-25-2018 , 08:28   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #5

I've tried this. Still don't get it!
I am not sure, if I am able to surpress the message without not sending the event. The message might be client related. Would htat be possible?

Code:
#include <sourcemod>
#include <cstrike>

/*
#Cstrike_game_join_spectators
#Cstrike_game_join_terrorist
#Cstrike_game_join_ct
*/

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

public Action Event_TextMsg(UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init)
{
    char Text[128];
    PbReadString(msg, "params", Text, sizeof(Text), 0); 
    if(StrContains(Text, "#Cstrike_game_join_") != -1) // change saveplayer with your pattern
    {
        return Plugin_Handled;
    }
    return Plugin_Continue;
}
fragnichtnach is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 08-25-2018 , 10:11   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #6

Just finished my analyse:
HookUserMessage is not hooking the joing-team-messages!
fragnichtnach is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-25-2018 , 11:36   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #7

https://forums.alliedmods.net/showth...e_game_join_ct
Ilusion9 is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-25-2018 , 13:25   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #8

Quote:
Originally Posted by Ilusion9 View Post
this working for you?
Indarello is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 08-26-2018 , 02:54   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #9

No, the following code didn't worked out:
Code:
#include <sourcemod>

public void OnPluginStart()
{
    HookEvent("player_team", PlayerTeam_Pre, EventHookMode_Pre);
}
public Action PlayerTeam_Pre(Handle event, const char[] name, bool 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_event, true);
        return Plugin_Handled;
    }
    return Plugin_Continue;
}
The message was deleted, but
  1. The Team-Choose-Screen didn't close!
  2. The server crashed shortly after choosing a team!

edit: Just want to say thanks to illusion9 for all the suggestions, also it is not fixing the problem untill now.

Last edited by fragnichtnach; 08-26-2018 at 04:13.
fragnichtnach is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-28-2018 , 12:59   Re: [CS:GO] surpressing event "player_team" will lead to not closing the teamselect p
Reply With Quote #10

PHP Code:

HookEvent
("player_team"Event_PlayerTeamEventHookMode_Pre);

public 
Action Event_PlayerTeam(Event event, const char[] namebool dontBroadcast
{
    if(!
event.GetBool("disconnect"))
        
event.SetBool("silent"true);


Last edited by Ilusion9; 08-28-2018 at 17:09.
Ilusion9 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 19:48.


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