AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [HELP] Replacing "Fire In The Hole" (https://forums.alliedmods.net/showthread.php?t=292900)

hellmonja 01-17-2017 12:24

[HELP] Replacing "Fire In The Hole"
 
Like the title says, that's all I want to do. It seems simple enough but for some reason it doesn't work. When I remove the codes for the custom messages it works but when it's there it doesn't do anything, not even block the original sound.
PHP Code:

public Message_Audio(msg_idmsg_destmsg_entity)
{
    if(
get_msg_args() != || get_msg_argtype(2) != ARG_STRING)
        return 
PLUGIN_CONTINUE


    
new arg2[20], wpn get_user_weapon(msg_entity);
    
get_msg_arg_string(2arg219);
    
    if(
equal(arg2[1], "!MRAD_FIREINHOLE"))
    {

        if(
wpn == CSW_HEGRENADE)
        {
            
emessage_begin(MSG_ONE_UNRELIABLEg_iMsgSendAudio_msg_entity);
            
ewrite_byte(msg_entity);
            
ewrite_string(grenade_snds[random_num(01)]);
            
ewrite_short(PITCH_NORM);
            
emessage_end();
        }
        
        return 
PLUGIN_HANDLED

    
}

    return 
PLUGIN_CONTINUE


I've checked the API, the forums, some Russian sites I had to translate, and everything I could think of to google. I just want some help. Please don't make feel a lot more stupid than I already am...

EFFx 01-17-2017 13:21

Re: [HELP] Replacing "Fire In The Hole"
 
I have posted this for a member here - https://forums.alliedmods.net/showpo...66&postcount=5

This have what u want

HamletEagle 01-17-2017 15:57

Re: [HELP] Replacing "Fire In The Hole"
 
Why are you using emessage?

PartialCloning 01-18-2017 20:14

Re: [HELP] Replacing "Fire In The Hole"
 
Your code works for me.

hellmonja 01-19-2017 03:06

Re: [HELP] Replacing "Fire In The Hole"
 
Quote:

Originally Posted by HamletEagle (Post 2487494)
Why are you using emessage?

Perhaps not the best version that I should have posted here. I already have a number of versions of this plugin and as it turns out this the latest I was working on. But they all behave in a similar way: Anything I put before the "PLUGIN_HANDLED" line cancels out any effect the plugin has, even the effect of blocking the default radio sound.

Quote:

Originally Posted by PartialCloning (Post 2487889)
Your code works for me.

Interesting. Then I should reinstall a fresh copy of vanilla CS and test it there. This CS I use for testing has seen countless plugins already...

PartialCloning 01-19-2017 06:56

Re: [HELP] Replacing "Fire In The Hole"
 
emessage_begin means it'll be sent to other plugins, most likely you have other plugins blocking it. Try it without the e, message_begin, write_byte ..etc

hellmonja 01-21-2017 13:11

Re: [HELP] Replacing "Fire In The Hole"
 
It worked! Thanks! Sorry it took the weekend to get back here. But I did a clean install of CS. Now it's working as it should. Thanks again...


All times are GMT -4. The time now is 20:42.

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