Raised This Month: $ Target: $400
 0% 

hook TextMsg, SayText


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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