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
__________________