remove trailing whitespaces from sourcecode
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* Zombie:Reloaded
|
||||
*
|
||||
* File: ambientsounds.inc
|
||||
* Type: Core
|
||||
* Type: Core
|
||||
* Description: Plays ambient sounds to clients.
|
||||
*
|
||||
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
/**
|
||||
* Global variable that tells if ambient sound cvar data was loaded successfully.
|
||||
*/
|
||||
*/
|
||||
new bool:g_bAmbientSounds;
|
||||
|
||||
/**
|
||||
@ -38,7 +38,7 @@ new Handle:tAmbientSounds = INVALID_HANDLE;
|
||||
/**
|
||||
* Array for flagging client to play sound.
|
||||
*/
|
||||
new bool:bAmbientSoundsIsPlaying[MAXPLAYERS + 1];
|
||||
new bool:bAmbientSoundsIsPlaying[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Load ambient sound data.
|
||||
@ -51,7 +51,7 @@ AmbientSoundsLoad()
|
||||
|
||||
/**
|
||||
* Client is joining the server.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
AmbientSoundsClientInit(client)
|
||||
@ -72,12 +72,12 @@ bool:AmbientSoundsValidateConfig()
|
||||
g_bAmbientSounds = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Get ambient sound file.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
||||
Format(sound, sizeof(sound), "sound/%s", sound);
|
||||
|
||||
|
||||
// If file doesn't exist, then log error and stop.
|
||||
if (!FileExists(sound, true))
|
||||
{
|
||||
@ -85,30 +85,30 @@ bool:AmbientSoundsValidateConfig()
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_SEffects, "Config Validation", "Invalid sound file specified in \"zr_ambientsounds_file\": %s", sound);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// If volume is muted or invalid, then log error and stop.
|
||||
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
|
||||
if (ambientvolume <= 0.0)
|
||||
{
|
||||
// Log invalid ambient sound volume error.
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_SEffects, "Config Validation", "Ambient sound volume specified in \"zr_ambientsounds_volume\" is either muted or invalid.");
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// If length is invalid, then log error and stop.
|
||||
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
|
||||
if (ambientlength <= 0.0)
|
||||
{
|
||||
// Log invalid ambient sound length error.
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_SEffects, "Config Validation", "Ambient sound length specified in \"zr_ambientsounds_length\" is invalid.");
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Add sound file to downloads table.
|
||||
AddFileToDownloadsTable(sound);
|
||||
|
||||
|
||||
g_bAmbientSounds = true;
|
||||
return true;
|
||||
}
|
||||
@ -145,7 +145,7 @@ AmbientSoundsOnRoundEnd()
|
||||
|
||||
/**
|
||||
* Client is spawning into the game.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
AmbientSoundsOnClientSpawnPost(client)
|
||||
@ -155,23 +155,23 @@ AmbientSoundsOnClientSpawnPost(client)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If flag is enabled, then stop.
|
||||
if (bAmbientSoundsIsPlaying[client])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get ambient sound file.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
||||
|
||||
|
||||
// Get ambient sound volume.
|
||||
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
|
||||
|
||||
|
||||
// Emit ambient sound.
|
||||
SEffectsEmitAmbientSound(sound, ambientvolume, client);
|
||||
|
||||
|
||||
// Flag client that sound is playing.
|
||||
bAmbientSoundsIsPlaying[client] = true;
|
||||
}
|
||||
@ -187,24 +187,24 @@ AmbientSoundsRestart()
|
||||
KillTimer(tAmbientSounds);
|
||||
tAmbientSounds = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
// If ambience is disabled, then stop.
|
||||
if (!g_bAmbientSounds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get ambient sound length.
|
||||
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
|
||||
|
||||
|
||||
// Start ambient sounds timer.
|
||||
tAmbientSounds = CreateTimer(ambientlength, AmbientSoundsTimer, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Timer callback, Replays ambient sound on all clients.
|
||||
*
|
||||
* @param timer The timer handle.
|
||||
*
|
||||
* @param timer The timer handle.
|
||||
*/
|
||||
public Action:AmbientSoundsTimer(Handle:timer)
|
||||
{
|
||||
@ -213,23 +213,23 @@ public Action:AmbientSoundsTimer(Handle:timer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get ambient sound file.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
||||
|
||||
|
||||
// Get ambient sound volume.
|
||||
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
|
||||
|
||||
|
||||
// Stop sound before playing again.
|
||||
SEffectsStopAmbientSound(sound);
|
||||
|
||||
|
||||
// Emit ambient sound.
|
||||
SEffectsEmitAmbientSound(sound, ambientvolume);
|
||||
|
||||
|
||||
// Get ambient sound length.
|
||||
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
|
||||
|
||||
|
||||
// Start new timer with sound length as delay.
|
||||
tAmbientSounds = CreateTimer(ambientlength, AmbientSoundsTimer, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Zombie:Reloaded
|
||||
*
|
||||
* File: soundeffects.inc
|
||||
* Type: Core
|
||||
* Type: Core
|
||||
* Description: Basic sound-management API.
|
||||
*
|
||||
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
|
||||
@ -50,7 +50,7 @@ SEffectsLoad()
|
||||
|
||||
/**
|
||||
* Map is starting.
|
||||
*/
|
||||
*/
|
||||
SEffectsOnMapStart()
|
||||
{
|
||||
// Forward event to sub-modules.
|
||||
@ -59,7 +59,7 @@ SEffectsOnMapStart()
|
||||
|
||||
/**
|
||||
* Client is joining the server.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsClientInit(client)
|
||||
@ -92,7 +92,7 @@ SEffectsOnRoundEnd()
|
||||
|
||||
/**
|
||||
* Client is spawning into the game.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsOnClientSpawn(client)
|
||||
@ -104,7 +104,7 @@ SEffectsOnClientSpawn(client)
|
||||
|
||||
/**
|
||||
* Client is spawning into the game. *Post
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsOnClientSpawnPost(client)
|
||||
@ -115,7 +115,7 @@ SEffectsOnClientSpawnPost(client)
|
||||
|
||||
/**
|
||||
* Client has been killed.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsOnClientDeath(client)
|
||||
@ -126,7 +126,7 @@ SEffectsOnClientDeath(client)
|
||||
|
||||
/**
|
||||
* Client has been hurt.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsOnClientHurt(client)
|
||||
@ -137,7 +137,7 @@ SEffectsOnClientHurt(client)
|
||||
|
||||
/**
|
||||
* Client has been infected.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsOnClientInfected(client)
|
||||
@ -149,7 +149,7 @@ SEffectsOnClientInfected(client)
|
||||
|
||||
/**
|
||||
* Client has been turned back human.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
SEffectsOnClientHuman(client)
|
||||
@ -160,7 +160,7 @@ SEffectsOnClientHuman(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.
|
||||
@ -169,12 +169,12 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
||||
{
|
||||
// Precache sound before playing.
|
||||
PrecacheSound(sound);
|
||||
|
||||
|
||||
if (ZRIsClientValid(client))
|
||||
{
|
||||
// Emit ambient sound.
|
||||
EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume);
|
||||
|
||||
|
||||
// Flag client that sound is playing.
|
||||
bAmbientSoundsIsPlaying[client] = true;
|
||||
}
|
||||
@ -187,7 +187,7 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Emit ambient sound.
|
||||
EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, _, _, ambientvolume);
|
||||
}
|
||||
@ -196,8 +196,8 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
||||
|
||||
/**
|
||||
* Stop an ambient sound
|
||||
*
|
||||
* @param sound The path to the sound file (relative to sounds/)
|
||||
*
|
||||
* @param sound The path to the sound file (relative to sounds/)
|
||||
*/
|
||||
SEffectsStopAmbientSound(const String:sound[])
|
||||
{
|
||||
@ -209,7 +209,7 @@ SEffectsStopAmbientSound(const String:sound[])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Stop ambient sound.
|
||||
StopSound(x, SOUND_AMBIENT_CHANNEL, sound);
|
||||
}
|
||||
@ -217,13 +217,13 @@ SEffectsStopAmbientSound(const String:sound[])
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@ -232,7 +232,7 @@ SEffectsEmitSoundFromClient(client, const String:sound[], level = SNDLEVEL_NORMA
|
||||
{
|
||||
// Precache sound before playing.
|
||||
PrecacheSound(sound);
|
||||
|
||||
|
||||
// Emit sound from client.
|
||||
EmitSoundToAll(sound, client, _, level);
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ new bool:g_bVoice;
|
||||
VoiceOnRoundStart()
|
||||
{
|
||||
new bool:voice = GetConVarBool(g_hCvarsList[CVAR_VOICE]);
|
||||
|
||||
|
||||
// If the cvar has changed, then reset the voice permissions.
|
||||
if (g_bVoice != voice)
|
||||
{
|
||||
VoiceReset();
|
||||
}
|
||||
|
||||
|
||||
// Update g_bVoice with new value.
|
||||
g_bVoice = voice;
|
||||
}
|
||||
@ -57,14 +57,14 @@ VoiceOnRoundEnd()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Allow everyone to listen/speak with each other.
|
||||
VoiceAllTalk();
|
||||
}
|
||||
|
||||
/**
|
||||
* Client is spawning into the game.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
VoiceOnClientSpawn(client)
|
||||
@ -75,7 +75,7 @@ VoiceOnClientSpawn(client)
|
||||
|
||||
/**
|
||||
* Client has been infected.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
VoiceOnClientInfected(client)
|
||||
@ -86,7 +86,7 @@ VoiceOnClientInfected(client)
|
||||
|
||||
/**
|
||||
* Client has been turned back human.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
VoiceOnClientHuman(client)
|
||||
@ -110,9 +110,9 @@ stock bool:VoiceSetClientListening(iReceiver, iSender, bool:bListen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
new ListenOverride:override = bListen ? Listen_Yes : Listen_No;
|
||||
|
||||
|
||||
return SetListenOverride(iReceiver, iSender, override);
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ stock VoiceAllTalk()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
for (new y = 1; y <= MaxClients; y++)
|
||||
{
|
||||
// If sender isn't in-game, then stop.
|
||||
@ -138,13 +138,13 @@ stock VoiceAllTalk()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// No need to alter listening/speaking flags between one client.
|
||||
if (x == y)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Receiver (x) can now hear the sender (y), only if sender isn't muted.
|
||||
VoiceSetClientListening(x, y, true);
|
||||
}
|
||||
@ -153,7 +153,7 @@ stock VoiceAllTalk()
|
||||
|
||||
/**
|
||||
* Set which team the client is allowed to listen/speak with.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
* @param zombie True to permit verbal communication to zombies only, false for humans only.
|
||||
*/
|
||||
@ -167,16 +167,16 @@ stock VoiceSetClientTeam(client, bool:zombie)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// No need to alter listening/speaking flags between one client.
|
||||
if (client == x)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Client can only listen/speak if the sender is on their team.
|
||||
new bool:canlisten = (zombie == InfectIsClientInfected(x));
|
||||
|
||||
|
||||
// (Dis)allow clients to listen/speak with each other, don't touch if the sender is muted.
|
||||
VoiceSetClientListening(client, x, canlisten);
|
||||
VoiceSetClientListening(x, client, canlisten);
|
||||
@ -185,7 +185,7 @@ stock VoiceSetClientTeam(client, bool:zombie)
|
||||
|
||||
/**
|
||||
* Update a client's listening/speaking status.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
stock VoiceUpdateClient(client)
|
||||
@ -195,14 +195,14 @@ stock VoiceUpdateClient(client)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Set the client's listening/speaking status to their current team.
|
||||
VoiceSetClientTeam(client, InfectIsClientInfected(client));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns if the client is muted.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
* @return True if the client is muted, false if not.
|
||||
*/
|
||||
@ -219,10 +219,10 @@ stock VoiceReset()
|
||||
{
|
||||
// Is alltalk enabled?
|
||||
new bool:alltalk = GetConVarBool(FindConVar("sv_alltalk"));
|
||||
|
||||
|
||||
// Determine new voice flags based off of alltalk.
|
||||
new voiceflags = alltalk ? VOICE_SPEAKALL | VOICE_LISTENALL : VOICE_TEAM | VOICE_LISTENTEAM;
|
||||
|
||||
|
||||
// x = Client index.
|
||||
for (new x = 1; x <= MaxClients; x++)
|
||||
{
|
||||
@ -231,7 +231,7 @@ stock VoiceReset()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Apply new voice flags.
|
||||
SetClientListeningFlags(x, voiceflags);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Zombie:Reloaded
|
||||
*
|
||||
* File: zombiesounds.inc
|
||||
* Type: Core
|
||||
* Type: Core
|
||||
* Description: Zombie sound effects.
|
||||
*
|
||||
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
|
||||
@ -64,7 +64,7 @@ enum ZombieSounds
|
||||
Groan, /** When zombie is hurt */
|
||||
Death, /** When a zombie is killed */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Array for storing zombie moaning timer handles per client.
|
||||
*/
|
||||
@ -82,14 +82,14 @@ new Handle:g_hSEffectsCommandTimer[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Client is joining the server.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
ZombieSoundsClientInit(client)
|
||||
{
|
||||
// Reset timer handle.
|
||||
tSEffectsMoan[client] = INVALID_HANDLE;
|
||||
|
||||
|
||||
// Reset command counter and make sure there's no timer running.
|
||||
g_SEffectsCommandCount[client] = 0;
|
||||
ZREndTimer(g_hSEffectsCommandTimer[client]);
|
||||
@ -97,7 +97,7 @@ ZombieSoundsClientInit(client)
|
||||
|
||||
/**
|
||||
* Client is spawning into the game.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
ZombieSoundsOnClientSpawn(client)
|
||||
@ -107,10 +107,10 @@ ZombieSoundsOnClientSpawn(client)
|
||||
{
|
||||
KillTimer(tSEffectsMoan[client]);
|
||||
}
|
||||
|
||||
|
||||
// Reset timer handle.
|
||||
tSEffectsMoan[client] = INVALID_HANDLE;
|
||||
|
||||
|
||||
// Reset command counter and kill timer.
|
||||
g_SEffectsCommandCount[client] = 0;
|
||||
ZREndTimer(g_hSEffectsCommandTimer[client]);
|
||||
@ -118,7 +118,7 @@ ZombieSoundsOnClientSpawn(client)
|
||||
|
||||
/**
|
||||
* Client has been killed.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
ZombieSoundsOnClientDeath(client)
|
||||
@ -128,37 +128,37 @@ ZombieSoundsOnClientDeath(client)
|
||||
{
|
||||
KillTimer(tSEffectsMoan[client]);
|
||||
}
|
||||
|
||||
|
||||
// Reset timer handle.
|
||||
tSEffectsMoan[client] = INVALID_HANDLE;
|
||||
|
||||
|
||||
// Reset command counter and kill timer.
|
||||
g_SEffectsCommandCount[client] = 0;
|
||||
ZREndTimer(g_hSEffectsCommandTimer[client]);
|
||||
|
||||
|
||||
// If player isn't a zombie, then stop.
|
||||
if (!InfectIsClientInfected(client))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If death sound cvar is disabled, then stop.
|
||||
new bool:death = GetConVarBool(g_hCvarsList[CVAR_SEFFECTS_DEATH]);
|
||||
if (!death)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get random death sound.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
ZombieSoundsGetRandomSound(sound, Death);
|
||||
|
||||
|
||||
SEffectsEmitSoundFromClient(client, sound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Client has been hurt.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
ZombieSoundsOnClientHurt(client)
|
||||
@ -168,28 +168,28 @@ ZombieSoundsOnClientHurt(client)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get groan factor, if 0, then stop.
|
||||
new groan = GetConVarInt(g_hCvarsList[CVAR_SEFFECTS_GROAN]);
|
||||
if (!groan)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 1 in 'groan' chance of groaning.
|
||||
if (GetRandomInt(1, groan) == 1)
|
||||
{
|
||||
// Get random groan sound.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
ZombieSoundsGetRandomSound(sound, Groan);
|
||||
|
||||
|
||||
SEffectsEmitSoundFromClient(client, sound);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Client has been infected.
|
||||
*
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
ZombieSoundsOnClientInfected(client)
|
||||
@ -200,13 +200,13 @@ ZombieSoundsOnClientInfected(client)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If timer is currently running, kill it.
|
||||
if (tSEffectsMoan[client] != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(tSEffectsMoan[client]);
|
||||
}
|
||||
|
||||
|
||||
// Start repeating timer.
|
||||
tSEffectsMoan[client] = CreateTimer(interval, ZombieSoundsMoanTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||
}
|
||||
@ -236,14 +236,14 @@ ZombieSoundsOnCommandsCreate()
|
||||
*
|
||||
* @param sound The randomly picked sound.
|
||||
* @param soundtype The type of sound to get. (See enum ZombieSounds)
|
||||
* @return True if sound was successfully picked, false otherwise.
|
||||
*/
|
||||
* @return True if sound was successfully picked, false otherwise.
|
||||
*/
|
||||
bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
|
||||
{
|
||||
new soundmin;
|
||||
new soundmax;
|
||||
decl String:soundpath[SOUND_MAX_PATH];
|
||||
|
||||
|
||||
switch(soundtype)
|
||||
{
|
||||
// Find moan sound.
|
||||
@ -252,7 +252,7 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
|
||||
// Copy min and max
|
||||
soundmin = SOUND_MOAN_MIN;
|
||||
soundmax = SOUND_MOAN_MAX;
|
||||
|
||||
|
||||
// Copy path
|
||||
strcopy(soundpath, sizeof(soundpath), SOUND_MOAN_PATH);
|
||||
}
|
||||
@ -262,7 +262,7 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
|
||||
// Copy min and max
|
||||
soundmin = SOUND_GROAN_MIN;
|
||||
soundmax = SOUND_GROAN_MAX;
|
||||
|
||||
|
||||
// Copy path
|
||||
strcopy(soundpath, sizeof(soundpath), SOUND_GROAN_PATH);
|
||||
}
|
||||
@ -272,7 +272,7 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
|
||||
// Copy min and max
|
||||
soundmin = SOUND_DEATH_MIN;
|
||||
soundmax = SOUND_DEATH_MAX;
|
||||
|
||||
|
||||
// Copy path
|
||||
strcopy(soundpath, sizeof(soundpath), SOUND_DEATH_PATH);
|
||||
}
|
||||
@ -283,20 +283,20 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pick a random integer between min and max sound file index.
|
||||
new randsound = GetRandomInt(soundmin, soundmax);
|
||||
|
||||
|
||||
// Format random index into sound path.
|
||||
Format(sound, SOUND_MAX_PATH, soundpath, randsound);
|
||||
|
||||
|
||||
// Found sound.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timer callback, repeats a moaning sound on zombies.
|
||||
*
|
||||
*
|
||||
* @param timer The timer handle.
|
||||
* @param client The client index.
|
||||
*/
|
||||
@ -307,14 +307,14 @@ public Action:ZombieSoundsMoanTimer(Handle:timer, any:client)
|
||||
{
|
||||
// Reset timer handle.
|
||||
tSEffectsMoan[client] = INVALID_HANDLE;
|
||||
|
||||
|
||||
// Stop timer.
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
|
||||
// Emit moan sound.
|
||||
ZombieSoundsMoan(client);
|
||||
|
||||
|
||||
// Allow timer to continue.
|
||||
return Plugin_Continue;
|
||||
}
|
||||
@ -329,7 +329,7 @@ ZombieSoundsMoan(client)
|
||||
// Get random moan sound.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
ZombieSoundsGetRandomSound(sound, Moan);
|
||||
|
||||
|
||||
// Emit sound from client.
|
||||
SEffectsEmitSoundFromClient(client, sound, SNDLEVEL_SCREAMING);
|
||||
}
|
||||
@ -343,7 +343,7 @@ ZombieSoundsScream(client)
|
||||
{
|
||||
decl String:sound[PLATFORM_MAX_PATH];
|
||||
GetConVarString(g_hCvarsList[CVAR_INFECT_SOUND], sound, sizeof(sound));
|
||||
|
||||
|
||||
// If cvar contains path, then continue.
|
||||
if (sound[0])
|
||||
{
|
||||
@ -363,7 +363,7 @@ ZombieSoundsCmdTimerCheck(client)
|
||||
if (g_hSEffectsCommandTimer[client] == INVALID_HANDLE)
|
||||
{
|
||||
new Float:timespan = GetConVarFloat(g_hCvarsList[CVAR_SEFFECTS_COMMAND_TIMESPAN]);
|
||||
|
||||
|
||||
// Only create timer if time span is enabled.
|
||||
if (timespan > 0.0)
|
||||
{
|
||||
@ -403,13 +403,13 @@ ZombieSoundsResetCmdTimers()
|
||||
bool:ZombieSoundsCommandAllowed(client)
|
||||
{
|
||||
new limit = GetConVarInt(g_hCvarsList[CVAR_SEFFECTS_COMMAND_LIMIT]);
|
||||
|
||||
|
||||
if (limit <= 0 ||
|
||||
g_SEffectsCommandCount[client] < limit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ public Action:ZombieSoundsScreamCommand(client, argc)
|
||||
g_SEffectsCommandCount[client]++;
|
||||
ZombieSoundsCmdTimerCheck(client);
|
||||
}
|
||||
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -445,7 +445,7 @@ public Action:ZombieSoundsMoanCommand(client, argc)
|
||||
g_SEffectsCommandCount[client]++;
|
||||
ZombieSoundsCmdTimerCheck(client);
|
||||
}
|
||||
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user