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

Solved how to block this MSGs ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 03-29-2017 , 13:14   how to block this MSGs ?
Reply With Quote #1

Hi, i try to block msg print
PHP Code:
   //register_message(get_user_msgid("SayText"), "msg_TextMsg");
   
register_messageget_user_msgid"TextMsg" ), "msg_TextMsg" );
public 
msg_TextMsgmsgiddestid )
{
   static 
text_msg128 ];
   
   
get_msg_arg_string2text_msgcharsmax(text_msg) );
   if (
contain(text_msg"* Can't change team to") != -|| contain(text_msg"* Server limits teams to") == 0)
      return 
PLUGIN_HANDLED
   
return PLUGIN_CONTINUE;
}
/*
// in HLSDK C++
   if ( !IsValidTeam( mdls ) )
   {
      int clientIndex = pPlayer->entindex();
      g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
      sprintf( text, "* Can't change team to \'%s\'\n", mdls );
      UTIL_SayText( text, pPlayer );
      sprintf( text, "* Server limits teams to \'%s\'\n", m_szTeamList );
      UTIL_SayText( text, pPlayer );
      return;
}
*/ 
But did not work?
__________________

Last edited by abdobiskra; 04-06-2017 at 10:42.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-29-2017 , 17:11   Re: how to block this MSGs ?
Reply With Quote #2

Then you debug it.

Code:
   register_message( get_user_msgid( "TextMsg" ), "msg_TextMsg" ); public msg_TextMsg( msgid, dest, id ) {    static text_msg[ 128 ];        get_msg_arg_string( 2, text_msg, charsmax(text_msg) );    server_print("msg_TextMsg(%d, %d, %d): %s", msgid, dest, id, text_msg);

I've never seen any message containing the strings you are comparing to.
* is not a placeholder matching "anything".
You're using the case-sensitive version of contain in which case "Can't" is probably wrong.
__________________

Last edited by Black Rose; 03-29-2017 at 17:13.
Black Rose is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-01-2017 , 09:26   Re: how to block this MSGs ?
Reply With Quote #3

Quote:
I've never seen any message containing the strings you are comparing to.
Yes its not Cs DLL in HL1

Quote:
You're using the case-sensitive version of contain in which case "Can't" is probably wrong.
what should i can do ? btw why " Can't" is wrong ?

i debug it .. i got other msg :
Quote:
==========================
msg_TextMsg(77, 2, 0): + ME! has joined the game

=======================
==========================
msg_TextMsg(77, 1, 7): #Spec_Mode3
=======================
==========================
msg_TextMsg(77, 2, 0): * ME! switched to spectator mode

=======================
==========================
msg_TextMsg(77, 1, 7): #Spec_Mode2
=======================
==========================
msg_TextMsg(77, 1, 7): Unknown command: -snipe

=======================
PHP Code:
public msg_TextMsg(msgiddestid)
{
    static 
textmsg[128];
    
get_msg_arg_string(2textmsg127);
    
    if(
equal(textmsg"Can't change team to") == 0
    
|| equal(textmsg"Server limits teams to") == 0
    
|| equal(textmsg"Model should be non-empty") == 0
    
|| equal(textmsg"Your current model remains") == 0)
    {
        
server_print("========================== ^nmsg_TextMsg(%d, %d, %d): %s ^n======================= "msgiddestidtextmsg);
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE;

__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-01-2017 , 12:51   Re: how to block this MSGs ?
Reply With Quote #4

You have to reproduce the messages that you want to hook so that you know exactly what they will contain.
Use containi() instead of contain() or equal()
__________________
Black Rose is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-01-2017 , 14:02   Re: how to block this MSGs ?
Reply With Quote #5

im try : containi() < --dos not work .... and contain() + equal() + equali()

the same thing (
Quote:
==========================
msg_TextMsg(77, 2, 0): + ME! has joined the game

=======================
==========================
msg_TextMsg(77, 1, 1): #Spec_Mode3
=======================
==========================
msg_TextMsg(77, 2, 0): * ME! switched to spectator mode

=======================
==========================
msg_TextMsg(77, 1, 1): Unknown command: -snipe

=======================
==========================
msg_TextMsg(77, 1, 1): #Spec_Mode3
=======================
==========================
msg_TextMsg(77, 1, 1): #Spec_Mode3
=======================
the code :
PHP Code:
public msg_TextMsgmsgiddestid )
{
    static 
text_msg128 ];
    
    
get_msg_arg_string2text_msgcharsmax(text_msg) );
    if (
equal(text_msg"Server limits teams to") != -)
    {
        
        
server_print("========================== ^nmsg_TextMsg(%d, %d, %d): %s ^n======================= "msgiddestidtext_msg);
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE;

and i try to chak :

PHP Code:
register_message(get_user_msgid("SayText"), "msg_TextMsg"
but it hiding all msg (chat + othere msgs)
__________________

Last edited by abdobiskra; 04-01-2017 at 14:05.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-01-2017 , 22:47   Re: how to block this MSGs ?
Reply With Quote #6

mp_limitteams "0"
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-02-2017 , 02:41   Re: how to block this MSGs ?
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
mp_limitteams "0"
Not available in Hl1
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-02-2017 , 05:08   Re: how to block this MSGs ?
Reply With Quote #8

The print goes outside and before the if-statement. Otherwise all you will be able to hook is what you already know.
You NEED containi(), nothing else will work unless you specify parameters to limit how much of the text is read.
Again, I have no idea what messages you want to remove, you have to reproduce them first.
__________________

Last edited by Black Rose; 04-02-2017 at 05:09.
Black Rose is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-02-2017 , 05:31   Re: how to block this MSGs ?
Reply With Quote #9

In fact, I did not understand what kind of messages I could specify, and was it another kind of message?
ex : i try to block this msg "switched to spectator mode" it don!
here the source client dll :
https://github.com/LevShisterov/Bugf...tor+mode&type=
and about othere msgs here :
https://github.com/LevShisterov/Bugf...teams+to&type=

I think it's not the same kind? Is it difficult to identify or not?
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-06-2017 , 10:42   Re: how to block this MSGs ?
Reply With Quote #10

thx to Lev aghl.ru for Help :

PHP Code:
public plugin_init() {
    
    
//register_message( get_user_msgid( "TextMsg" ), "msg_TextMsg" );
    
register_message(get_user_msgid("SayText"), "msg_TextMsg");
}


public 
msg_TextMsg(msg_idmsg_destmsg_entity)
{
   
server_print("************ ^nmsg_TextMsg(%d, %d, %d)^n************ "msg_idmsg_destmsg_entity);

   new 
dest get_msg_arg_int(1);
   
server_print("=================== ^ndest: %i^n=================== "dest);

   if (
dest != print_notify)
      return 
PLUGIN_CONTINUE;
   
   new 
text[1024];
   
get_msg_arg_string(2textcharsmax(text));
   
server_print("-------------------- ^ntext: %s^n----------------"text);

   if (
text[0] == '*' &&
   (
contain(text"Can't change team to") > ||
   
contain(text"Server limits teams to") > 0))
   {
      
server_print("-------------------- ^nPLUGIN_HANDLED^n----------------");
      return 
PLUGIN_HANDLED;
   }
   return 
PLUGIN_CONTINUE;

__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
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 11:50.


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