Raised This Month: $ Target: $400
 0% 

hook TextMsg, SayText


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hyphen
Senior Member
Join Date: Aug 2011
Old 06-17-2012 , 06:26   hook TextMsg, SayText
Reply With Quote #1

Below is a code snippet to block "Fire in the hole" message display from all players. Can you guys clear me out the followings:

MsgTextMsg(msgid, dest, id) - params are not being used in the function, so its not required, not sure
get_msg_args() != 5 - why checking 5 arguments to be returned
get_msg_arg_string(5, arg, sizeof arg - 1) - why getting the 5th argument
new caller = str_to_num(arg) - why message argument is converted to number and used as id.

PHP Code:
public plugin_init()
{
        
register_message(get_user_msgid("TextMsg"), "MsgTextMsg")
}

public 
MsgTextMsg(msgiddestid)
{
    if (
get_msg_args() != || get_msg_argtype(5) != ARG_STRING)
        return 
PLUGIN_CONTINUE
    
    
static arg[32]
    
get_msg_arg_string(5argsizeof arg 1)

    if (!
equal(arg"#Fire_in_the_hole"))
        return 
PLUGIN_CONTINUE
    
    get_msg_arg_string
(5argsizeof arg 1//if argument no is 2 is it possible to read the caller ?
    
new caller str_to_num(arg)
    if (!
is_user_alive(caller))
        return 
PLUGIN_CONTINUE
    
    
return PLUGIN_HANDLED


Last edited by hyphen; 06-17-2012 at 08:23.
hyphen is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-17-2012 , 06:34   Re: hook TextMsg, SayText
Reply With Quote #2

  1. Yes, it's not required to define those parameters if you aren't using them.
  2. It's possible for TextMsg to not have 5 arguments. In this certain case we need there to be 5.
  3. In this case the 5th argument has the string which we need to check. If it's "#Fire_in_the_hole" or not.
  4. It's some sort of a mistake.
hleV is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 06-17-2012 , 07:29   Re: hook TextMsg, SayText
Reply With Quote #3

Okay.

may I know what is the difference between SayText & TextMsg. What I found: to block #Fire_in_the_hole I need to hook TextMsg and for blocking #Cstrike_Name_Change use SayText. How to understand which message comes under what category.
hyphen is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 06-17-2012 , 08:16   Re: hook TextMsg, SayText
Reply With Quote #4

Tested the above code with some non-steam cs ver (not supporting non-steam, just tested) where "Fire in the hole" prints like:
Player @ CTSpawn (RADIO): Fire in the hole and didn't work. but with normal steam cs its working correctly because there it is only (RADIO): Fire in the hole. Is thise because of argument number matching ?

Last edited by hyphen; 06-17-2012 at 08:17.
hyphen is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-17-2012 , 08:22   Re: hook TextMsg, SayText
Reply With Quote #5

Quote:
Originally Posted by hyphen View Post
Tested the above code with some non-steam cs ver (not supporting non-steam, just tested) where "Fire in the hole" prints like:
Player @ CTSpawn (RADIO): Fire in the hole and didn't work. but with normal steam cs its working correctly because there it is only (RADIO): Fire in the hole. Is thise because of argument number matching ?
Non-Steam is shit. Who cares about it?
__________________
<VeCo> is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 06-17-2012 , 08:24   Re: hook TextMsg, SayText
Reply With Quote #6

Just want to know the concept how it works.
hyphen is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-17-2012 , 10:22   Re: hook TextMsg, SayText
Reply With Quote #7

Player @ CTSpawn (RADIO): Fire in the hole
This message is because the non steam version your using has some sort of bots addon (probably zbot) that's why the location is shown.

Also if you see this message:
(RADIO): Fire in the hole.
It has five arguments
1: (RADIO):
2: Fire
3: in
4: the
5: hole.

But this message:
Player @ CTSpawn (RADIO): Fire in the hole
has 7 or 8 parameters

I am not sure about this, but it could be

Last edited by n0br41ner; 06-17-2012 at 10:25.
n0br41ner is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-17-2012 , 10:38   Re: hook TextMsg, SayText
Reply With Quote #8

Quote:
Originally Posted by n0br41ner View Post
Player @ CTSpawn (RADIO): Fire in the hole
This message is because the non steam version your using has some sort of bots addon (probably zbot) that's why the location is shown.

Also if you see this message:
(RADIO): Fire in the hole.
It has five arguments
1: (RADIO):
2: Fire
3: in
4: the
5: hole.

But this message:
Player @ CTSpawn (RADIO): Fire in the hole
has 7 or 8 parameters

I am not sure about this, but it could be
BULLSHIT
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-17-2012 , 10:43   Re: hook TextMsg, SayText
Reply With Quote #9

Quote:
Originally Posted by n0br41ner
I am not sure about this, but it could be
:O im hurt
haha

Last edited by n0br41ner; 06-17-2012 at 10:46.
n0br41ner is offline
Old 06-17-2012, 10:56
ConnorMcLeod
This message has been deleted by ConnorMcLeod. Reason: hadn't see asking for nosteam support
bibu
Veteran Member
Join Date: Sep 2010
Old 06-17-2012 , 11:04   Re: hook TextMsg, SayText
Reply With Quote #10

He is right. AFAIK some non-steam version of 1.6 have also locations in the nav file.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu 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 06:07.


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