Update binaries

This commit is contained in:
Jackzie 2021-06-30 18:32:09 -05:00
parent 48596d80e7
commit 688365c304
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
4 changed files with 57 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View file

@ -147,6 +147,59 @@ void GetHUDFormatString(hudPosition position, char[] buffer, int buffersize) {
strcopy(buffer, buffersize, huds[view_as<int>(position)]);
}
#define MAX_MESSAGES 6
#define MESSAGE_DURATION 40
#define MAX_MESSAGE_LENGTH 64
#define MESSAGE_UPDATE_INTERVAL 0.8
//This is hard coded into engine:
#define MAX_HUD_LENGTH 1023
hudPosition MSG_HUD_POS;
char messages[MAX_MESSAGES][MAX_MESSAGE_LENGTH];
char lastMsgFull[];
int msgExpiresTime;
Handle msgTimer;
void SetupMessageHud(hudPosition position) {
MSG_HUD_POS = position;
SetupHUD(MSG_HUD_POS, HUD_FLAG_ALIGN_LEFT | HUD_FLAG_NOBG | HUD_FLAG_TEAM_SURVIVORS, 0.0, 0.0, 1.0, 1.0);
msgTimer = CreateTimer(MESSAGE_UPDATE_INTERVAL, Timer_ProcessMessages, _, TIMER_REPEAT);
}
void CloseMessageHud() {
if(msgTimer != null)
CloseHandle(msgTimer);
ClearMessages();
}
//TODO: Replace repeat timer, just use one-time delay, only add one
//Internally process and print all messages
void Timer_ProcessMessages(Handle h) {
if(GetGameTime() > msgExpiresTime) {
messages.Erase(0);
msgExpiresTime = GetGameTime() + MESSAGE_DURATION;
}
char buffer[MAX_HUD_LENGTH];
for(int i = 0; i < messages.Length; i++) {
ImplodeStrings(messages, MAX_MESSAGES, "\\n", buffer, sizeof(buffer));
}
SetHUDText(MSG_HUD_POS, buffer);
}
//Adds a message to the message queue
void AddMessageToHud(const char msg[MAX_MESSAGE_LENGTH]) {
for(int i = 1; i < MAX_MESSAGES - 1; i++) {
strcopy(messages[i], MAX_MESSAGE_LENGTH, messages[i+1]);
}
strcopy(messages[MAX_MESSAGES-1], MAX_MESSAGE_LENGTH, msg);
}
//Clears all messages
void ClearMessageHud() {
for(int i = 0; i < MAX_MESSAGES; i++) {
messages[i][0] = '\0';
}
}
stock void L4D2_RunVScript(const char[] sCode, any ...) {
static int iScriptLogic = INVALID_ENT_REFERENCE;
if(iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {

View file

@ -34,7 +34,7 @@ public void OnPluginStart()
HookEvent("player_disconnect", Event_PlayerDisconnect);
RegConsoleCmd("sm_vgag", Cmd_Gag, "Gags a player\'s vocalizations locally");
RegConsoleCmd("sm_vgag", Cmd_VGag, "Gags a player\'s vocalizations locally");
AddNormalSoundHook(view_as<NormalSHook>(SoundHook));
}
@ -53,7 +53,7 @@ public void Event_PlayerDisconnect(Event event, const char[] name, bool dontBroa
}
}
public Action Cmd_Gag(int client, int args) {
public Action Cmd_VGag(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_vgag <player>");
} else {
@ -81,10 +81,10 @@ public Action Cmd_Gag(int client, int args) {
int playerIndex = gaggedPlayers[client].FindValue(target_list[i]);
if(playerIndex > -1) {
gaggedPlayers[client].Erase(playerIndex);
ReplyToCommand(client, "locally vocalize ungagged %s", target_name[i]);
ReplyToCommand(client, "Locally vocalize ungagged %s", target_name[i]);
}else{
gaggedPlayers[client].Push(target_list[i]);
ReplyToCommand(client, "locally vocalize gagged %s", target_name[i]);
ReplyToCommand(client, "Locally vocalize gagged %s", target_name[i]);
}
}
}