AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking Fire in the hole sound and text (https://forums.alliedmods.net/showthread.php?t=29293)

Cheap_Suit 06-02-2006 16:25

Blocking Fire in the hole sound and text
 
I tryed this, but i never got a print out

Code:
public msg_text() {     if(get_msg_args() != 5 || get_msg_argtype(3) != ARG_STRING || get_msg_argtype(5) != ARG_STRING) {         return PLUGIN_CONTINUE     }     new arg3[16]     get_msg_arg_string(3, arg3, 15)     if(!equal(arg3, "#Game_radio")) {         return PLUGIN_CONTINUE     }     new arg5[20]     get_msg_arg_string(5, arg5, 19)     if(equal(arg5, "#Fire_in_the_hole"))     {         client_print(0, print_chat, "blocked")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
and what about the sound?

Hawk552 06-02-2006 16:27

Did you try catching EmitSound?

Cheap_Suit 06-02-2006 16:35

I dont think the fire in the hole is emitted

Bo0m! 06-02-2006 16:49

1 Attachment(s)
The he arena plugin has a block for 'fire in the hole' and it works rather well, maybe you can find what your looking for in it.

Cheap_Suit 06-02-2006 16:57

I think register_message is broken. I tryed that with my plugin and didnt work. I also tryed the plugin, also didnt block the sound & text.

Thanks anyways

VEN 06-03-2006 12:32

It's not broken. This works (tested):
Code:
public plugin_init() {     register_message(get_user_msgid("TextMsg"), "msg_text")     register_message(get_user_msgid("SendAudio"), "msg_audio") } public msg_text() {     if(get_msg_args() != 5 || get_msg_argtype(3) != ARG_STRING || get_msg_argtype(5) != ARG_STRING) {         return PLUGIN_CONTINUE     }     new arg3[16]     get_msg_arg_string(3, arg3, 15)     if(!equal(arg3, "#Game_radio")) {         return PLUGIN_CONTINUE     }     new arg5[20]     get_msg_arg_string(5, arg5, 19)     if(equal(arg5, "#Fire_in_the_hole"))     {         client_print(0, print_chat, "Text blocked")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public msg_audio() {     if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING) {         return PLUGIN_CONTINUE     }     new arg2[20]     get_msg_arg_string(2, arg2, 19)     if(equal(arg2[1], "!MRAD_FIREINHOLE"))     {         client_print(0, print_chat, "Audio blocked")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

Cheap_Suit 06-03-2006 16:02

Thanks for the confirmation. Anyways the audio blocking is successful. But the text one failed. I had to get DS's Message Logging to fix this for myself. I found out that im getting different arguments from the one im checking. Is this only happening to me?

Code:
L 06/03/2006 - 12:56:19: Arg 1 (Byte "3") L 06/03/2006 - 12:56:19: Arg 2 (String "#Game_radio") L 06/03/2006 - 12:56:19: Arg 3 (String "Cheap_Suit") L 06/03/2006 - 12:56:19: Arg 4 (String "#Fire_in_the_hole") L 06/03/2006 - 12:56:19: MessageEnd (TextMsg "77")


BTW Thanks VEN :)

cigs 08-23-2006 17:55

Re: Blocking Fire in the hole sound and text
 
It think it only happened to you, Cheap_Suit, cause it works just fine.

Now, I need some help with what I additionally tried to add in this plugin.
I added a custom sound (hepin.wav) sounding like a pin that is getting pulled out of the nade.

Here's what I made from it:

Code:

/*
Fire In The Hole Blocker
*/

#include <amxmodx>

#define PLUGIN "FITHBlocker"
#define VERSION "1.0"
#define AUTHOR "VEN & Cheap_Suit"

#define SOUND_HEPIN "misc/hepin.wav"

public plugin_init()
{
    register_plugin(PLUGIN,VERSION,AUTHOR)
    register_message(get_user_msgid("TextMsg"), "msg_text")
    register_message(get_user_msgid("SendAudio"), "msg_audio")
}


public msg_text()
{
    if(get_msg_args() != 5 || get_msg_argtype(3) != ARG_STRING || get_msg_argtype(5) != ARG_STRING) {
        return PLUGIN_CONTINUE
    }

    new arg3[16]
    get_msg_arg_string(3, arg3, 15)
    if(!equal(arg3, "#Game_radio")) {
        return PLUGIN_CONTINUE
    }

    new arg5[20]
    get_msg_arg_string(5, arg5, 19)
    if(equal(arg5, "#Fire_in_the_hole")) {
            return PLUGIN_HANDLED
    }

    return PLUGIN_CONTINUE
}

public msg_audio()
{
    if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING) {
        return PLUGIN_CONTINUE
    }

    new arg2[20]
    get_msg_arg_string(2, arg2, 19)
    if(equal(arg2[1], "!MRAD_FIREINHOLE"))
    {
        client_cmd(0,"spk %s", SOUND_HEPIN)
        return PLUGIN_HANDLED
    }

    return PLUGIN_CONTINUE
}

As you can see I added
Code:

#define SOUND_HEPIN "misc/hepin.wav"
and
Code:

client_cmd(0,"spk %s", SOUND_HEPIN)
This innitially works.
- But for some reason it doesn't work for some players ingame and it does for others
- And secondly, after about 15 minutes, people (including me) are getting sound problems on the server. (an echo-like soundproblem)
PS: I got confirmed by several people they've download the hepin.wav file

Is there anything wrong with what I added/did?

SweatyBanana 08-23-2006 18:08

Re: Blocking Fire in the hole sound and text
 
try typing room_type 00 in console.

cigs 08-23-2006 18:33

Re: Blocking Fire in the hole sound and text
 
So far so good. Though room_type was allready default on 0. So I've put it on 00. Don't know if that makes any diference.

Haven't tested with other players yet. That will be for tomorow.
Got my thumbs up. :up:

Thx


All times are GMT -4. The time now is 16:34.

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