AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sounds Not Playing (https://forums.alliedmods.net/showthread.php?t=296468)

Copper 04-21-2017 19:15

Sounds Not Playing
 
Code:

#include <amxmodx>

new T_Win[][] =
{
        "stealsounds/twin"
}

new I_Win[][] =
{
        "stealsounds/Iwin"
}

public plugin_init ( )
{
        register_plugin ( "New Steal C4", "1.0", "Copper" );
        register_event( "SendAudio", "eT_win" , "a", "2&%!MRAD_terwin" );
        register_event( "SendAudio", "eCT_win", "a", "2&%!MRAD_ctwin"  );
}

public eT_win(id)
{
        if(is_user_alive(id) && is_user_connected(id) )
        {
                client_cmd(0,"spk ^"%s^"",T_Win[random_num(0,sizeof T_Win - 1)])       
        }
}


public eCT_win(id)
{
        if(is_user_alive(id) && is_user_connected(id) )
        {                               
                client_cmd(0,"spk ^"%s^"",I_Win[random_num(0,sizeof I_Win - 1)])               
        }
}

public plugin_precache( )
{
        precache_sound ( "stealsounds/Iwin.wav" );
        precache_sound ( "stealsounds/twin.wav" );
}

Can anyone tell me what I did wrong? I am editing the stealc4 plugin and I want to be able to play a sound after the round is over. I am not going to post the whole plugin because this is the only part that isn't working properly.

OciXCrom 04-21-2017 20:12

Re: Sounds Not Playing
 
If you post the code, it would be possible.

Copper 04-21-2017 20:23

Re: Sounds Not Playing
 
Updated post.

EFFx 04-21-2017 20:51

Re: Sounds Not Playing
 
1. Put .wav sufix at the constants

2.
Code:
public plugin_precache( ) {     precache_sound (T_Win);     precache_sound (I_Win); }

3.There's no ID at T_win and I_Win events, you must loop all players with get_players().

Copper 04-21-2017 20:59

Re: Sounds Not Playing
 
Quote:

Originally Posted by EFFx (Post 2514179)
1. Put .wav sufix at the constants

2.
Code:
public plugin_precache( ) {     precache_sound (T_Win);     precache_sound (I_Win); }

3.There's no ID at T_win and I_Win events, you must loop all players with get_players().

For 1&2 Weird. I have different sounds playing for other parts of the plugin and I didn't add the .wav suffix and they are working just fine.
3. Oh crap, I forgot to add the id

edon1337 04-22-2017 05:17

Re: Sounds Not Playing
 
Firstly, what isn't working? How can we know what's wrong if you just say 'what am I doing wrong' ? Why are you checking both is_user_alive and is_user_connected, is_user_alive already does the connected check.


All times are GMT -4. The time now is 19:05.

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