AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved] (https://forums.alliedmods.net/showthread.php?t=215437)

cstrike37 05-07-2013 19:13

[solved]
 
Hello!

Can someone tell me whats wrong here?

When the user the dies while holding a nade the 'Fire in the hole' sound plays without him even throwing the nade.

PHP Code:

public message()
{
    if(!
get_cvar_num("amx_custom_radio"))
        return 
PLUGIN_CONTINUE

    
if(get_msg_args() != || get_msg_argtype(2) != ARG_STRING || get_msg_argtype(4) != ARG_STRING)
    {
        return 
PLUGIN_CONTINUE
    
}

    new 
arg2[16]
    
get_msg_arg_string(2arg215)
    if(!
equal(arg2"#Game_radio"))
    {
        return 
PLUGIN_CONTINUE
    
}
    
    new 
arg4[20]
    
get_msg_arg_string(4arg419)
    if(
equal(arg4"#Fire_in_the_hole"))
    {
        
set_msg_arg_string(4CRfireinhole)
        return 
PLUGIN_CONTINUE
    
}
    
    return 
PLUGIN_CONTINUE
}

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

    new 
arg2[20]
    
get_msg_arg_string(2arg219)
    if(
equal(arg2[1], "!MRAD_FIREINHOLE"))
    {
            return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE
}

public 
grenade_throw(id,ent,wid

    if(!
get_cvar_num("amx_custom_radio")) 
        return 
PLUGIN_CONTINUE 
         
    
new players[32],totalteam_name[10]  
    
get_user_team(id,team_name9)  
    
get_players(playerstotal ,"ce"team_name// No bots and Match team name 
    
new name[32
    
get_user_name(id,name,31
    for(new 
a=0total; ++a
    {  
        
client_cmd(players[a], "spk radio/custom/ct_fireinhole.wav"
        if (
get_cvar_num("amx_real_radio"))   
        { 
        
emit_sound(idCHAN_VOICE"radio/custom/ct_fireinhole.wav" 0.9ATTN_STATIC0PITCH_NORM)   
        } 
    } 
    return 
PLUGIN_HANDLED 



ConnorMcLeod 05-07-2013 19:24

Re: Fire in the Hole sound
 
Try :

PHP Code:

public grenade_throw(id,ent,wid

    if(!
get_cvar_num("amx_custom_radio")) 
        return 
PLUGIN_CONTINUE 

I haven't checked, but player could still be considerated as alive when he dies and throw his nade.
Anyway, grenade_throw is not a smart way to change the sound.

Correct way would be to set it there :
PHP Code:

    new arg2[20]
    
get_msg_arg_string(2arg219)
    if(
equal(arg2[1], "!MRAD_FIREINHOLE"))
    {
            return 
PLUGIN_HANDLED
    


instead fo blocking, set the string to custom sound.

cstrike37 05-07-2013 19:57

Re: Fire in the Hole sound
 
Can you show an example? When I try no sounds are playing.

cstrike37 05-07-2013 20:57

Re: Fire in the Hole sound
 
Solved! Thanks anyways
I just did this
PHP Code:

if(!get_cvar_num("amx_custom_radio") || (!is_user_alive(id))) 



All times are GMT -4. The time now is 10:51.

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