Updated ZMarket to distribute grenades correctly. Still need to update the loadout to support multiple nades, to support multiple flashbangs and Grenade Pack fully. As of now the market allows you to buy 3 grenades but they don't show in the loadout as 3.

Worked more on the voice API, need to figure out why they are reversed. The cvar to disable it now should work, because it doesn't quite work right.
Changed Gangsta Glock back to Glock :P
This commit is contained in:
Greyscale
2009-08-26 00:07:01 -07:00
parent 34c6f853ff
commit 0c2230ad45
7 changed files with 263 additions and 73 deletions

View File

@ -75,6 +75,7 @@ SEffectsClientInit(client)
SEffectsOnRoundStart()
{
// Forward event to sub-modules.
VoiceOnRoundStart();
AmbientSoundsOnRoundStart();
}
@ -84,6 +85,7 @@ SEffectsOnRoundStart()
SEffectsOnRoundEnd()
{
// Forward event to sub-modules.
VoiceOnRoundEnd();
AmbientSoundsOnRoundEnd();
}

View File

@ -25,6 +25,43 @@
* ============================================================================
*/
/**
* Updates every round with the value of the cvar.
*/
new bool:g_bVoice;
/**
* The round is starting.
*/
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;
}
/**
* The round is ending.
*/
VoiceOnRoundEnd()
{
// If voice module is disabled, then stop.
if (!g_bVoice)
{
return;
}
// Allow everyone to listen/speak with each other.
VoiceAllTalk();
}
/**
* Client is spawning into the game.
*
@ -58,6 +95,26 @@ VoiceOnClientHuman(client)
VoiceUpdateClient(client);
}
/**
* Set the receiver ability to listen to the sender.
* Note: This function is from sdktools_voice, it fails if iSender is muted.
*
* @param iReceiver The listener index.
* @param iSender The sender index.
* @return True if successful otherwise false.
*/
stock bool:VoiceSetClientListening(iReceiver, iSender, bool:bListen)
{
// If the sender is muted, then return false.
if (VoiceIsClientMuted(iSender))
{
return false;
}
SetClientListening(iReceiver, iSender, bListen);
return true;
}
/**
* Allow all clients to listen and speak with each other.
*/
@ -87,8 +144,8 @@ stock VoiceAllTalk()
continue;
}
// Receiver (x) can now hear the sender (y).
SetClientListening(x, y, true);
// Receiver (x) can now hear the sender (y), only if sender isn't muted.
VoiceSetClientListening(x, y, true);
}
}
}
@ -113,9 +170,9 @@ stock VoiceSetClientTeam(client, bool:zombie)
// 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.
SetClientListening(client, x, canlisten);
SetClientListening(x, client, canlisten);
// (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);
}
}
@ -126,6 +183,49 @@ stock VoiceSetClientTeam(client, bool:zombie)
*/
stock VoiceUpdateClient(client)
{
// If voice module is disabled, then stop.
if (!g_bVoice)
{
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.
*/
stock bool:VoiceIsClientMuted(client)
{
// Return true if the mute flag isn't on the client.
return bool:(GetClientListeningFlags(client) & VOICE_MUTED);
}
/**
* Reset voice listening/speaking permissions back to normal according to sv_alltalk.
*/
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++)
{
// If client isn't in-game, then stop.
if (!IsClientInGame(x))
{
continue;
}
// Apply new voice flags.
SetClientListeningFlags(x, voiceflags);
}
}