View Single Post
Oylsister
Senior Member
Join Date: Aug 2019
Location: KhonKaen, Thailand
Old 01-25-2021 , 07:35   Re: [CS:GO/CS:S] Release: Zombie:Reloaded Franug edition (Updated 25-Jan-2021)
Reply With Quote #511

You can remove "#include <emitsoundany>" from zombiereloaded.sp

The api that include in emitsoundany.inc will has "Any" at behind of it.
such as 'PrecacheSoundAny' , 'EmitSoundToAllAny' , 'EmitSoundToClientAny'

just change it back to 'PrecacheSound' , 'EmitSoundToAll' , 'EmitSoundToClient'
because of 2018 CS:GO update, emitsoundany.inc is no longer need (Source: https://forums.alliedmods.net/showthread.php?t=237045)

Many people already known about it but there also many people who don't know about it.

soundeffects.inc of Z:R plugin will look like this. And you will hear a zombie sound normally when somebody get infected
PHP Code:
/*
 * ============================================================================
 *
 *  Zombie:Reloaded
 *
 *  File:          soundeffects.inc
 *  Type:          Core 
 *  Description:   Basic sound-management API.
 *
 *  Copyright (C) 2009-2013  Greyscale, Richard Helgeby
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ============================================================================
 */

/**
 * Maximum sound path length.
 */
#define SOUND_MAX_PATH 128

/**
 * Ambient sound channel.
 */
#define SOUND_AMBIENT_CHANNEL 8

#include "zr/soundeffects/voice"
#include "zr/soundeffects/ambientsounds"
#include "zr/soundeffects/zombiesounds"

/**
 * Load sound effects data.
 */
SEffectsLoad()
{
    
// Load ambient sound cvars.
    
AmbientSoundsLoad();
}

/**
 * Map is starting.
 */ 
SEffectsOnMapStart()
{
    
// Forward event to sub-modules.
    
AmbientSoundsOnMapStart();
}

/**
 * Client is joining the server.
 * 
 * @param client    The client index.
 */
SEffectsClientInit(client)
{
    
// Forward event to sub-modules.
    
AmbientSoundsClientInit(client);
    
ZombieSoundsClientInit(client);
}

/**
 * The round is starting.
 */
SEffectsOnRoundStart()
{
    
// Forward event to sub-modules.
    
VoiceOnRoundStart();
    
AmbientSoundsOnRoundStart();
}

/**
 * The round is ending.
 */
SEffectsOnRoundEnd()
{
    
// Forward event to sub-modules.
    
VoiceOnRoundEnd();
    
AmbientSoundsOnRoundEnd();
    
ZombieSoundsOnRoundEnd();
}

/**
 * Client is spawning into the game.
 * 
 * @param client    The client index.
 */
SEffectsOnClientSpawn(client)
{
    
// Forward event to sub-modules.
    
VoiceOnClientSpawn(client);
    
ZombieSoundsOnClientSpawn(client);
}

/**
 * Client is spawning into the game. *Post
 * 
 * @param client    The client index.
 */
SEffectsOnClientSpawnPost(client)
{
    
// Forward event to sub-modules.
    
AmbientSoundsOnClientSpawnPost(client);
}

/**
 * Client has been killed.
 * 
 * @param client    The client index.
 */
SEffectsOnClientDeath(client)
{
    
// Forward event to sub-modules.
    
ZombieSoundsOnClientDeath(client);
}

/**
 * Client has been hurt.
 * 
 * @param client    The client index.
 */
SEffectsOnClientHurt(client)
{
    
// Forward event to sub-modules.
    
ZombieSoundsOnClientHurt(client);
}

/**
 * Client has been infected.
 * 
 * @param client    The client index.
 */
SEffectsOnClientInfected(client)
{
    
// Forward event to sub-modules.
    
VoiceOnClientInfected(client);
    
ZombieSoundsOnClientInfected(client);
}

/**
 * Client has been turned back human.
 * 
 * @param client    The client index.
 */
SEffectsOnClientHuman(client)
{
    
// Forward event to sub-modules.
    
VoiceOnClientHuman(client);
}

/**
 * Emits an ambient sound
 * 
 * @param sound         The path to the sound file (relative to sounds/)
 * @param soundvolume   The volume of the sound (0.0 - 1.0)
 * @param client        (Optional) Client index to play sound to.
 */
SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume 1.0client = -1)
{
    
// Precache sound before playing.
    
PrecacheSound(sound);
    
    if (
ZRIsClientValid(client))
    {
        
// Emit ambient sound.
        
EmitSoundToClient(clientsoundSOUND_FROM_PLAYERSOUND_AMBIENT_CHANNEL__ambientvolume);
        
        
// Flag client that sound is playing.
        
bAmbientSoundsIsPlaying[client] = true;
        
    }
    else
    {
        for (new 
1<= MaxClientsx++)
        {
            
// If client isn't in-game, then stop.
            
if (!IsClientInGame(x))
            {
                continue;
            }
            
            
// Emit ambient sound.
            
EmitSoundToClient(xsoundSOUND_FROM_PLAYERSNDCHAN_AUTO__ambientvolume);
        }
    }
}

/**
 * Stop an ambient sound
 *  
 * @param sound     The path to the sound file (relative to sounds/) 
 */
SEffectsStopAmbientSound(const String:sound[])
{
    
// x = client index.
    
for (new 1<= MaxClientsx++)
    {
        
// If client isn't in-game, then stop.
        
if (!IsClientInGame(x))
        {
            continue;
        }
        
        
// Stop ambient sound.
        
StopSound(xSOUND_AMBIENT_CHANNELsound);
    }
}

/**
 * Replay an ambient sound
 * 
 * @param sound     The path to the sound file (relative to sounds/)
 */ 

/**
 * Emits a sound from a client.
 * 
 * @param client    The client index.
 * @param sound     The sound file relative to the sound/ directory.
 * @param level     The attenuation of the sound.
 */
SEffectsEmitSoundFromClient(client, const String:sound[], level SNDLEVEL_NORMAL)
{
    
// Precache sound before playing.// Emit sound from client.
    
PrecacheSound(sound);
    
// Emit sound from client.
    
EmitSoundToAll(soundclient_level);

infect.inc start at line 647
PHP Code:
public Action:InfectCountdown(Handle:timer)
{
    new 
bool:countdown GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN]);
    if (!
countdown)
    {
        
InfectStopCountdown();
        return 
Plugin_Stop;
    }
    
    
// Read the info from the datapack.
    
ResetPack(hInfectCountdownData);
    new 
Float:length ReadPackFloat(hInfectCountdownData);
    new 
Float:counter ReadPackFloat(hInfectCountdownData);
    
    
// Check if the countdown has finished.
    
if (counter >= length)
    {
        
InfectStopCountdown();
        return 
Plugin_Stop;
    }
    
    new 
counter_int RoundToNearest(length counter);
    
char sounddir[128];
    
Format(sounddir128"sound/zr/countdown/%i.mp3"counter_int);
    
    if(
FileExists(sounddir))
    {
        
ReplaceString(sounddir128"sound/""");
        
        
EmitSoundToAll(sounddir);
    }
    
    
// Print the countdown text to the clients.
    
TranslationPrintCenterTextAll(false"Infect countdown"counter_int);
    
    
counter++;
    
    
// Write the new counter value to the datapack.
    
ResetPack(hInfectCountdownData);
    
WritePackFloat(hInfectCountdownDatalength);
    
WritePackFloat(hInfectCountdownDatacounter);
    
    return 
Plugin_Continue;
}

CountDown()
{
    
int count 1;
    
char sounddir[128];
    
Format(sounddir128"sound/zr/countdown/%i.mp3"count);
    
    while(
FileExists(sounddir))
    {
        
AddFileToDownloadsTable(sounddir);
        
ReplaceString(sounddir128"sound/""");
        
        
PrecacheSound(sounddir);
        
        
count++;
        
Format(sounddir128"sound/zr/countdown/%i.mp3"count);
    }

__________________
Oylsister is offline