Raised This Month: $51 Target: $400
 12% 

Mute death player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 03-27-2020 , 14:58   Mute death player
Reply With Quote #1

Hey, I need some help with the code.
Why does the plugin start alltalk in a new round?

PHP Code:
#include <sourcemod>
#include <sdktools>
 
#pragma semicolon 1
#pragma newdecls required
 
ConVar vc_enable;
ConVar vc_time;
 
public 
Plugin myinfo = {
    
name        "[Voice controller] Mute dead players time",
    
author      "hAlexr",
    
description "Adds so when player dieswill set a timer to mute him/herself from alive players",
    
version     "1.0.0",
    
url         "www.crypto-gaming.tk"
};
 
public 
void OnPluginStart()
{
    
vc_enable CreateConVar("vc_enable""1""Enables or disables the plugin"_true0.0true1.0);
    
vc_time CreateConVar("vc_time""5.0""Time until player is muted"_true0.1true20.0);
    
AutoExecConfig(true"plugin.MuteDeadPlayers");
   
    
HookEvent("player_death"playerDeath);
    
HookEvent("player_team"Event_PlayerTeam);
}
 
public 
Action playerDeath(Event event, const char[] namebool dontBroadcast)
{
    if(!
GetConVarBool(vc_enable))
    return;
   
    
int client GetClientOfUserId(GetEventInt(event"userid"));
   
    
CreateTimer(GetConVarFloat(vc_time), muteTimerclient);
    
PrintToChat(client" \x02╔═════════════════\x05[INFO]\x02═════════════════╗");
    
PrintToChat(client" \x02╠ \x01Masz \x025s \x01 na podanie \x02INFA");
    
PrintToChat(client" \x02╠ \x01Masz \x025s \x01 na podanie \x02INFA");
    
PrintToChat(client" \x02╠ \x01Masz \x025s \x01 na podanie \x02INFA");
    
PrintToChat(client" \x02╚═════════════════\x05[INFO]\x02═════════════════╝");
}
 
public 
Action muteTimer(Handle timerint client)
{
    if(!
GetConVarBool(vc_enable))
    return;
   
    for(
int i 1i<=MaxClients;i++)
    {
        if(
IsClientConnected(client) && IsClientInGame(client) && != client && !IsPlayerAlive(client))
        {
            
int clientTeam GetClientTeam(client);
           
            if(
IsClientConnected(i) && IsClientInGame(i) && != client && IsPlayerAlive(i))
             {
                 
int iTeam GetClientTeam(i);
                 
                 if(
clientTeam == iTeam)
                 {
                     
SetListenOverride(iclientListen_No);
                 }
             }
        }
    }
}
 
public 
Action Event_PlayerTeam(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i))
         {
             
int clientTeam GetClientTeam(i);
             
unmuteClients(iclientTeam);
         }
    }
}
 
public 
void unmuteClients(int clientint clientTeam)
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i))
         {
             
int iTeam GetClientTeam(client);
             if(
iTeam == clientTeam)
             {
                 
SetListenOverride(iclientListen_Yes);
                 
SetListenOverride(clientiListen_Yes);
             }
         }
    }

szogun is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode