AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved how to block this MSGs ? (https://forums.alliedmods.net/showthread.php?t=295565)

abdobiskra 03-29-2017 13:14

how to block this MSGs ?
 
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?

Black Rose 03-29-2017 17:11

Re: how to block this MSGs ?
 
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.

abdobiskra 04-01-2017 09:26

Re: how to block this MSGs ?
 
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;



Black Rose 04-01-2017 12:51

Re: how to block this MSGs ?
 
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()

abdobiskra 04-01-2017 14:02

Re: how to block this MSGs ?
 
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)

Natsheh 04-01-2017 22:47

Re: how to block this MSGs ?
 
mp_limitteams "0"

abdobiskra 04-02-2017 02:41

Re: how to block this MSGs ?
 
Quote:

Originally Posted by Natsheh (Post 2508697)
mp_limitteams "0"

Not available in Hl1

Black Rose 04-02-2017 05:08

Re: how to block this MSGs ?
 
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.

abdobiskra 04-02-2017 05:31

Re: how to block this MSGs ?
 
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 04-06-2017 10:42

Re: how to block this MSGs ?
 
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;




All times are GMT -4. The time now is 17:50.

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