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

[CSGO] Trade Messages in game


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joshtrav
Senior Member
Join Date: Sep 2009
Old 01-17-2015 , 13:46   [CSGO] Trade Messages in game
Reply With Quote #1

Has anyone found where the derive from?

I am trying to block them as folks like to just trade each other 20 items at a time flooding the chat window. I have hooked TextMsg, SayText, and SayText2 so far with no luck.

Code:
public OnPluginStart()
{
    HookUserMessage(GetUserMessageId("TextMsg"), TextMsgHook, true);
    HookUserMessage(GetUserMessageId("SayText"), SayMsgHook, true);
    HookUserMessage(GetUserMessageId("SayText2"), TextMsgHook, true);
    HookEvent("items_gifted", OnItemFound, EventHookMode_Pre);
}

public Action:TextMsgHook(UserMsg:msg_id, Handle:pb, const players[], playersNum, bool:reliable, bool:init) 
{ 
    new String:buffer[1028];
    PbReadString(pb, "params", buffer, sizeof(buffer), 1);
    PrintToServer("%s", buffer);

    new String:buffer2[1028];
    PbReadString(pb, "params", buffer2, sizeof(buffer2), 0);
    PrintToServer("%s", buffer2);
    
    new String:buffer3[1028];
    PbReadString(pb, "params", buffer3, sizeof(buffer3), 2);
    PrintToServer("%s", buffer3);
    
    new String:buffer4[1028];
    PbReadString(pb, "params", buffer4, sizeof(buffer4), 3);
    PrintToServer("%s", buffer4);

    return Plugin_Continue; 
}

public Action:SayMsgHook(UserMsg:msg_id, Handle:pb, const players[], playersNum, bool:reliable, bool:init) 
{ 
    new String:buffer[1028];
    PbReadString(pb, "text", buffer, sizeof(buffer));
    PrintToServer("%s", buffer);
    
    return Plugin_Continue; 
}
Hopefully someone else has a way as I would love to block these notifications.

I have also tried disabling broadcast on the following events:
item_found, items_gifted
__________________

joshtrav is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-17-2015 , 14:13   Re: [CSGO] Trade Messages in game
Reply With Quote #2

Not tested, but works with money messages:
PHP Code:
#include <sourcemod>

public Plugin:myinfo 
{
  
name "NoItemMessagesInChat",
  
author "Raska",
  
description "",
  
version "0.1"
};

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

public 
Action:Hook_TextMsg(UserMsg:iMsgIdHandle:hMsg, const iPlayers[], iPlayersNumbool:bReliablebool:bInit)
{
    new 
String:sBuffer[512];
    
    if (
GetUserMessageType() == UM_Protobuf) {
        
PbReadString(hMsg"params"sBuffersizeof(sBuffer), 0);
    } else {
        
BfReadString(hMsgsBuffersizeof(sBuffer), false);
    }
    
    if (
StrContains(sBuffer"Item_") != -|| StrContains(sBuffer"NewItemMethod_") != -)
        return 
Plugin_Handled;
    
    return 
Plugin_Continue;


Last edited by KissLick; 01-17-2015 at 14:16.
KissLick is offline
joshtrav
Senior Member
Join Date: Sep 2009
Old 01-17-2015 , 15:39   Re: [CSGO] Trade Messages in game
Reply With Quote #3

This is for purchased items in CSGO?

Currently I am printing to console all messages in the "params" field with indices 0-3, and not seeing any messages coming in.

I am trying to stop this " joshtrav has received in trade: G3SG1 | Jungle Dashed", and other similar messages. I attempted to buy that off the market just to see if it showed versus the standard trade messages, and it did not in the console.
__________________

joshtrav is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-17-2015 , 15:54   Re: [CSGO] Trade Messages in game
Reply With Quote #4

Yep, it should stop these:
Code:
"Item_Found"                            " %s1 has found: %s2"
"Item_Crafted"                            " %s1 has fulfilled a contract and received: %s2"
"Item_Traded"                            " %s1 has received in trade: %s2"
"Item_Purchased"                        " %s1 has purchased: %s2"
"Item_FoundInCrate"                        " %s1 has opened a container and found: %s2"
"Item_Gifted"                            " %s1 has accepted a gift: %s2"
"Item_Earned"                            " %s1 has earned: %s2"
"Item_Refunded"                            " %s1 has been refunded: %s2"
"Item_GiftWrapped"                        " %s1 has wrapped a gift: %s2"
"Item_PeriodicScoreReward"                " %s1 has earned: %s2"
"Item_Named"                            " %s1 has renamed their %s2 to %s3"

"Item_GiftsSent1Anon"                    " %s1 has given out a gift!"
"Item_GiftsSent1Name"                    " %s1 has given out a gift, delivered to %s2!"
"Item_GiftsSentMany"                    " %s1 has given out %s2 gifts!"
"Item_GiftsYouSentGift"                    " Your gift was delivered to %s1!"
"Item_GiftsYouGotGift"                    " You got a gift from %s1! The gift is now in your inventory waiting to be acknowledged."

"Item_NotConnected"                        "You must be in a match to use this item!"
"Item_Need2Players"                        "There must be other players in your match to use this item!"
"Item_NeedSpectators"                    "There must be viewers watching your match to use this item!"

"Item_GiftNoPlayers"                    "There are no other players present in your current game to receive your gift!"
"Item_GiftedItems"                        "%s1 has given a gift to %s2!"
"Item_GifterText_Random"                "%recipient% was selected at random to receive a gift from %giver%!"
"Item_GifterText_All"                    "%giver% has given out a bunch of gifts!"
"Item_GifterText_SelfOpen"                "%giver% has opened a package!"

"Item_Received_Event_Local"                    "    You have received: %s1!"

"NewItemMethod_Dropped"            "You Found:"
"NewItemMethod_Crafted"            "You Received:"
"NewItemMethod_Traded"            "You Traded for:"
"NewItemMethod_Purchased"        "You Purchased:"
"NewItemMethod_FoundInCrate"    "You Unboxed:"
"NewItemMethod_Gifted"            "You Received a Gift:"
"NewItemMethod_Promotion"        "You Received a Store Promotion Item:"
"NewItemMethod_Earned"            "You Earned:"
"NewItemMethod_Refunded"        "You Were Refunded:"
"NewItemMethod_Support"            "Customer Support Granted You:"
"NewItemMethod_PreviewItemPurchased"    "You Purchased:"
"NewItemMethod_PeriodicScoreReward"        "You Earned:"
"NewItemMethod_CommunityMarketPurchase"    "You Received from the Community Market:"
KissLick is offline
joshtrav
Senior Member
Join Date: Sep 2009
Old 01-17-2015 , 18:34   Re: [CSGO] Trade Messages in game
Reply With Quote #5

Here is what I have.

It should do exactly what your posted code is doing, but the message still come through. I have no error logs referenced from the file as well. This is starting to drive me nuts, lol!

Code:
public OnPluginStart()
{
    decl String:GameType[50];
    GetGameFolderName(GameType, sizeof(GameType));
    if(StrEqual(GameType, "csgo", false))
    {
        HookUserMessage(GetUserMessageId("TextMsg"), TextMsgHook, true);
    }
}

public Action:TextMsgHook(UserMsg:msg_id, Handle:pb, const players[], playersNum, bool:reliable, bool:init) 
{ 
    new String:buffer[512];
    for (new i = 0; i < 4; i++)
    {
        PbReadString(pb, "params", buffer, sizeof(buffer), i);
        if(IsTextSpam(buffer))
            return Plugin_Handled;
    }
    return Plugin_Continue; 
}


public IsTextSpam(const String:buffer[])
{
    if(StrContains(buffer, "#SFUI_WPNHUD_", false) != -1)
        return true;
    if(StrContains(buffer, "#Chat_Save", false) != -1)
        return true;
    if(StrContains(buffer, "Item_") != -1)
        return true;
    if(StrContains(buffer, "NewItemMethod_") != -1 )
        return true;
    return false;
}
__________________


Last edited by joshtrav; 01-17-2015 at 18:34.
joshtrav is offline
joshtrav
Senior Member
Join Date: Sep 2009
Old 01-17-2015 , 21:07   Re: [CSGO] Trade Messages in game
Reply With Quote #6

Tried some other options with <wCPO>'s help, and came up with this which will block all trade messages:

Code:
public OnPluginStart()
{
    HookUserMessage(GetUserMessageId("SendPlayerItemFound"), ItemFoundMsg, true);
}

public Action:ItemFoundMsg(UserMsg:msg_id, Handle:pb, const players[], playersNum, bool:reliable, bool:init) 
{
    return Plugin_Handled;
}
__________________

joshtrav 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 23:44.


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