Basically the idea is that when you die, you have x amount of seconds to make your last callout, and then you can't talk anymore.
I've seen this in a pug type of plugin, when you died it announced something like "You have 5 seconds to make your final callout". I haven't seen anything like this as a stand alone plugin though, so sorry if it already exists, but I did search for it a good bit to no avail.
I haven't tested this, but it does seem to compile fine. You may want to fiddle with the mute flags to get exactly what you want. I also added debug prints in order to test it in game, otherwise grab a couple of friends to help you.
As this is a very basic plugin, feel free to modify/redistribute to your hearts desire.
public Plugin myinfo = { name = "Last Callout", author = PLUGIN_AUTHOR, description = "Mutes players shortley after death.", version = PLUGIN_VERSION, url = "https://forums.alliedmods.net/showthread.php?t=265713" };
Handle g_hCvarCalloutDuration;
public void OnPluginStart() { g_hCvarCalloutDuration = CreateConVar("sm_callout_duration", "5.0", "Duration of the callout period.", FCVAR_PLUGIN | FCVAR_NOTIFY); HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post); HookEvent("round_end", Event_RoundEnd); }
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(GetEventInt(event, "userid")); CreateTimer(GetConVarFloat(g_hCvarCalloutDuration), Timer_Callout, client); PrintToChat(client, "[SM] You have %.0f seconds to make your final callout!", GetConVarFloat(g_hCvarCalloutDuration)); }
public Action Timer_Callout(Handle timer, any client) { #if DEBUG PrintToChat(client, "[debug] You have been muted."); #endif
SetClientListeningFlags(client, VOICE_MUTED); }
public Action Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i)) { #if DEBUG PrintToChat(i, "[debug] You have been unmuted."); #endif
I have yet to test this but is it possible to make it so dead players can voice chat with other dead players on their team, instead of muting them entirely, while live players can only hear other live players on their team?