AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   no sounds are played (https://forums.alliedmods.net/showthread.php?t=325765)

anakonda001 07-05-2020 16:57

no sounds are played
 
help guys, sounds are not played, downloaded but not played in the game, what is wrong with the plugin?
Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <reapi>

new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;

new const DropTheBomb[] = "DropTheBomb.wav" //
new const PickedUpTheBomb[] = "PickedUpTheBomb.wav" //

public plugin_init() {
    register_plugin( "Bomb Hat", "1.0", "Subb98" );
    register_logevent("EventPickedUpTheBomb", 3, "2=Spawned_With_The_Bomb", "2=Got_The_Bomb");
    register_logevent("EventDropTheBomb", 3, "2=Dropped_The_Bomb", "2=Planted_The_Bomb");
    register_cvar("bomb_hat", "1.2", FCVAR_SERVER);
    g_Enable = register_cvar("amx_bombhat", "1");
    RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawn");
    RegisterHam(Ham_Killed, "player", "fwHamPlayerKilledPost", 1);
    g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}

public plugin_precache() {
    precache_model("models/sombreroos.mdl");
    precache_sound(DropTheBomb)
    precache_sound(PickedUpTheBomb)
}

public EventPickedUpTheBomb() {
    new id = get_loguser_index();
    if(pev_valid(g_bwEnt[id])) {
        set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) & ~EF_NODRAW);
       
        rg_send_audio(id, fmt("sound/%s", PickedUpTheBomb));
    }
}

public EventDropTheBomb() {
    new id = get_loguser_index();
    if(pev_valid(g_bwEnt[id])) {
        set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) | EF_NODRAW);
       
        rg_send_audio(id, fmt("sound/%s", DropTheBomb));
    }
}

public fwHamPlayerSpawn( const player ) {
    if ( get_pcvar_num( g_Enable ) && is_user_alive( player ) ) {
        new iEnt = g_bwEnt[ player ];
        if( !pev_valid( iEnt ) ) {
            g_bwEnt[ player ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget );
            set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW );
            set_pev( iEnt, pev_aiment, player );
            set_pev( iEnt, pev_effects, pev(iEnt, pev_effects) | EF_NODRAW);
            engfunc( EngFunc_SetModel, iEnt, "models/sombreroos.mdl" );
        }
        else set_pev( iEnt, pev_effects, pev(iEnt, pev_effects) | EF_NODRAW);
    }
}

public fwHamPlayerKilledPost(const id) {
    if(pev_valid(g_bwEnt[id])) {
        set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) | EF_NODRAW);
    }
}

stock get_loguser_index() { // author: VEN
    new loguser[80], name[32];
    read_logargv(0, loguser, 79);
    parse_loguser(loguser, name, 31);
    return get_user_index(name);
}


anakonda001 07-06-2020 06:36

Re: no sounds are played
 
help please

DJEarthQuake 07-06-2020 07:45

Re: no sounds are played
 
Code:

new const PickedUpTheBomb[] = "PickedUpTheBomb.wav" //
File path is missing.

OciXCrom 07-06-2020 08:48

Re: no sounds are played
 
Quote:

Originally Posted by DJEarthQuake (Post 2708867)
Full directory path is not showing in the script.
IE| "sound/misc/PickedUpTheBomb.wav"

The "sound" directory is not needed when precaching.

anakonda001 07-06-2020 13:41

Re: no sounds are played
 
Quote:

Originally Posted by DJEarthQuake (Post 2708867)
Code:

new const PickedUpTheBomb[] = "PickedUpTheBomb.wav" //
File path is missing.

I spelled out the path there, the name of the sound, but it doesn't play

anakonda001 07-06-2020 13:43

Re: no sounds are played
 
Quote:

Originally Posted by OciXCrom (Post 2708878)
The "sound" directory is not needed when precaching.

I do not understand you, I need to prescribe this path to the sound " sound / misc/

DJEarthQuake 07-06-2020 13:43

Re: no sounds are played
 
The files are in the sound folder?

DJEarthQuake 07-06-2020 13:46

Re: no sounds are played
 
Quote:

Originally Posted by anakonda001 (Post 2708925)
I do not understand you, I need to prescribe this path to the sound " sound / misc/

He's right. I truncated what I originally had and should have left it early this morning. Everything is relative to the sound directory using precache_sound.

https://www.amxmodx.org/api/amxmodx/precache_sound

anakonda001 07-06-2020 13:54

Re: no sounds are played
 
Quote:

Originally Posted by DJEarthQuake (Post 2708926)
The files are in the sound folder?

yes

anakonda001 07-06-2020 13:56

Re: no sounds are played
 
Quote:

Originally Posted by DJEarthQuake (Post 2708928)
He's right. I truncated what I originally had and should have left it early this morning. Everything is relative to the sound directory using precache_sound.

https://www.amxmodx.org/api/amxmodx/precache_sound

so what should I do?


All times are GMT -4. The time now is 17:03.

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