VAC Status Checker (v.2.2.0 10/9/17) - AlliedModdersНарод есть ли плагин, для того чтобы запретить игрокам входить на сервер, если у них VAC бан за любую игру???
#include <sourcemod>
new Handle:mp_c4timer, g_explosionTime;
public OnPluginStart()
{
mp_c4timer = FindConVar("mp_c4timer");
HookEvent("bomb_planted", OnBombPlanted, EventHookMode_Post);
HookEvent("bomb_beep", OnBombBeep, EventHookMode_Post);
}
public OnBombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
g_explosionTime = GetTime() + GetConVarInt(mp_c4timer);
public OnBombBeep(Handle:event, const String:name[], bool:dontBroadcast)
{
new diff = g_explosionTime - GetTime();
if (diff >= 0 && diff <= GetConVarInt(mp_c4timer))
PrintHintTextToAll("C4: %d", diff);
}
#pragma newdecls required
Handle mp_c4timer, g_explosionTime;
public void OnPluginStart()
{
mp_c4timer = FindConVar("mp_c4timer");
HookEvent("bomb_planted", OnBombPlanted, EventHookMode_Post);
HookEvent("bomb_beep", OnBombBeep, EventHookMode_Post);
}
public void OnBombPlanted(Event hEvent, const char[] name, bool dontBroadcast)
{
g_explosionTime = GetTime() + GetConVarInt(mp_c4timer);
}
public void OnBombBeep(Event hEvent, const char[] name, bool dontBroadcast)
{
int diff = g_explosionTime - GetTime();
if (diff >= 0 && diff <= GetConVarInt(mp_c4timer))
PrintHintTextToAll("C4: %d", diff);
}
int g_explosionTime;
#pragma semicolon 1
#pragma newdecls required
int iCDStart;
float fC4Timer;
public void OnPluginStart()
{
ConVar cvar;
(cvar = FindConVar("mp_c4timer")).AddChangeHook(CVarChanged_Timer);
fC4Timer = cvar.FloatValue;
HookEvent("bomb_planted", Event_BombPlanted, EventHookMode_Post);
HookEvent("bomb_beep", Event_BombBeep, EventHookMode_Post);
}
public void CVarChanged_Timer(ConVar cvar, const char[] oldVal, const char[] newVal)
{
fC4Timer = cvar.FloatValue;
}
public void Event_BombPlanted(Event hEvent, const char[] name, bool dontBroadcast)
{
iCDStart = GetTime();
}
public void Event_BombBeep(Event event, const char[] name, bool dontBroadcast)
{
static int diff;
if((diff = GetTime() - iCDStart) < 0 || diff > fC4Timer) return;
PrintHintTextToAll("C4: %d", RoundFloat(fC4Timer) - diff);
}
@Djgadzilla, ещё одну строчку надо. Которая над Displaying stack trace.
Без неё можно лишь догадываться, в чём проблема.
"Groups"
{
"full"
{
"flags" "abc" //reservation, generic admin, kick
"immunity" "1" //low immunity value
"Overrides"
{
}
"Limite"
{
// [param1] [key1:key2] // где key1 - количество, где key2 - ограничение на 0 - карту, или -1 - раунд. Если >0, то это время в секундах (именно в секундах)
"sm_slap" "5:-1" // шлёпать можно 5 раз на раунд
"sm_respawn" "1:360" // возродится можно 1 раз каждые 6 минут
}
}
}
[TEST] [VIP] Features Manager (DEV) или более гибкий Модуль плагина - [VIP] Features ManagerРебят, может кто добавить в плагинах VIP HP и VIP Armor квар на выключение, а также изменить немного плагин Stop Music? Просто когда их выгружаешь (VIP HP и VIP Armor), выдает ошибки в консоль. А в плагине Stop Music там таймер на выключение стоит, он выключает музыку с задержкой. Играет музыка 5 сек - выкл, мешает сильно. Нельзя сделать так, чтобы сразу выключало при начале раунда?
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <csgo_colors>
#define PLUGIN_NAME "Stop Map Music"
#define PLUGIN_VERSION "1.0.0"
#define MAX_EDICTS 2048
new Float:g_fCmdTime[MAXPLAYERS+1];
new g_iSoundEnts[MAX_EDICTS];
new g_iNumSounds;
new bool:disabled[MAXPLAYERS + 1];
public Plugin:myinfo =
{
name = PLUGIN_NAME,
author = "GoD-Tony [Fixed by The Count]",
description = "Allows clients to stop ambient sounds played by the map",
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net/"
};
public OnPluginStart()
{
CreateConVar("sm_stopmusic_version", PLUGIN_VERSION, "Stop Map Music", 0|FCVAR_NOTIFY|FCVAR_DONTRECORD);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
RegConsoleCmd("sm_music", Command_StopMusic, "Toggles map music");
CreateTimer(0.0, Post_Start, _, TIMER_REPEAT);
}
public OnClientDisconnect_Post(client)
{
g_fCmdTime[client] = 0.0;
disabled[client] = false;
}
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
g_iNumSounds = 0;
UpdateSounds();
CreateTimer(0.0, Post_Start);
}
public OnEntityCreated(entity, const String:classname[]){
if(!StrEqual(classname, "ambient_generic", false)){
return;
}
new String:sSound[PLATFORM_MAX_PATH];
GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound));
new len = strlen(sSound);
if (len > 4 && (StrEqual(sSound[len-3], "mp3") || StrEqual(sSound[len-3], "wav"))){
g_iSoundEnts[g_iNumSounds++] = EntIndexToEntRef(entity);
}else{
return;
}
new ent = -1;
for(new i=1;i<=MaxClients;i++){
if(!disabled[i] || !IsClientInGame(i)){ continue; }
for (new u=0; u<g_iNumSounds; u++){
ent = EntRefToEntIndex(g_iSoundEnts[u]);
if (ent != INVALID_ENT_REFERENCE){
GetEntPropString(ent, Prop_Data, "m_iszSound", sSound, sizeof(sSound));
Client_StopSound(i, ent, SNDCHAN_STATIC, sSound);
}
}
}
}
UpdateSounds(){
new String:sSound[PLATFORM_MAX_PATH];
new entity = INVALID_ENT_REFERENCE;
while ((entity = FindEntityByClassname(entity, "ambient_generic")) != INVALID_ENT_REFERENCE)
{
GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound));
new len = strlen(sSound);
if (len > 4 && (StrEqual(sSound[len-3], "mp3") || StrEqual(sSound[len-3], "wav")))
{
g_iSoundEnts[g_iNumSounds++] = EntIndexToEntRef(entity);
}
}
}
public Action:Post_Start(Handle:timer){
if(GetClientCount() <= 0){
return Plugin_Continue;
}
new String:sSound[PLATFORM_MAX_PATH];
new entity = INVALID_ENT_REFERENCE;
for(new i=1;i<=MaxClients;i++){
if(!disabled[i] || !IsClientInGame(i)){ continue; }
for (new u=0; u<g_iNumSounds; u++){
entity = EntRefToEntIndex(g_iSoundEnts[u]);
if (entity != INVALID_ENT_REFERENCE){
GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound));
Client_StopSound(i, entity, SNDCHAN_STATIC, sSound);
}
}
}
return Plugin_Continue;
}
public Action:Command_StopMusic(client, args)
{
if (!client || g_fCmdTime[client] > GetGameTime())
return Plugin_Handled;
if(disabled[client]){
disabled[client] = false;
CGOPrintToChat(client, "[SM]: Музыка {GREEN}включиться {DEFAULT}на следующем треке...");
return Plugin_Handled;
}
g_fCmdTime[client] = GetGameTime() + 0.0;
CGOPrintToChat(client, "[SM]: Музыка на карте {RED}выключена{DEFAULT}...");
new String:sSound[PLATFORM_MAX_PATH], entity;
for (new i = 0; i < g_iNumSounds; i++)
{
entity = EntRefToEntIndex(g_iSoundEnts[i]);
if (entity != INVALID_ENT_REFERENCE)
{
GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound));
Client_StopSound(client, entity, SNDCHAN_STATIC, sSound);
}
}
disabled[client] = true;
return Plugin_Handled;
}
stock Client_StopSound(client, entity, channel, const String:name[])
{
EmitSoundToClient(client, name, entity, channel, SNDLEVEL_NONE, SND_STOP, 0.0, SNDPITCH_NORMAL, _, _, _, true);
}
Все равно просачиваеться музыка на пару миллисекунд.[TEST] [VIP] Features Manager (DEV) или более гибкий Модуль плагина - [VIP] Features Manager
PHP:#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <csgo_colors> #define PLUGIN_NAME "Stop Map Music" #define PLUGIN_VERSION "1.0.0" #define MAX_EDICTS 2048 new Float:g_fCmdTime[MAXPLAYERS+1]; new g_iSoundEnts[MAX_EDICTS]; new g_iNumSounds; new bool:disabled[MAXPLAYERS + 1]; public Plugin:myinfo = { name = PLUGIN_NAME, author = "GoD-Tony [Fixed by The Count]", description = "Allows clients to stop ambient sounds played by the map", version = PLUGIN_VERSION, url = "http://www.sourcemod.net/" }; public OnPluginStart() { CreateConVar("sm_stopmusic_version", PLUGIN_VERSION, "Stop Map Music", 0|FCVAR_NOTIFY|FCVAR_DONTRECORD); HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); RegConsoleCmd("sm_music", Command_StopMusic, "Toggles map music"); CreateTimer(0.0, Post_Start, _, TIMER_REPEAT); } public OnClientDisconnect_Post(client) { g_fCmdTime[client] = 0.0; disabled[client] = false; } public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { g_iNumSounds = 0; UpdateSounds(); CreateTimer(0.0, Post_Start); } public OnEntityCreated(entity, const String:classname[]){ if(!StrEqual(classname, "ambient_generic", false)){ return; } new String:sSound[PLATFORM_MAX_PATH]; GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound)); new len = strlen(sSound); if (len > 4 && (StrEqual(sSound[len-3], "mp3") || StrEqual(sSound[len-3], "wav"))){ g_iSoundEnts[g_iNumSounds++] = EntIndexToEntRef(entity); }else{ return; } new ent = -1; for(new i=1;i<=MaxClients;i++){ if(!disabled[i] || !IsClientInGame(i)){ continue; } for (new u=0; u<g_iNumSounds; u++){ ent = EntRefToEntIndex(g_iSoundEnts[u]); if (ent != INVALID_ENT_REFERENCE){ GetEntPropString(ent, Prop_Data, "m_iszSound", sSound, sizeof(sSound)); Client_StopSound(i, ent, SNDCHAN_STATIC, sSound); } } } } UpdateSounds(){ new String:sSound[PLATFORM_MAX_PATH]; new entity = INVALID_ENT_REFERENCE; while ((entity = FindEntityByClassname(entity, "ambient_generic")) != INVALID_ENT_REFERENCE) { GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound)); new len = strlen(sSound); if (len > 4 && (StrEqual(sSound[len-3], "mp3") || StrEqual(sSound[len-3], "wav"))) { g_iSoundEnts[g_iNumSounds++] = EntIndexToEntRef(entity); } } } public Action:Post_Start(Handle:timer){ if(GetClientCount() <= 0){ return Plugin_Continue; } new String:sSound[PLATFORM_MAX_PATH]; new entity = INVALID_ENT_REFERENCE; for(new i=1;i<=MaxClients;i++){ if(!disabled[i] || !IsClientInGame(i)){ continue; } for (new u=0; u<g_iNumSounds; u++){ entity = EntRefToEntIndex(g_iSoundEnts[u]); if (entity != INVALID_ENT_REFERENCE){ GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound)); Client_StopSound(i, entity, SNDCHAN_STATIC, sSound); } } } return Plugin_Continue; } public Action:Command_StopMusic(client, args) { if (!client || g_fCmdTime[client] > GetGameTime()) return Plugin_Handled; if(disabled[client]){ disabled[client] = false; CGOPrintToChat(client, "[SM]: Музыка {GREEN}включиться {DEFAULT}на следующем треке..."); return Plugin_Handled; } g_fCmdTime[client] = GetGameTime() + 0.0; CGOPrintToChat(client, "[SM]: Музыка на карте {RED}выключена{DEFAULT}..."); new String:sSound[PLATFORM_MAX_PATH], entity; for (new i = 0; i < g_iNumSounds; i++) { entity = EntRefToEntIndex(g_iSoundEnts[i]); if (entity != INVALID_ENT_REFERENCE) { GetEntPropString(entity, Prop_Data, "m_iszSound", sSound, sizeof(sSound)); Client_StopSound(client, entity, SNDCHAN_STATIC, sSound); } } disabled[client] = true; return Plugin_Handled; } stock Client_StopSound(client, entity, channel, const String:name[]) { EmitSoundToClient(client, name, entity, channel, SNDLEVEL_NONE, SND_STOP, 0.0, SNDPITCH_NORMAL, _, _, _, true); }