AlliedModders

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

Owyn 07-07-2010 05:21

how to block SendAudio?
 
i do
PHP Code:

register_messageget_user_msgid"SendAudio" ),"message_sendaudio" ); 

public 
message_sendaudiomsg_idmsg_destmsg_entity )
{
    static 
message[10];
    
get_msg_arg_string2messagesizeof message );

    switch( 
message[7] )
    {
        
// -- %!MRAD_terwin ; %!MRAD_ctwin ; %!MRAD_rounddraw
        
case 'c''t''r' : return end();
    }

    return 
PLUGIN_CONTINUE;
}

public 
end()
{
    
log_amx("blocked message");
    return 
PLUGIN_HANDLED;


we get "blocked message" and I don't hear "Terrorist Win" etc sounds but event is called

PHP Code:

register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw");

public 
end_round()
{
    
log_amx("is still called");


we get "is still called" =\

Brreaker 07-07-2010 12:41

Re: how to block SendAudio Event?
 
PHP Code:

register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw");

public 
end_round()
{
    return 
PLUGIN_HANDLED;



Owyn 07-07-2010 12:57

Re: how to block SendAudio Event?
 
have you tested before post?

Brreaker 07-07-2010 13:22

Re: how to block SendAudio Event?
 
No, but when you return PLUGIN_HANDLED on an event, you just block it :)

Owyn 07-07-2010 13:40

Re: how to block SendAudio Event?
 
No, it blocks nothing

ConnorMcLeod 07-07-2010 13:43

Re: how to block SendAudio Event?
 
Block a message doesn't block the corresponding event from being sent, you have to think to another way to do what you wanna do.

Owyn 07-07-2010 14:00

Re: how to block SendAudio Event?
 
"Block a message doesn't block" anything at all, even a message itself

1st plugin returns PLUGIN_HANDLED to event, 2nd plugin below 1st one still gets the event

ConnorMcLeod 07-07-2010 14:03

Re: how to block SendAudio Event?
 
Quote:

Originally Posted by Owyn (Post 1231094)
"Block a message doesn't block" anything at all, even a message itself

1st plugin returns PLUGIN_HANDLED to event, 2nd plugin below 1st one still gets the event


It actually blocks the sound from being sent, as a player you can't hear it.

Owyn 07-07-2010 14:21

Re: how to block SendAudio Event?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1231099)
It actually blocks the sound from being sent, as a player you can't hear it.

Actually it doesn't :crab: you still can hear it

that's why i tried working with messages

ConnorMcLeod 07-07-2010 15:55

Re: how to block SendAudio?
 
If you block a SendAudio message using register_message and returning PLUGIN_HANDLED, sound is not sent, that's what i wrote since the begining.

But events are called in plugins, that's what you noticed and you are right.

So, depending on what you want to do, you have to think differently.


All times are GMT -4. The time now is 07:06.

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