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

[Solved] Muting everybody then unmuting after some seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 03-18-2020 , 20:42   [Solved] Muting everybody then unmuting after some seconds
Reply With Quote #1

I'm making a plugin where everybody who isn't an admin gets muted at the round start, then after some time, those who have the admflag_generic and admflag_custom1 (vips) get unmuted but for some reason this isn't muting..

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "GelaPT"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <cstrike>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo = {
	name = "Mute VIP in the round start.",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart() {
	HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
}

public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) {
	for (int i = 1; i <= MaxClients; i++) {
		int iFlags = GetUserFlagBits(i);
		if(IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && !(iFlags & ADMFLAG_BAN) && GetClientTeam(i) == 2) {
			SetClientListeningFlags(i, VOICE_MUTED);
		}
	}
	CreateTimer(30.0, UnMuteVips);
}

public Action UnMuteVips(Handle timer) {
	for (int i = 1; i <= MaxClients; i++) {
		int iFlags = GetUserFlagBits(i);
		if(IsClientInGame(i) && !IsFakeClient(i) && (iFlags & ADMFLAG_GENERIC) && GetClientTeam(i) == 2) {
			SetClientListeningFlags(i, VOICE_NORMAL);
		}
	}
}
Edit (solved):
this
Code:
iFlags & ADMFLAG_GENERIC
should be like this
Code:
iFlags & ADMFLAG_GENERIC == ADMFLAG_GENERIC
__________________

Last edited by andrept4; 03-19-2020 at 05:51.
andrept4 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 03-19-2020 , 03:28   Re: Muting everybody then unmuting after some seconds
Reply With Quote #2

the red part is where i think is the problem

Quote:
if(IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && !(iFlags & ADMFLAG_BAN) && GetClientTeam(i) == 2) {

if(IsClientInGame(i) && !IsFakeClient(i) && (iFlags & ADMFLAG_GENERIC) && GetClientTeam(i) == 2) {
__________________

Last edited by 8guawong; 03-19-2020 at 03:29.
8guawong 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 10:08.


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