Raised This Month: $ Target: $400
 0% 

Blocking messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-19-2006 , 19:36   Blocking messages
Reply With Quote #1

I'm trying to block a message but it doesn't seem to be working:
Code:
register_message(get_user_msgid("TextMsg") , "block_message");
Code:
public block_message(msg_id , msg_dest , msg_ent) {     new const count = get_msg_args();     for(new i = 0; i < count; i++) {         if(get_msg_argtype(i) == ARG_STRING) {             new value[64];             get_msg_arg_string(i , value , 63);             if(equal(value , "#Cannot_Carry_Anymore")) {                 return PLUGIN_HANDLED;             }         }     }     return PLUGIN_CONTINUE; }
A solution would be appreciated. Thanks
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Petey B
Member
Join Date: Feb 2005
Old 02-19-2006 , 19:56  
Reply With Quote #2

this is just a guess but cant u have only one center_print message at once. so when u give a client a grenade just do a center_print message with " ". that should replace the one in the centre of the screen so it appears blank
Petey B is offline
Send a message via MSN to Petey B
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-19-2006 , 20:26  
Reply With Quote #3

Yeah, that's what I had planned originally. I just want to know why that code doesn't work ( for future reference ).
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 02-19-2006 , 20:44  
Reply With Quote #4

Quote:
Originally Posted by v3x
( for future reference ).
for future reference use print_center

lol jk
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
BAILOPAN
Join Date: Jan 2004
Old 02-19-2006 , 21:33  
Reply With Quote #5

are you sure that the PLUGIN_HANDLED is being hit?
__________________
egg
BAILOPAN is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-19-2006 , 21:55  
Reply With Quote #6

Code:
public block_message(msg_id , msg_dest , msg_ent) {     new const count = get_msg_args();     for(new i = 0; i < count; i++) {         if(get_msg_argtype(i) == ARG_STRING) {             new value[64];             get_msg_arg_string(i , value , 63);             if(equal(value , "#Cannot_Carry_Anymore")) {                 log_amx("Nade message reached and blocked");                 return PLUGIN_HANDLED;             }         }     }     return PLUGIN_CONTINUE; }
Nothing in the logs so I guess not. Anyone know what's wrong?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 02-19-2006 , 21:58  
Reply With Quote #7

Yikes! Take your variable declaration out of the loop.
Brad is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 02-19-2006 , 21:59  
Reply With Quote #8

Code:
public block_message(msg_id , msg_dest , msg_ent) {     new const count = get_msg_args();     for(new i = 0; i < count; i++) {         if(get_msg_argtype(i) == ARG_STRING) {             new value[64];             get_msg_arg_string(i , value , 63);             client_print(0,print_chat,"%s",value)             if(equal(value , "#Cannot_Carry_Anymore")) {                 return PLUGIN_HANDLED;             }         }     }     return PLUGIN_CONTINUE; }

See if the value matches #Cannot_Carry_Anymore.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 02-19-2006 , 22:00  
Reply With Quote #9

Along the same train of thought, print out the arg count and arg type values so that you know you're receiving what you're expecting.
Brad is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-19-2006 , 22:16  
Reply With Quote #10

Hmm, I can't seem to reproduce this message...

Edit: Started logging of TextMsg with DS's plugin and got this:
Quote:
L 02/19/2006 - 22:20:28: [msglogging.amxx] MessageBegin TextMsg(77) Arguments=2 Destination=One(1) Origin={0.000000 0.000000 0.000000} Entity=1 Classname=player Netname=ghw L 3 n N ! N G z ^ ^
L 02/19/2006 - 22:20:28: [msglogging.amxx] Arg 1 (Byte): 4
L 02/19/2006 - 22:20:28: [msglogging.amxx] Arg 2 (String): #Cannot_Carry_Anymore
L 02/19/2006 - 22:20:28: [msglogging.amxx] MessageEnd TextMsg(77)
But it only does it for him (he's the only admin on if that matters). I think that may be a bug within DS's plugin.

Quote:
Originally Posted by On round start a few times
amx_exec @ALL hegren
Current code:
Code:
public block_message(msg_id , msg_dest , msg_ent) {     new const count = get_msg_args();     for(new i = 0; i < count; i++) {         if(get_msg_argtype(i) == ARG_STRING) {             new value[64];             get_msg_arg_string(i , value , 63);             log_amx("[%i] Message string: %s | Arg count: %i" , i , value , count);             if(equal(value , "#Cannot_Carry_Anymore")) {                 log_amx("Nade message reached and blocked");                 return PLUGIN_HANDLED;             }         }     }     return PLUGIN_CONTINUE; }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 20:17.


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