Config to compile with single precision

Config to compile with single precision

[DEFAULT]
include_f = -I $${HDF5_ROOT-/usr}/include

[main]
fc = gfortran
cc = gcc
cxx = g++
cppflags = -DSINGLE_PRECISION
ld = gfortran
ldflags = -L ${HOME}/lib -L $${HDF5_ROOT-/usr}/lib -L/usr/local/lib
libs = -ltrlan -llapack -lblas -lstdc++ -lhdf5_fortran -lhdf5 -lz -luuid -llua -ldl
f90_module_flag = -J

[opt]
fflags = %(include_f)s -O3 -mfpmath=sse -msse2
cflags = -O3 -mfpmath=sse -msse2
cxxflags = -O3 -mfpmath=sse -msse2

[dbg]
fflags = %(include_f)s -g -fbounds-check -Wall -Wextra -fbacktrace -mfpmath=sse -msse2
cflags = -g -Wall -Wextra -fbacktrace -mfpmath=sse -msse2
cxxflags = -g -Wall -Wextra -fbacktrace -mfpmath=sse -msse2

error: pathspec 'config/gfortran.sp' did not match any file(s) known to git


Fix players not respawning in spawnpoints when joining mid-round

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cjlesiw/arena-respawn.git/'


Stop spamming inputs to item_teamflags

Stop spamming inputs to item_teamflags


Introduce round winlimit cvar

Introduce round winlimit cvar


tweaked diode filter example

tweaked diode filter example

(
_seq "0 3 -7 -2" gen_vals
_clk var
_dry var
_bpm 135 varset
0 _bpm get 4 clock _clk set

_clk get 0 _seq tseq 40 + _clk get 0.3 maygate 12 * +
_clk get 0.6 maygate 0.002 0.01 branch port mtof 0.8 saw
30 inv 1 sine 300 3000 biscale 0.75 0.96 (0.1 1 1 randh) randi diode
2 0.3 0.1 0.0 dist
_clk get 0.001 0.1 0.1 tenvx *

_dry set

_dry get 500 buthp dup 0.91 8000 revsc drop -10 ampdb *
_dry get 1000 buthp 0.7 _bpm get bpm2dur 0.75 *  delay 1000 butlp +

_dry get +
)

_seq "0 3 -7 -2" gen_vals
_clk var
_dry var
_bpm 135 varset
0 _bpm get 4 clock _clk set

_clk get 0 _seq tseq 40 + _clk get 0.3 maygate 12 * +
_clk get 0.6 maygate 0.002 0.01 branch port mtof 0.8 saw
30 inv 1 sine 300 3000 biscale 0.75 0.96 (0.1 1 1 randh) randi diode
2 0.5 0.1 0.0 dist

_dry set

_dry get 500 buthp dup 0.91 8000 revsc drop -10 ampdb *
_dry get 1000 buthp 0.7 _bpm get bpm2dur 0.75 *  delay 1000 butlp +

_dry get +


Reduce heads preserved on death from 100% to 50%


Decrease frequency of dispensed ammo

Decrease frequency of dispensed ammo


Add LastStanding.sp

Add LastStanding.sp

//(C) 2020 rrrfffrrr <rrrfffrrr@naver.com>

/// TODO
// Attach sprite to player classes to show when player injured.
// Localization

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo = {
	name		= "[INS] Last Standing",
	author		= "rrrfffrrr",
	description	= "Get down and use only pistol when injured",
	version		= "0.8.3",
	url			= ""
};

#include <sourcemod>
#include <convars>
#include <clients>
#include <halflife>
#include <sdkhooks>
#include <sdktools_engine>
#include <sdktools_functions>
#include <timers>

#define TEAM_OBSERVER 1
#define TEAM_SECURITY 2
#define TEAM_INSURGENT 3

#define IN_JUMP		(1 << 1)
#define IN_CROUCH_HOLD	(1 << 2)
#define IN_PRONE	(1 << 3)
#define IN_USE		(1 << 6)
#define IN_RUN		(1 << 15)
#define IN_CROUCH	(1 << 24)
#define IN_RUN_TOGGLE	(1 << 26)
#define IN_CHANGE_STANCE	(1 << 29)

ConVar g_Cvar_DamageThresholdToDeath;
ConVar g_Cvar_LastStandingPerSpawn;
ConVar g_Cvar_ReviveDelay;
ConVar g_Cvar_ReviveDistance;
ConVar g_Cvar_Damage;
ConVar g_Cvar_R;
ConVar g_Cvar_G;
ConVar g_Cvar_B;

bool IsInjured[MAXPLAYERS + 1];
int LastStandingRemain[MAXPLAYERS + 1];

int RevivingTarget[MAXPLAYERS + 1];
Handle RevivingDelay[MAXPLAYERS + 1];

bool LastUseButton[MAXPLAYERS + 1];

Handle DamageTimer = INVALID_HANDLE;

public void OnPluginStart() {
	g_Cvar_DamageThresholdToDeath = CreateConVar("sm_ls_damage", "100.0", "Need more damage then health to get killed at once.", FCVAR_PROTECTED, true, 0.0);
	g_Cvar_LastStandingPerSpawn = CreateConVar("sm_ls_num", "1", "How many times can be last standing. (-1 = infinity)", FCVAR_PROTECTED, true, -1.0);
	g_Cvar_ReviveDelay = CreateConVar("sm_ls_revivetime", "10.0", "Delay to revive.", FCVAR_PROTECTED, true, 1.0);
	g_Cvar_ReviveDistance = CreateConVar("sm_ls_distance", "200.0", "Distance limit to revive.", FCVAR_PROTECTED, true, 1.0);
	g_Cvar_Damage = CreateConVar("sm_ls_damage", "0.01", "Damage per 1 second.", FCVAR_PROTECTED, false, 0, true, 20.0);

	g_Cvar_R = CreateConVar("sm_ls_r", "255", "Red color of injured player.", FCVAR_PROTECTED, true, 0, true, 255);
	g_Cvar_G = CreateConVar("sm_ls_g", "100", "Green color of injured player.", FCVAR_PROTECTED, true, 0, true, 255);
	g_Cvar_B = CreateConVar("sm_ls_b", "100", "Blue color of injured player.", FCVAR_PROTECTED, true, 0, true, 255);

	HookEvent("player_spawn", Event_PlayerSpawn);
	HookEvent("player_death", Event_PlayerDeath);

    HookAllPlayers();
}

void OnMapStart() {
	DamageTimer = CreateTimer(1.0, TIMER_DamageInjuredPlayers, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}

/// HOOK
void HookAllPlayers() {
    for (int i = 1; i <= MaxClients; i++) {
        if (IsClientAndInGame(i)) {
            OnClientPostAdminCheck(i);
        }
    }
}

public void OnClientPostAdminCheck(int client) {
	IsInjured[client] = false;
	RevivingTarget[client] = 0;
    SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public void OnClientDisconnect(int client) {
	IsInjured[client] = false;
	KillReviveTimer(client);
    SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

/// COMMAND
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float[3] vel, float[3] angles, int& weapon) {
	if (IsValidPlayer(client) && IsPlayerAlive(client) && buttons != 0) {
		if (IsInjured[client]) {
			// cannot stand or crouch when injured
			buttons &= ~(IN_JUMP | IN_PRONE | IN_CROUCH | IN_RUN | IN_CROUCH_HOLD | IN_RUN_TOGGLE | IN_CHANGE_STANCE);
			if (GetEntProp(client, Prop_Send, "m_iCurrentStance") != 2) { // Dead when enter water
				ForcePlayerSuicide(client);
			}
			return Plugin_Changed;
		}

		if (!IsFakeClient(client)) {
			int hPlayer = -1;
			if (buttons & IN_USE != 0) { // When pressing
				if (RevivingTarget[client] <= 0 && LastUseButton[client] == false) { // Check no target has been reviving and use button pressed now
					hPlayer = GetClientAimTarget(client, false);
					if (hPlayer != -1) {
				        char strCname[128];
				        GetEntityClassname(hPlayer, strCname, sizeof(strCname));
			         	if (IsValidEdict(hPlayer) && IsValidEntity(hPlayer) && StrEqual(strCname, "player", false))	{// Player have fixed entity number so we can use 0 < hPlayer <= MaxClients to check it.
        					if (GetClientTeam(hPlayer) == GetClientTeam(client) && IsInjured[hPlayer]) { // Check team and target is injured.
        						if (IsBeingRevived(hPlayer)) {
        							PrintHintText(client, "Some one is reviving target.");
        						} else {
        							float tpos[3];
        							float cpos[3];
        							GetClientEyePosition(client, cpos);
        							GetClientEyePosition(hPlayer, tpos);
        							if (GetVectorDistance(cpos, tpos, false) < g_Cvar_ReviveDistance.FloatValue) { // Check distance
	        							GetClientName(hPlayer, strCname, sizeof(strCname));
	        							PrintHintText(client, "You are reviving %s.", strCname);
	        							GetClientName(client, strCname, sizeof(strCname));
	        							PrintHintText(hPlayer, "%s is reviving you.", strCname);
	        							RevivingTarget[client] = hPlayer;
	        							RevivingDelay[client] = CreateTimer(g_Cvar_ReviveDelay.FloatValue, TIMER_RevivePlayer, client);
	        						}
        						}
        					}
        				}
	      			}
	      		} else if (RevivingTarget[client] > 0) {
					hPlayer = GetClientAimTarget(client, false);
					if (hPlayer != RevivingTarget[client]) {
						KillReviveTimer(client);
					}
				}
			} else {
				KillReviveTimer(client);
			}

			LastUseButton[client] = buttons & IN_USE != 0;
		}
	}
	return Plugin_Continue;
}

/// DAMAGE TIMER
Action TIMER_DamageInjuredPlayers(Handle timer) {
	for(int i = 1; i <= MaxClients; ++i) {
		if (IsValidPlayer(i) && IsPlayerAlive(i) && IsInjured[i]) {
			SDKHooks_TakeDamage(i, i, i, g_Cvar_Damage.FloatValue, DMG_GENERIC, -1, NULL_VECTOR, NULL_VECTOR);
		}
	}
	return Plugin_Continue;
}

/// REVIVE TIMER
Action TIMER_RevivePlayer(Handle timer, int caller) {
	OnRevived(RevivingTarget[caller]);
    PrintHintText(RevivingTarget[caller], "You have been revived.");
	RevivingTarget[caller] = 0;
	return Plugin_Stop;
}

void KillReviveTimer(int client) {
	if (RevivingTarget[client] > 0) {
		RevivingTarget[client] = 0;
		KillTimer(RevivingDelay[client]);
	}
}

/// SPAWN DEATH
public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) {
	int client = GetClientOfUserId(event.GetInt("userid"));
	IsInjured[client] = false;
	RevivingTarget[client] = 0;
	LastStandingRemain[client] = g_Cvar_LastStandingPerSpawn.IntValue;
}
public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) {
	int client = GetClientOfUserId(event.GetInt("userid"));
	IsInjured[client] = false;
	SetEntityRenderColor(client, 255, 255, 255);
	KillReviveTimer(client);
}

/// ON DAMAGE
public Action OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
	if (!IsClientAndInGame(victim) || !IsClientAndInGame(attacker) || damage == 0.0 || IsFakeClient(victim) || IsInjured[victim]) { return Plugin_Continue; }

	int health = GetClientHealth(victim);
	if (IsInjured[victim] == false && (LastStandingRemain[victim] > 0 || -1 == LastStandingRemain[victim]) && health <= damage && damage < health + g_Cvar_DamageThresholdToDeath.FloatValue && CountTeamAliveWithoutCaller(victim) > 0) {
		damage = health - 20.0;
		OnInjured(victim);
		return Plugin_Changed;
	}

	return Plugin_Continue;
}

/// INJURED
void OnInjured(int client) {
	IsInjured[client] = true;
	LastStandingRemain[client]--;
	SetEntProp(client, Prop_Send, "m_iCurrentStance", 2);
	SetEntityRenderColor(client, g_Cvar_R.IntValue, g_Cvar_G.IntValue, g_Cvar_B.IntValue);
}

void OnRevived(int client) {
	IsInjured[client] = false;
	SetEntityRenderColor(client, 255, 255, 255);
}

// util
bool IsValidPlayer(int client)
{
	if (!(client > 0 && client < MaxClients))
		return false;

	if (!IsClientConnected(client))
		return false;

	if (!IsClientInGame(client))
		return false;

	return true;
}

bool IsClientAndInGame(int client)
{
    if (client > 0 && client < MaxClients)
    {
        return IsClientInGame(client);
    }
    return false;
}

int CountTeamAliveWithoutCaller(int client) {
	int count = 0;
	int team = GetClientTeam(client);

	for(int i = 1; i <= MaxClients; ++i) {
		if (client != i && IsValidPlayer(i) && IsPlayerAlive(i) && GetClientTeam(i) == team) {
			count++;
		}
	}

	return count;
}

bool IsBeingRevived(int client) {
	for(int i = 1; i <= MaxClients; ++i) {
		if (client != i && RevivingTarget[i] == client) {
			return true;
		}
	}

	return false;
}

error: pathspec 'scripting/LastStanding.sp' did not match any file(s) known to git


Increase flag spawn delay on round start


simple port data plugin

simple port data plugin

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

public void OnPluginStart()
{
    char path[2][128], map[128];
    BuildPath(Path_SM, path[0], 128, "configs/mapdata.txt");
    BuildPath(Path_SM, path[1], 128, "configs/mapdata.kv");

    ArrayList maps = GetAllMapsName();
    KeyValues oldk = new KeyValues("MapData");
    KeyValues newk = new KeyValues("MapData");

    if (!oldk.ImportFromFile(path[0]))
        SetFailState("Failed to import from [%s]", path[0]);

    if (!newk.ImportFromFile(path[1]))
        SetFailState("Failed to import from [%s]", path[1]);

    for(int index = 0; index < maps.Length; index++)
    {
        oldk.Rewind();
        newk.Rewind();

        maps.GetString(index, map, 128);

        if (!oldk.JumpToKey(map, false))
        {
            LogMessage("Failed to jump from old: %s", map);
            continue;
        }

        if (!newk.JumpToKey(map, false))
        {
            LogMessage("Failed to jump from new: %s", map);
            continue;
        }

        char temp[128];
        oldk.GetString("Desc", temp, 128);
        Format(temp, 128, "%s %s", oldk.GetNum("Nice", 0) == 1 ? "*神图*" : "*咸鱼*", temp);
        newk.SetString("m_Description",   temp);
        newk.SetString("m_CertainTimes", "all");

        newk.SetNum("m_Price", oldk.GetNum("price", 1000));
        newk.SetNum("m_PricePartyBlock", oldk.GetNum("price", 1000) * 10);
        newk.SetNum("m_MinPlayers", oldk.GetNum("minplayers", 1000));
        newk.SetNum("m_MaxPlayers", oldk.GetNum("maxplayers", 1000));
        newk.SetNum("m_MaxCooldown", 100);
        newk.SetNum("m_NominateOnly", oldk.GetNum("OnlyNomination", 0));
        newk.SetNum("m_VipOnly", oldk.GetNum("OnlyAdmin", 0));
        newk.SetNum("m_AdminOnly", oldk.GetNum("OnlyVIP", 0));
    }

    oldk.Rewind();
    newk.Rewind();

    newk.ExportToFile(path[1]);
}

stock ArrayList GetAllMapsName()
{
    ArrayList maps = new ArrayList(ByteCountToCells(128));

    DirectoryListing dir = OpenDirectory("maps");
    if (dir == null)
    {
        LogError("GetAllMapsName -> Failed to open maps.");
        return maps;
    }

    FileType type = FileType_Unknown;
    char map[128];
    while(dir.GetNext(map, 128, type))
    {
        if (type != FileType_File || StrContains(map, ".bsp", false) == -1)
            continue;

        int c = FindCharInString(map, '.', true);
        map[c] = '\0';

        if (!IsMapValid(map))
        {
            LogError("GetAllMapsName -> %s is invalid map.", map);
            continue;
        }

        maps.PushString(map);
    }

    delete dir;
    return maps;
}

error: pathspec 'portdata.sp' did not match any file(s) known to git


Create helloworld.sp

Create helloworld.sp

error: pathspec 'examples/helloworld.sp' did not match any file(s) known to git


added mincerbuf example for Andrew

added mincerbuf example for Andrew

# Create buffer with length 80000 samples
'buf' 80000 zeros

# Create a sequence
'seq' '0 2 7 11 14 4 2' gen_vals

# our maygate clock with a guaranteed start
tick 1 metro 0.7 maytrig +
# duplicate the clock signal for tseq and pluck
dup

# sequence through the table
0 'seq' tseq
# bias 61 (Db major) and convert to frequency for pluck
61 + mtof
0.5 400 pluck 1000 butlp

# delayz for dayz
dup 0.6 0.75 delay 1000 buthp 0.7 * +

# reverb
dup dup 10 10 8000 zrev 0.5 * drop +

# duplicate our entire signal and record it in buffer
dup tick 'buf' tblrec

# mincer object shuffles through recording buffer
0 'buf' tbldur 10 randi 1 1 'buf' mincer

# Sum mincer with everything else
+

error: pathspec 'examples/mincerbuf.sp' did not match any file(s) known to git


Added test file

Added test file

Running Job 1 of 1 /scratch1/scratchdirs/ewcss/with_water/49_18490/pro_84283.in
qchem /scratch1/scratchdirs/ewcss/with_water/49_18490/pro_84283.in_3444.0 /tmp/qchem3444/ 1
srun -n 1 /global/common/edison/software/qchem/5.1beta/exe/qcprog.exe /scratch1/scratchdirs/ewcss/with_water/49_18490/pro_84283.in_3444.0 /tmp/qchem3444/

Process 0 of 1 is on nid04222 - thread support 0
initial socket setup ...start
initial socket setup ...done
now start server 0 ...
Check license passed

                  Welcome to Q-Chem
     A Quantum Leap Into The Future Of Chemistry

 Q-Chem 5.1, Q-Chem, Inc., Pleasanton, CA (2018)

 Yihan Shao,  Zhengting Gan,  E. Epifanovsky,  A. T. B. Gilbert,  M. Wormit,
 J. Kussmann,  A. W. Lange,  A. Behn,  Jia Deng,  Xintian Feng,  D. Ghosh,
 M. Goldey,  P. R. Horn,  L. D. Jacobson,  I. Kaliman,  T. Kus,  A. Landau,
 Jie Liu,  E. I. Proynov,  R. M. Richard,  R. P. Steele,  E. J. Sundstrom,
 H. L. Woodcock III,  P. M. Zimmerman,  D. Zuev,  B. Albrecht,  E. Alguire,
 S. A. Baeppler,  D. Barton,  Z. Benda,  Y. A. Bernard,  E. J. Berquist,
 K. B. Bravaya,  H. Burton,  D. Casanova,  Chun-Min Chang,  Yunqing Chen,
 A. Chien,  K. D. Closser,  M. P. Coons,  S. Coriani,  S. Dasgupta,
 A. L. Dempwolff,  M. Diedenhofen,  Hainam Do,  R. G. Edgar,  Po-Tung Fang,
 S. Faraji,  S. Fatehi,  Qingguo Feng,  K. D. Fenk,  J. Fosso-Tande,
 Qinghui Ge,  A. Ghysels,  G. Gidofalvi,  J. Gomes,  J. Gonthier,  A. Gunina,
 D. Hait,  M. W. D. Hanson-Heine,  P. H. P. Harbach,  A. W. Hauser,
 J. E. Herr,  E. G. Hohenstein,  Z. C. Holden,  Kerwin Hui,  B. C. Huynh,
 T.-C. Jagau,  Hyunjun Ji,  B. Kaduk,  K. Khistyaev,  Jaehoon Kim,
 P. Klunzinger,  K. Koh,  D. Kosenkov,  L. Koulias,  T. Kowalczyk,
 C. M. Krauter,  A. Kunitsa,  Ka Un Lao,  A. Laurent,  K. V. Lawler,
 Joonho Lee,  D. Lefrancois,  S. Lehtola,  D. S. Levine,  Yi-Pei Li,
 You-Sheng Lin,  Fenglai Liu,  E. Livshits,  A. Luenser,  P. Manohar,
 E. Mansoor,  S. F. Manzer,  Shan-Ping Mao,  Yuezhi Mao,  N. Mardirossian,
 A. V. Marenich,  T. Markovich,  L. A. Martinez-Martinez,  S. A. Maurer,
 N. J. Mayhall,  S. C. McKenzie,  J.-M. Mewes,  A. F. Morrison,
 J. W. Mullinax,  K. Nanda,  T. S. Nguyen-Beck,  R. Olivares-Amaya,
 J. A. Parkhill,  T. M. Perrine,  F. Plasser,  P. Pokhilko,  S. Prager,
 A. Prociuk,  E. Ramos,  D. R. Rehn,  F. Rob,  M. Schneider,  N. Sergueev,
 S. M. Sharada,  S. Sharma,  D. W. Small,  T. Stauch,  T. Stein,
 Yu-Chuan Su,  A. J. W. Thom,  A. Tkatchenko,  T. Tsuchimochi,  N. M. Tubman,
 L. Vogt,  M. L. Vidal,  O. Vydrov,  M. A. Watson,  J. Wenzel,
 M. de Wergifosse,  T. A. Wesolowski,  A. White,  J. Witte,  A. Yamada,
 Jun Yang,  K. Yao,  S. Yeganeh,  S. R. Yost,  Zhi-Qiang You,  A. Zech,
 Igor Ying Zhang,  Xing Zhang,  Yan Zhao,  Ying Zhu,  B. R. Brooks,
 G. K. L. Chan,  C. J. Cramer,  M. S. Gordon,  W. J. Hehre,  A. Klamt,
 M. W. Schmidt,  C. D. Sherrill,  D. G. Truhlar,  A. Aspuru-Guzik,  R. Baer,
 A. T. Bell,  N. A. Besley,  Jeng-Da Chai,  R. A. DiStasio Jr.,  A. Dreuw,
 B. D. Dunietz,  T. R. Furlani,  Chao-Ping Hsu,  Yousung Jung,  Jing Kong,
 D. S. Lambrecht,  WanZhen Liang,  C. Ochsenfeld,  V. A. Rassolov,
 L. V. Slipchenko,  J. E. Subotnik,  T. Van Voorhis,  J. M. Herbert,
 A. I. Krylov,  P. M. W. Gill,  M. Head-Gordon

 Contributors to earlier versions of Q-Chem not listed above:
 R. D. Adamson,  B. Austin,  J. Baker,  G. J. O. Beran,  K. Brandhorst,
 S. T. Brown,  E. F. C. Byrd,  A. K. Chakraborty,  C.-L. Cheng,
 Siu Hung Chien,  D. M. Chipman,  D. L. Crittenden,  H. Dachsel,
 R. J. Doerksen,  A. D. Dutoi,  L. Fusti-Molnar,  W. A. Goddard III,
 A. Golubeva-Zadorozhnaya,  S. R. Gwaltney,  G. Hawkins,  A. Heyden,
 S. Hirata,  G. Kedziora,  F. J. Keil,  C. Kelley,  Jihan Kim,  R. A. King,
 R. Z. Khaliullin,  P. P. Korambath,  W. Kurlancheek,  A. M. Lee,  M. S. Lee,
 S. V. Levchenko,  Ching Yeh Lin,  D. Liotard,  R. C. Lochan,  I. Lotan,
 P. E. Maslen,  N. Nair,  D. P. O'Neill,  D. Neuhauser,  E. Neuscamman,
 C. M. Oana,  R. Olson,  B. Peters,  R. Peverati,  P. A. Pieniazek,
 Y. M. Rhee,  J. Ritchie,  M. A. Rohrdanz,  E. Rosta,  N. J. Russ,
 H. F. Schaefer III,  N. E. Schultz,  N. Shenvi,  A. C. Simmonett,  A. Sodt,
 D. Stuck,  K. S. Thanthiriwatte,  V. Vanovschi,  Tao Wang,  A. Warshel,
 C. F. Williams,  Q. Wu,  X. Xu,  W. Zhang

 Please cite Q-Chem as follows:
 Y. Shao et al., Mol. Phys. 113, 184-215 (2015)
 DOI: 10.1080/00268976.2014.952696

 Q-Chem 5.1.0 for Intel X86 EM64T Linux

 Parts of Q-Chem use Armadillo 8.300.2 (Tropical Shenanigans).
 http://arma.sourceforge.net/

 Q-Chem begins on Wed Jul 18 15:01:11 2018

Host: edison07
0

     Scratch files written to /tmp/qchem3444//
 Apr1918  _RNUM -1
 Parallel job on  1  processors
Processing $rem in /global/common/edison/software/qchem/5.1beta/config/preferences.
 MEM_TOTAL  2000
Symmetry turned off for PCM/SM12/SMD calculation

Checking the input file for inconsistencies... 	...done.

--------------------------------------------------------------
User input:
--------------------------------------------------------------
$molecule
0 1
C      0.0415516930      0.7712256316      0.6868700692
C      0.0413043320     -0.7716464053      0.6864292028
C      1.1654514144      1.0638666809     -0.3642503655
C     -1.3259426414      1.1696623200      0.1499475393
C      1.1651221037     -1.0640385729     -0.3648507682
C     -1.3263171103     -1.1693341021      0.1492703311
O      0.9479578270      0.0002001221     -1.2862070597
C      2.4804055128      0.6653534066      0.2884399855
N     -2.0320556810      0.0003479012     -0.0947194067
O     -1.7352971237      2.2874351433     -0.0482862834
C      2.4801954153     -0.6662967635      0.2880753610
O     -1.7360362803     -2.2868616135     -0.0495918074
H      0.2199564813      1.2521014449      1.6498455446
H      0.2195489412     -1.2531272149      1.6491307411
H      1.0977218374      2.0324358223     -0.8562105233
H      1.0971136057     -2.0323193955     -0.8573398946
H      3.1940513154      1.3470519857      0.7328985074
H     -2.9511444167      0.0006167870     -0.5172062183
H      3.1936399211     -1.3484637349      0.7321398845
$end

$rem
job_type = sp
method = wb97x-d
basis = 6-311++g(d,p)
max_scf_cycles = 200
gen_scfman = True
scf_algorithm = diis
solvent_method = pcm
$end

$pcm
theory iefpcm
$end

$solvent
dielectric 80.4
$end
--------------------------------------------------------------
 ----------------------------------------------------------------
             Standard Nuclear Orientation (Angstroms)
    I     Atom           X                Y                Z
 ----------------------------------------------------------------
    1      C       0.0415516930     0.7712256316     0.6868700692
    2      C       0.0413043320    -0.7716464053     0.6864292028
    3      C       1.1654514144     1.0638666809    -0.3642503655
    4      C      -1.3259426414     1.1696623200     0.1499475393
    5      C       1.1651221037    -1.0640385729    -0.3648507682
    6      C      -1.3263171103    -1.1693341021     0.1492703311
    7      O       0.9479578270     0.0002001221    -1.2862070597
    8      C       2.4804055128     0.6653534066     0.2884399855
    9      N      -2.0320556810     0.0003479012    -0.0947194067
   10      O      -1.7352971237     2.2874351433    -0.0482862834
   11      C       2.4801954153    -0.6662967635     0.2880753610
   12      O      -1.7360362803    -2.2868616135    -0.0495918074
   13      H       0.2199564813     1.2521014449     1.6498455446
   14      H       0.2195489412    -1.2531272149     1.6491307411
   15      H       1.0977218374     2.0324358223    -0.8562105233
   16      H       1.0971136057    -2.0323193955    -0.8573398946
   17      H       3.1940513154     1.3470519857     0.7328985074
   18      H      -2.9511444167     0.0006167870    -0.5172062183
   19      H       3.1936399211    -1.3484637349     0.7321398845
 ----------------------------------------------------------------
 Nuclear Repulsion Energy =   721.3234168252 hartrees
 There are       43 alpha and       43 beta electrons
 Requested basis set is 6-311++G(d,p)
 There are 107 shells and 313 basis functions

 Total QAlloc Memory Limit   2000 MB
 Mega-Array Size       188 MB
 MEM_STATIC part       192 MB
 Discretize the solute cavity surface with Lebedev spheres
	Using 302 Lebedev grid points for each H atom
	Using 302 Lebedev grid points for other atoms
	Atomic van der Waals radii will be scaled by 1.20
 Remove points where switching function is < 1.0e-08
 Keep 2264 surface tesserae and discard 3474 interior tesserae
 Molecular Surface Area = 182.118 Angst**2
 A cutoff of  1.0D-08 yielded   4907 shell pairs
 There are     43178 function pairs (     46453 Cartesian)

 -------------------------------------------------------
 OpenMP Integral Computing Module
 Release: version 1.0, May 2013, Q-Chem Inc. Pittsburgh
 -------------------------------------------------------
 Integral Job Info:
 Integral job number is                      11
 Integral operator is                         1
 short-range coefficients              22203600
 long-range coefficients              100000000
 Omega coefficients                         200
 if combine SR and LR in K                    1
 Integral screening is                        0
 Integral computing path is                   2
 max size of driver memory is            800000
 size of driver memory is                593474
 size of scratch memory is              2428936
 max col of scratch BK array               1296
 max len of scratch array in speh3          155
 max len of scratch index in speh4           18
 max int batch size is                      520
 min int batch size is                       52
 fixed nKL is                                52
 max L of basis functions is                  2
 order of int derivative is                   0
 number of shells is                        107
 number of basis is                         325
 number of cartesian basis is               325
 number of contracted shell pairs          4907
 number of primitive shell pairs          11928
 maxK2 (contraction) of shell pair           36
 max number of K2 of shell pair               1
 max number of CS2 of shell pair            788
 max number of PS2 of shell pair           2232
 mem total for path MDJ                  591676
 -------------------------------------------------------
 Smallest overlap matrix eigenvalue = 1.95E-06

 Q-Chem warning in module stvman/mkSTV.C, line 295:

 Overlap eigenvalue is smaller than square root of threshold

 Scale SEOQF with 1.000000e-01/1.000000e-01/1.000000e-01

 Standard Electronic Orientation quadrupole field applied
 Nucleus-field energy     =     0.0000000150 hartrees
 Guess from superposition of atomic densities
 Warning:  Energy on first SCF cycle will be non-variational
 SAD guess density has 86.000000 electrons

 -----------------------------------------------------------------------
  General SCF calculation program by
  Eric Jon Sundstrom, Paul Horn, Yuezhi Mao, Dmitri Zuev, Alec White,
  David Stuck, Shaama M.S., Shane Yost, Joonho Lee, David Small,
  Daniel Levine, Susi Lehtola, Hugh Burton, Evgeny Epifanovsky
 -----------------------------------------------------------------------
 Exchange:     0.2220 Hartree-Fock + 1.0000 wB97X-D + LR-HF
 Correlation:  1.0000 wB97X-D
 Using SG-2 standard quadrature grid
 Dispersion:   Grimme D
 using 24 threads for integral computing
 -------------------------------------------------------
 OpenMP Integral computing Module
 Release: version 1.0, May 2013, Q-Chem Inc. Pittsburgh
 -------------------------------------------------------
 using 24 threads for integral computing
 -------------------------------------------------------
 OpenMP Integral computing Module
 Release: version 1.0, May 2013, Q-Chem Inc. Pittsburgh
 -------------------------------------------------------
 -------------------------------------------------------
 OpenMP BLAS3 based DFT computing Module
 Release: version 1.0, May 2013, Q-Chem Inc. Pittsburgh
 -------------------------------------------------------
 A restricted SCF calculation will be
 performed using DIIS
 SCF converges when DIIS error is below 1.0e-05
 ---------------------------------------
  Cycle       Energy         DIIS error
 ---------------------------------------
 Using non-symmetric K matrix
 Warning: not using a symmetric Q
    1    -593.2119039809      3.83e-02
    2    -589.2430203773      4.71e-03
    3    -589.0958846275      6.65e-03
    4    -589.4572560170      6.37e-04
    5    -589.4607780082      3.01e-04
    6    -589.4616307245      7.31e-05
    7    -589.4616854043      2.79e-05
    8    -589.4616946463      6.61e-06  Convergence criterion met
 ---------------------------------------
 SCF time:   CPU 371.33s  wall 30.00s
 SCF   energy in the final basis set =     -589.4616946463

************** Final PCM Free Energy Summary **************
 G_electrostatic  =      -0.02563912 hartree =     -16.08879339 kcal/mol
 G_cavitation     =       0.00000000 hartree =       0.00000000 kcal/mol
 G_dispersion     =       0.00000000 hartree =       0.00000000 kcal/mol
 G_repulsion      =       0.00000000 hartree =       0.00000000 kcal/mol
 --------------------------------------------------
 Non-electrostatic Free Energy =       0.00000000 hartree =       0.00000000 kcal/mol
 Total                         =      -0.02563912 hartree =     -16.08879339 kcal/mol
 --------------------------------------------------
 SCF Energy (H0 + V/2)                       =    -589.46169465
 Solute Internal Energy (H0)                 =    -589.43605552
 Total Free Energy (H0 + V/2 + non-elec)     =    -589.46169465 hartree
                                             = -369892.79618227 kcal/mol
***********************************************************

 --------------------------------------------------------------

                    Orbital Energies (a.u.)
 --------------------------------------------------------------

 Alpha MOs
 -- Occupied --
-19.272 -19.254 -19.254 -14.491 -10.424 -10.424 -10.360 -10.360
-10.319 -10.318 -10.297 -10.296  -1.198  -1.184  -1.175  -1.067
 -0.935  -0.893  -0.869  -0.776  -0.735  -0.709  -0.673  -0.662
 -0.642  -0.617  -0.590  -0.568  -0.552  -0.536  -0.533  -0.520
 -0.502  -0.494  -0.482  -0.458  -0.454  -0.436  -0.393  -0.386
 -0.375  -0.361  -0.347
 -- Virtual --
  0.030   0.044   0.055   0.058   0.060   0.060   0.073   0.078
  0.082   0.085   0.106   0.111   0.112   0.122   0.144   0.148
  0.155   0.157   0.158   0.161   0.169   0.171   0.174   0.177
  0.185   0.186   0.188   0.192   0.203   0.207   0.209   0.214
  0.223   0.226   0.230   0.242   0.249   0.251   0.260   0.264
  0.276   0.278   0.279   0.284   0.291   0.300   0.309   0.321
  0.327   0.332   0.334   0.338   0.345   0.350   0.355   0.357
  0.371   0.376   0.380   0.383   0.390   0.391   0.396   0.410
  0.411   0.414   0.426   0.429   0.435   0.452   0.459   0.471
  0.476   0.491   0.520   0.521   0.526   0.534   0.575   0.597
  0.602   0.628   0.635   0.668   0.675   0.677   0.682   0.684
  0.713   0.723   0.729   0.733   0.755   0.766   0.767   0.778
  0.791   0.795   0.817   0.824   0.831   0.833   0.859   0.866
  0.885   0.906   0.912   0.918   0.938   0.949   0.952   0.981
  0.993   1.017   1.032   1.081   1.094   1.120   1.153   1.162
  1.198   1.218   1.223   1.239   1.266   1.268   1.289   1.298
  1.313   1.333   1.333   1.347   1.349   1.382   1.386   1.407
  1.418   1.447   1.532   1.536   1.584   1.599   1.607   1.642
  1.650   1.659   1.677   1.690   1.695   1.703   1.725   1.753
  1.768   1.772   1.809   1.829   1.841   1.847   1.859   1.862
  1.883   1.884   1.935   1.953   1.959   1.968   1.981   2.006
  2.009   2.014   2.070   2.093   2.094   2.135   2.185   2.190
  2.212   2.230   2.244   2.283   2.296   2.347   2.362   2.374
  2.387   2.424   2.445   2.467   2.530   2.568   2.587   2.609
  2.676   2.677   2.702   2.779   2.795   2.799   2.816   2.853
  2.866   2.881   2.902   2.912   2.930   2.962   2.966   2.979
  2.990   2.995   2.997   3.023   3.057   3.063   3.068   3.137
  3.177   3.181   3.240   3.254   3.276   3.362   3.372   3.416
  3.417   3.444   3.451   3.484   3.490   3.499   3.609   3.659
  3.663   3.685   3.909   3.972   3.984   4.036   4.091   4.147
  4.157   4.221   4.242   4.251   4.349   4.425   4.468   4.909
  5.082   5.164   5.182   5.285   5.331   5.331   5.595   5.705
  5.834   5.920  23.861  23.956  23.986  23.988  24.027  24.058
 24.131  24.446  35.727  50.081  50.133  50.198
 --------------------------------------------------------------

          Ground-State Mulliken Net Atomic Charges

     Atom                 Charge (a.u.)
  ----------------------------------------
      1 C                    -0.154204
      2 C                    -0.154151
      3 C                     0.060283
      4 C                    -0.020104
      5 C                     0.060229
      6 C                    -0.020132
      7 O                    -0.176235
      8 C                    -0.458574
      9 N                    -0.255738
     10 O                    -0.381719
     11 C                    -0.458497
     12 O                    -0.381719
     13 H                     0.343770
     14 H                     0.343766
     15 H                     0.372820
     16 H                     0.372819
     17 H                     0.242354
     18 H                     0.422673
     19 H                     0.242360
  ----------------------------------------
  Sum of atomic charges =     0.000000

 -----------------------------------------------------------------
                    Cartesian Multipole Moments
 -----------------------------------------------------------------
    Charge (ESU x 10^10)
                 0.0000
    Dipole Moment (Debye)
         X       3.1642      Y      -0.0014      Z       3.3355
       Tot       4.5976
    Quadrupole Moments (Debye-Ang)
        XX     -63.8237     XY      -0.0043     YY     -81.4798
        XZ       4.7718     YZ      -0.0046     ZZ     -68.0944
    Octopole Moments (Debye-Ang^2)
       XXX     -11.1706    XXY       0.0165    XYY      49.3440
       YYY      -0.0229    XXZ       4.5293    XYZ       0.0159
       YYZ       0.2723    XZZ      -8.8937    YZZ      -0.0000
       ZZZ       6.9994
    Hexadecapole Moments (Debye-Ang^3)
      XXXX   -1025.2561   XXXY      -0.0244   XXYY    -354.6936
      XYYY       0.0376   YYYY    -831.6631   XXXZ      57.2185
      XXYZ      -0.0475   XYYZ      -2.6445   YYYZ      -0.1178
      XXZZ    -222.6383   XYZZ       0.0100   YYZZ    -138.3112
      XZZZ       6.2788   YZZZ      -0.0615   ZZZZ    -203.9319
 -----------------------------------------------------------------
Archival summary:
1\1\nid04222\SP\ProcedureUnspecified\BasisUnspecified\3187\ewcss\WedJul1815:01:412018WedJul1815:01:412018\0\\#,ProcedureUnspecified,BasisUnspecified,\\0,1\O\C,1,1.42431\H,2,1.08846,1,111.253\C,1,1.42432,2,96.6609,3,-177.349,0\H,4,1.08846,1,111.252,2,177.35,0\C,4,1.52116,1,102.362,2,49.5126,0\H,6,1.08238,4,125.531,1,153.66,0\C,6,1.33165,4,105.173,1,-31.5946,0\H,8,1.08238,6,129.052,4,-174.495,0\C,4,1.56641,1,100.677,2,-60.153,0\H,10,1.09105,4,113.117,1,160.641,0\C,10,1.5222,4,111.038,1,-75.0546,0\O,12,1.20677,10,127.238,4,-69.7552,0\N,12,1.38772,10,107.383,4,109.474,0\H,14,1.01154,12,122.394,10,-175.744,0\C,14,1.38772,12,114.864,10,-2.37535,0\O,16,1.20677,14,125.374,12,-176.873,0\C,16,1.5222,14,107.383,12,2.37557,0\H,18,1.09105,16,110.051,14,124.499,0\\\@

 Total job time:  30.46s(wall), 385.25s(cpu)
 Wed Jul 18 15:01:41 2018

        *************************************************************
        *                                                           *
        *  Thank you very much for using Q-Chem.  Have a nice day.  *
        *                                                           *
        *************************************************************

0 sent ACK to 0
now end server 0 ...
cleanup process ... done

error: pathspec 'test_files/molecules/new_qchem_files/single_point.qout.sp' did not match any file(s) known to git


Added download preferences menu

Added download preferences menu

Provides a neat, though horribly inefficient, little interface to toggle
preferences on.

/**
 * Download Preferences Client Menu
 * Author(s): nosoop
 * File:  downloadprefs_menu.sp
 * Description:	 Provides clients with a menu to select which files they will download.
 * License:	 MIT License
 */

#pragma semicolon 1

#include <sourcemod>
#undef REQUIRE_PLUGIN
#include <downloadprefs>

#define PLUGIN_VERSION          "0.1.0"     // Plugin version.

public Plugin:myinfo = {
    name = "Download Preferences Client Menu",
    author = "nosoop",
    description = "Allow clients to toggle download preferences.",
    version = PLUGIN_VERSION,
    url = "http://github.com/nosoop/SM-DownloadPrefs"
}

new bool:g_bDPrefsLoaded = false;

public OnPluginStart() {
	RegConsoleCmd("sm_downloads", ConCmd_OpenDownloadPrefMenu);
}

public Action:ConCmd_OpenDownloadPrefMenu(iClient, nArgs) {
	if (!g_bDPrefsLoaded) {
		PrintToConsole(iClient, "The downloadprefs library is not available.");
		return Plugin_Handled;
	}

	new category[128];
	new size = GetLoadedDownloadCategories(category, sizeof(category));

	new Handle:hMenu = CreateMenu(MenuHandler_DownloadPref, MENU_ACTIONS_ALL);
	SetMenuTitle(hMenu, "Download Preferences");

	new String:title[128], String:desc[1], String:id[4], String:display[64];
	for (new i = 0; i < size; i++) {
		if (GetDownloadCategoryInfo(category[i], title, sizeof(title), desc, sizeof(desc))) {
			new bool:bPreference = GetClientDownloadPreference(iClient, category[i]);

			Format(display, sizeof(display), "[%s] %s", bPreference ? "x" : " ", title);
			IntToString(category[i], id, sizeof(id));

			AddMenuItem(hMenu, id, display);
		}
	}

	DisplayMenu(hMenu, iClient, 10);

	return Plugin_Handled;
}

public MenuHandler_DownloadPref(Handle:hMenu, MenuAction:iAction, param1, param2) {
	if (!g_bDPrefsLoaded) {
		CloseHandle(hMenu);
		return 0;
	}

	decl String:sCategory[4];
	new String:title[128], String:desc[1], String:id[4], String:display[64];

	// This stuff's horribly inefficent, but it'll have to do for now.
	switch (iAction) {
		case MenuAction_Select: {
			new iClient = param1, item = param2;
			GetMenuItem(hMenu, item, sCategory, sizeof(sCategory));
			new category = StringToInt(sCategory);

			new bool:bPreference = GetClientDownloadPreference(iClient, category);
			SetClientDownloadPreference(iClient, category, !bPreference);

			DisplayMenu(hMenu, iClient, 10);
		}
		case MenuAction_DisplayItem: {
			new iClient = param1, item = param2;
			GetMenuItem(hMenu, item, sCategory, sizeof(sCategory));
			new category = StringToInt(sCategory);

			if (GetDownloadCategoryInfo(category, title, sizeof(title), desc, sizeof(desc))) {
				new bool:bPreference = GetClientDownloadPreference(iClient, category);

				Format(display, sizeof(display), "[%s] %s", bPreference ? "x" : " ", title);
				IntToString(category, id, sizeof(id));

				return RedrawMenuItem(display);
			}
		}
		case MenuAction_End: {
			new iMenuEndReason = param1;
			if (iMenuEndReason == MenuEnd_Cancelled) {
				CloseHandle(hMenu);
			}
		}
	}
	return 0;
}

/**
 * Checks for the existence of the downloadprefs library.
 */
public OnAllPluginsLoaded() { g_bDPrefsLoaded = LibraryExists("downloadprefs"); }
public OnLibraryRemoved(const String:name[]) { g_bDPrefsLoaded &= !StrEqual(name, "downloadprefs"); }
public OnLibraryAdded(const String:name[]) { g_bDPrefsLoaded |= StrEqual(name, "downloadprefs"); }

error: pathspec 'scripting/downloadprefs_menu.sp' did not match any file(s) known to git


Add round time to match summary

Add round time to match summary


tpoly example fixes

tpoly example fixes

# Create argument ftable called 'args'
# p0 = dur (initialized at 4 seconds)
# p1 = note (initialized at middle C 60)
# p2 = amplitude (initialized at 0.1)
#
# every time tpoly is triggered, it will
# create a note event with these arguments
'args' '4.0 60 0.1' gen_vals

# Generate sequence of notes to cycle through
'notes' '60 62 71 64 67 74' gen_vals

# clock trigger, feeding into tpoly and tseq
1 metro dup

# cycle through the notes...
0 'notes' tseq
# ...and set p1 of the arg table BEFORE tpoly
1 'args' tset

# tpoly: maximum number of notes
4
# tpoly: number of user args
# note (p1) and ampltitude (p2) included
# duration (p0) is always needed
2

# name of argument table
'args'

# name of table that poly creates and writes to
'poly'

# When triggered, tpoly will read from the arg
# table and write the information to the poly ftable
tpoly

# Create 4 identical instances (voices) of the instrument
# and sum them together.
# These voices will read from the poly ftable tpoly generated

# -- Voice 0 --
# Get trigger
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
*

# -- Voice 1 --
# Get tick
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
* +

# -- Voice 2 --
# Get tick
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
* +

# -- Voice 3 --
# Get tick
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
* +

# Create argument ftable called 'args'
# p0 = dur (initialized at 4 seconds)
# p1 = note (initialized at middle C 60)
# p2 = amplitude (initialized at 0.1)
#
# every time tpoly is triggered, it will
# create a note event with these arguments
'args' '4.0 60 0.1' gen_vals

# Generate sequence of notes to cycle through
'notes' '60 62 71 64 67 74' gen_vals

# clock trigger, feeding into tpoly and tseq
1 metro dup

# cycle through the notes...
0 'notes' tseq
# ...and set p1 of the arg table BEFORE tpoly
1 'args' tset

# tpoly: maximum number of notes
4
# tpoly: number of user args
# note (p1) and ampltitude (p2) included
# duration (p0) is always needed
2

# name of argument table
'args'

# name of table that poly creates and writes to
'poly'

# When triggered, tpoly will read from the arg
# table and write the information to the poly ftable
tpoly

# Create 4 identical instances (voices) of the instrument
# and sum them together.
# These voices will read from the poly ftable tpoly generated

# -- Voice 0 --
# Get trigger
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
*

# -- Voice 1 --
# Get tick
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
*

# -- Voice 2 --
# Get tick
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
*

# -- Voice 3 --
# Get tick
0 0 'poly' polyget
# attack
0.1
# hold time: get note duration
0 1 'poly' polyget
# subtract attack and release times
0.2 -
# release
0.1
tenv

# Get note
0 2 'poly' polyget mtof
# get amplitude
0 3 'poly' polyget
# car, mod, index
1 1 1
fm
# multiply tenv and fm together
*


Begin ambitious project to automate escalation on punishments + more

#pragma newdecls required
#pragma semicolon 1

#include <sourcemod>
#include <clientprefs>
#include <morecolors>
#include <sourcebans>
#include <sourcecomms>

#define PLUGIN_VERSION "1.0.0"

ConVar cvarAWPVersion;
Menu menuHome, menuPunishments, menuSpecificPunishments, menuTips;
int[] chatsSpamEscalation =  { 20, 30, 60, 1440, 10080, 0 };

//--------------------//

public Plugin myinfo = {
	name = "[NGS] AutoWarnPunishr",
	author = "TheXeon",
	description = "Introduces menu-based administration/escalation to NGS.",
	version = PLUGIN_VERSION,
	url = "https://www.neogenesisnetwork.net"
}

public void OnPluginStart()
{
	// Version CVAR and RESET
	cvarAWPVersion = CreateConVar("sm_ngs_autowarnpunishr_version", PLUGIN_VERSION, "Version of the plugin (used in some strings)");
	cvarAWPVersion.AddChangeHook(OnVersionCvarChanged);

	// Register commands for menus
	RegAdminCmd("sm_ngsadminmenu", CommandAdminMenuHome, ADMFLAG_GENERIC, "Usage: sm_ngsadminmenu");

	/*******************************************
	*
	*					MENUES
	*
	*******************************************/

	// Main Menu
	menuHome = new Menu(MenuHomeHandler);
	menuHome.SetTitle("=== NGS Admin Menu ===");
	menuHome.AddItem("punishments", "Punishments!");
	menuHome.AddItem("admincommands", "Available commands!");
	menuHome.AddItem("tips", "Tips and Reminders!");

	/******************
	*	 SUBMENUES
	******************/

	// Punishments Menu
	menuPunishments = new Menu(PunishmentsMenuHandler);
	menuPunishments.SetTitle("=== NGS Punishments: Choose Broken Rule ===");
	menuPunishments.AddItem("gamemapexploits", "Game/Map Exploits!");
	menuPunishments.AddItem("hackingcheating", "Hacking/Cheating!");
	menuPunishments.AddItem("runningfrombet", "Running from bet!"); // TODO: Make this a tip
	menuPunishments.AddItem("voicetextspam", "Voice/Text Chat Spam)!");
	menuPunishments.AddItem("earrapenondj", "Earrape/Non-DJ Spam!");
	menuPunishments.AddItem("toxicity", "Toxicity (arguments, etc)!");
	menuPunishments.AddItem("cursing", "Cursing (slurs, excessive)!");
	menuPunishments.AddItem("shocksprays", "Shock/illegal-content sprays!");
	menuPunishments.AddItem("conversationtopics", "Political/Religious/etc beliefs!");
	menuPunishments.AddItem("adminimpersionation", "Admin impersonating!");
	menuPunishments.AddItem("begging", "Asking for donations/begging!");
	menuPunishments.AddItem("holdingpaidevents", "Hosting paid events/raffles/etc!");
	menuPunishments.ExitBackButton = true;

	// Punishments Sub-Menu (Specifics)
	menuSpecificPunishments = new Menu(PunishmentsSubMenuHandler);
	menuSpecificPunishments.SetTitle("=== NGS Punishments: Specify ===");
	menuSpecificPunishments.ExitBackButton = true;

	// Load translations
	LoadTranslations("common.phrases");
}

public void OnVersionCvarChanged(ConVar convar, char[] oldValue, char[] newValue)
{
	convar.SetString(PLUGIN_VERSION);
}

public void OnClientPutInServer(int client)
{
	VoicesEnabled[client] = false;
}

public Action CommandAdminMenuHome(int client, int args)
{
	if (!IsValidClient(client)) return Plugin_Handled;
	menuHome.Display(client, MENU_TIME_FOREVER);
	return Plugin_Handled;
}

/*******************************************
*										   *
*			  MENUES HANDLERS			   *
*										   *
*******************************************/

// Main menu handler
public int MenuHomeHandler(Menu menu, MenuAction action, int param1, int param2)
{
	if (action == MenuAction_Select)
	{
		char info[32];
		menu.GetItem(param2, info, sizeof(info));
		if (StrEqual(info, "punishments", false))
			menuPunishments.Display(param1, MENU_TIME_FOREVER);
		else if (StrEqual(info, "admincommands", false))
			serverCommandsMainMenu.Display(param1, MENU_TIME_FOREVER);
		else if (StrEqual(info, "tips", false))
			menuTips.Display(param1, MENU_TIME_FOREVER);
	}
	// no delete because reuse of handle
}

public int PunishmentsMenuHandler(Menu menu, MenuAction action, int param1, int param2)
{
	if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
	{
		menuHome.Display(param1, MENU_TIME_FOREVER);
	}
	else if (action == MenuAction_Select)
	{
		menuSpecificPunishments.RemoveAllItems();
		char info[32];
		menu.GetItem(param2, info, sizeof(info));
		if (StrEqual("gamemapexploits", info))
		{
			menuSpecificPunishments.AddItem("gameexploit", "Game Exploit!");
			menuSpecificPunishments.AddItem("mapexploit", "Map Exploit!");
		}
		else if (StrEqual("hackingcheating", info))
		menuSpecificPunishments.Display(param1, MENU_TIME_FOREVER);
	}
	// no delete because reuse of handle
}

public bool IsValidClient(int client)
{
	if(client > 4096) client = EntRefToEntIndex(client);
	if(client < 1 || client > MaxClients) return false;
	if(!IsClientInGame(client)) return false;
	if(IsFakeClient(client)) return false;
	if(GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false;
	return true;
}

error: pathspec 'scripting/ngs_autowarnpunishr.sp' did not match any file(s) known to git


A new pluck example, illustrating stereo and JI.

# an extension/hacking of 'pluck.sp' to add stereo, and show the use
# of just intonation as an option. Make sure to render with '-c 2' as a
# commandline parameter. Hack by Aaron Krister Johnson.

"seq" "1 1.1667 1 0.875 1.125 1 1.5 1.5 1 1.1667 1 0.875 1.125 1 1.5 1.666 1.75 2" gen_vals

_t 2 zeros

# invent fset and fget functions to make this shorter
"seq2" "1 1 0.875 1.5 1.5 1.3333 1.666 1.75 2 1" gen_vals

# 125 0 pset
125 0 _t tset

# trigger
60 0 _t tget / 0.5 * dmetro 0.333 maytrig dup
# freq
0 "seq" tseq 256 *
# amp
0.4
# lowest expected frequency
110
pluck

# trigger
0 _t tget "+-+--+--" prop dup
# freq
0 "seq2" tseq 256 * dup 1 _t tset
# amp
0.4
# lowest expected frequency
86.0
pluck

# AM to pitch shift two octaves down
1 _t tget 0.25 * 1 sine *

+

# save above result for later stereo,
# instead, operate on copy for first channel:
dup

# in
dup
# feedback
0.86
# deltime
60 0 _t tget / 0.75 *
delay

# cutoff
5000
butlp

# mix amount, consume to make dry+wet
0.4 * +

# in
swap dup
# feedback
0.86
# deltime
60 0 _t tget / 1.25 *
delay

# cutoff
5000
butlp

# mix amount, consume to make dry+wet
0.4 * +

error: pathspec 'examples/pluck_stereo.sp' did not match any file(s) known to git


Probably unneeded group overrides additive to CCC, DONT USE

#pragma newdecls required
#pragma semicolon 1

#include <sourcemod>
#include <ccc>

#define PLUGIN_VERSION		"1.0.0"

public Plugin myinfo = {
	name        = "[NGS] Custom Chat Colors Group Override",
	author      = "TheXeon",
	description = "Processes chat and provides colors for Source 2013 games",
	version     = PLUGIN_VERSION,
	url         = "https://www.neogenesisnetwork.net"
}

char tag[MAXPLAYERS + 1][32];
char tagColor[MAXPLAYERS + 1][12];
char usernameColor[MAXPLAYERS + 1][12];
char chatColor[MAXPLAYERS + 1][12];

char defaultTag[MAXPLAYERS + 1][32];
char defaultTagColor[MAXPLAYERS + 1][12];
char defaultUsernameColor[MAXPLAYERS + 1][12];
char defaultChatColor[MAXPLAYERS + 1][12];

#define CONVAR_PREFIX	"custom_chat_colors"

#tryinclude "mckayupdater.sp"

public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
	MarkNativeAsOptional("Updater_AddPlugin");
	CreateNative("CCC_GetColor", Native_GetColor);
	CreateNative("CCC_SetColor", Native_SetColor);
	CreateNative("CCC_GetTag", Native_GetTag);
	CreateNative("CCC_SetTag", Native_SetTag);
	CreateNative("CCC_ResetColor", Native_ResetColor);
	CreateNative("CCC_ResetTag", Native_ResetTag);

	RegPluginLibrary("ccc");

	return APLRes_Success;
}

public void OnPluginStart()
{
	RegAdminCmd("sm_reloadccc", Command_ReloadConfig, ADMFLAG_CONFIG, "Reloads Custom Chat Colors config file");
	colorForward = CreateGlobalForward("CCC_OnChatColor", ET_Event, Param_Cell);
	nameForward = CreateGlobalForward("CCC_OnNameColor", ET_Event, Param_Cell);
	tagForward = CreateGlobalForward("CCC_OnTagApplied", ET_Event, Param_Cell);
	applicationForward = CreateGlobalForward("CCC_OnColor", ET_Event, Param_Cell, Param_String, Param_Cell);
	messageForward = CreateGlobalForward("CCC_OnChatMessage", ET_Ignore, Param_Cell, Param_String, Param_Cell);
	preLoadedForward = CreateGlobalForward("CCC_OnUserConfigPreLoaded", ET_Event, Param_Cell);
	loadedForward = CreateGlobalForward("CCC_OnUserConfigLoaded", ET_Ignore, Param_Cell);
	configReloadedForward = CreateGlobalForward("CCC_OnConfigReloaded", ET_Ignore);
	LoadConfig();
}

void LoadConfig()
{
	if (configFile != INVALID_HANDLE)
	{
		CloseHandle(configFile);
	}
	configFile = CreateKeyValues("admin_colors");
	char path[64];
	BuildPath(Path_SM, path, sizeof(path), "configs/custom-chatcolors.cfg");
	if (!FileToKeyValues(configFile, path))
	{
		SetFailState("Config file missing");
	}
	for(int i = 1; i <= MaxClients; i++)
	{
		if (!IsClientInGame(i) || IsFakeClient(i))
		{
			continue;
		}
		ClearValues(i);
		OnClientPostAdminCheck(i);
	}
}

public Action Command_ReloadConfig(int client, int args)
{
	LoadConfig();
	LogAction(client, -1, "Reloaded Custom Chat Colors config file");
	ReplyToCommand(client, "[CCC] Reloaded config file.");
	Call_StartForward(configReloadedForward);
	Call_Finish();
	return Plugin_Handled;
}

void ClearValues(int client)
{
	Format(tag[client], sizeof(tag[]), "");
	Format(tagColor[client], sizeof(tagColor[]), "");
	Format(usernameColor[client], sizeof(usernameColor[]), "");
	Format(chatColor[client], sizeof(chatColor[]), "");

	Format(defaultTag[client], sizeof(defaultTag[]), "");
	Format(defaultTagColor[client], sizeof(defaultTagColor[]), "");
	Format(defaultUsernameColor[client], sizeof(defaultUsernameColor[]), "");
	Format(defaultChatColor[client], sizeof(defaultChatColor[]), "");
}

public void OnClientConnected(int client)
{
	ClearValues(client);
}

public void OnClientDisconnect(int client)
{
	ClearValues(client); // On connect and on disconnect, just to be safe
}

public void OnClientPostAdminCheck(int client)
{
	if (!ConfigForward(client))
	{
		return; // Another plugin wants to block this
	}
	// check the Steam ID first
	char auth[32];
	GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
	KvRewind(configFile);
	if (!KvJumpToKey(configFile, auth))
	{
		KvRewind(configFile);
		KvGotoFirstSubKey(configFile);
		AdminId admin = GetUserAdmin(client);
		AdminFlag flag;
		char configFlag[2];
		char section[32];
		char override[MAX_BUFFER_LENGTH];
		bool found = false;
		do
		{
			KvGetSectionName(configFile, section, sizeof(section));
			KvGetString(configFile, "flag", configFlag, sizeof(configFlag));
			KvGetString(configFile, "override", override, sizeof(override));
			if (strlen(configFlag) > 1)
			{
				LogError("Multiple flags given in section \"%s\", which is not allowed. Using first character.", section);
			}
			if (strlen(configFlag) == 0 && strlen(override) == 0 && StrContains(section, "STEAM_", false) == -1 && StrContains(section, "[U:1:", false) == -1)
			{
				found = true;
				break;
			}
			if (CheckCommandAccess(client, override, 0))
			{
				found = true;
				break;
			}
			if (!FindFlagByChar(configFlag[0], flag))
			{
				if (strlen(configFlag) > 0)
				{
					LogError("Invalid flag given for section \"%s\", skipping", section);
				}
				continue;
			}
			if (GetAdminFlag(admin, flag))
			{
				found = true;
				break;
			}
		}
		while (KvGotoNextKey(configFile));
		if (!found)
		{
			return;
		}
	}
	char clientTagColor[12];
	char clientNameColor[12];
	char clientChatColor[12];
	KvGetString(configFile, "tag", tag[client], sizeof(tag[]));
	KvGetString(configFile, "tagcolor", clientTagColor, sizeof(clientTagColor));
	KvGetString(configFile, "namecolor", clientNameColor, sizeof(clientNameColor));
	KvGetString(configFile, "textcolor", clientChatColor, sizeof(clientChatColor));
	ReplaceString(clientTagColor, sizeof(clientTagColor), "#", "");
	ReplaceString(clientNameColor, sizeof(clientNameColor), "#", "");
	ReplaceString(clientChatColor, sizeof(clientChatColor), "#", "");
	int tagLen = strlen(clientTagColor);
	int nameLen = strlen(clientNameColor);
	int chatLen = strlen(clientChatColor);
	if (tagLen == 6 || tagLen == 8 || StrEqual(clientTagColor, "T", false) || StrEqual(clientTagColor, "G", false) || StrEqual(clientTagColor, "O", false)) {
		strcopy(tagColor[client], sizeof(tagColor[]), clientTagColor);
	}
	if (nameLen == 6 || nameLen == 8 || StrEqual(clientNameColor, "G", false) || StrEqual(clientNameColor, "O", false)) {
		strcopy(usernameColor[client], sizeof(usernameColor[]), clientNameColor);
	}
	if (chatLen == 6 || chatLen == 8 || StrEqual(clientChatColor, "T", false) || StrEqual(clientChatColor, "G", false) || StrEqual(clientChatColor, "O", false)) {
		strcopy(chatColor[client], sizeof(chatColor[]), clientChatColor);
	}
	strcopy(defaultTag[client], sizeof(defaultTag[]), tag[client]);
	strcopy(defaultTagColor[client], sizeof(defaultTagColor[]), tagColor[client]);
	strcopy(defaultUsernameColor[client], sizeof(defaultUsernameColor[]), usernameColor[client]);
	strcopy(defaultChatColor[client], sizeof(defaultChatColor[]), chatColor[client]);
	Call_StartForward(loadedForward);
	Call_PushCell(client);
	Call_Finish();
}

public Action OnChatMessage(int &author, Handle recipients, char[] name, char[] message)
{
	if (CheckForward(author, message, CCC_NameColor))
	{
		if (StrEqual(usernameColor[author], "G", false)) {
			Format(name, MAXLENGTH_NAME, "\x04%s", name);
		} else if (StrEqual(usernameColor[author], "O", false)) {
			Format(name, MAXLENGTH_NAME, "\x05%s", name);
		} else if (strlen(usernameColor[author]) == 6) {
			Format(name, MAXLENGTH_NAME, "\x07%s%s", usernameColor[author], name);
		} else if (strlen(usernameColor[author]) == 8) {
			Format(name, MAXLENGTH_NAME, "\x08%s%s", usernameColor[author], name);
		} else {
			Format(name, MAXLENGTH_NAME, "\x03%s", name); // team color by default!
		}
	} else {
		Format(name, MAXLENGTH_NAME, "\x03%s", name); // team color by default!
	}
	if (CheckForward(author, message, CCC_TagColor)) {
		if (strlen(tag[author]) > 0) {
			if (StrEqual(tagColor[author], "T", false)) {
				Format(name, MAXLENGTH_NAME, "\x03%s%s", tag[author], name);
			} else if (StrEqual(tagColor[author], "G", false)) {
				Format(name, MAXLENGTH_NAME, "\x04%s%s", tag[author], name);
			} else if (StrEqual(tagColor[author], "O", false)) {
				Format(name, MAXLENGTH_NAME, "\x05%s%s", tag[author], name);
			} else if (strlen(tagColor[author]) == 6) {
				Format(name, MAXLENGTH_NAME, "\x07%s%s%s", tagColor[author], tag[author], name);
			} else if (strlen(tagColor[author]) == 8) {
				Format(name, MAXLENGTH_NAME, "\x08%s%s%s", tagColor[author], tag[author], name);
			} else {
				Format(name, MAXLENGTH_NAME, "\x01%s%s", tag[author], name);
			}
		}
	}

	int MaxMessageLength = MAXLENGTH_MESSAGE - strlen(name) - 5; // MAXLENGTH_MESSAGE = maximum characters in a chat message, including name. Subtract the characters in the name, and 5 to account for the colon, spaces, and null terminator

	if (strlen(chatColor[author]) > 0 && CheckForward(author, message, CCC_ChatColor)) {
		if (StrEqual(chatColor[author], "T", false)) {
			Format(message, MaxMessageLength, "\x03%s", message);
		} else if (StrEqual(chatColor[author], "G", false)) {
			Format(message, MaxMessageLength, "\x04%s", message);
		} else if (StrEqual(chatColor[author], "O", false)) {
			Format(message, MaxMessageLength, "\x05%s", message);
		} else if (strlen(chatColor[author]) == 6) {
			Format(message, MaxMessageLength, "\x07%s%s", chatColor[author], message);
		} else if (strlen(chatColor[author]) == 8) {
			Format(message, MaxMessageLength, "\x08%s%s", chatColor[author], message);
		}
	}
	char game[64];
	GetGameFolderName(game, sizeof(game));
	if (StrEqual(game, "csgo")) {
		Format(name, MAXLENGTH_NAME, "\x01\x0B%s", name);
	}

	Call_StartForward(messageForward);
	Call_PushCell(author);
	Call_PushStringEx(message, MaxMessageLength, SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
	Call_PushCell(MaxMessageLength);
	Call_Finish();

	return Plugin_Changed;
}

bool CheckForward(int author, const char[] message, CCC_ColorType type)
{
	Action result = Plugin_Continue;
	Call_StartForward(applicationForward);
	Call_PushCell(author);
	Call_PushString(message);
	Call_PushCell(type);
	Call_Finish(result);
	if (result >= Plugin_Handled) {
		return false;
	}

	// Compatibility
	switch(type) {
		case CCC_TagColor: return TagForward(author);
		case CCC_NameColor: return NameForward(author);
		case CCC_ChatColor: return ColorForward(author);
	}

	return true;
}

bool ColorForward(int author)
{
	Action result = Plugin_Continue;
	Call_StartForward(colorForward);
	Call_PushCell(author);
	Call_Finish(result);
	if (result >= Plugin_Handled) {
		return false;
	}

	return true;
}

bool NameForward(int author)
{
	Action result = Plugin_Continue;
	Call_StartForward(nameForward);
	Call_PushCell(author);
	Call_Finish(result);
	if (result >= Plugin_Handled) {
		return false;
	}

	return true;
}

bool TagForward(int author) {
	Action result = Plugin_Continue;
	Call_StartForward(tagForward);
	Call_PushCell(author);
	Call_Finish(result);
	if (result >= Plugin_Handled) {
		return false;
	}

	return true;
}

bool ConfigForward(int client) {
	Action result = Plugin_Continue;
	Call_StartForward(preLoadedForward);
	Call_PushCell(client);
	Call_Finish(result);
	if (result >= Plugin_Handled) {
		return false;
	}

	return true;
}

public int Native_GetColor(Handle plugin, int numParams)
{
	int client = GetNativeCell(1);
	if (client < 1 || client > MaxClients || !IsClientInGame(client))
	{
		ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
		return COLOR_NONE;
	}
	switch(GetNativeCell(2)) {
		case CCC_TagColor: {
			if (StrEqual(tagColor[client], "T", false)) {
				SetNativeCellRef(3, false);
				return COLOR_TEAM;
			} else if (StrEqual(tagColor[client], "G", false)) {
				SetNativeCellRef(3, false);
				return COLOR_GREEN;
			} else if (StrEqual(tagColor[client], "O", false)) {
				SetNativeCellRef(3, false);
				return COLOR_OLIVE;
			} else if (strlen(tagColor[client]) == 6 || strlen(tagColor[client]) == 8) {
				SetNativeCellRef(3, strlen(tagColor[client]) == 8);
				return StringToInt(tagColor[client], 16);
			} else {
				SetNativeCellRef(3, false);
				return COLOR_NONE;
			}
		}
		case CCC_NameColor: {
			if (StrEqual(usernameColor[client], "G", false)) {
				SetNativeCellRef(3, false);
				return COLOR_GREEN;
			} else if (StrEqual(usernameColor[client], "O", false)) {
				SetNativeCellRef(3, false);
				return COLOR_OLIVE;
			} else if (strlen(usernameColor[client]) == 6 || strlen(usernameColor[client]) == 8) {
				SetNativeCellRef(3, strlen(usernameColor[client]) == 8);
				return StringToInt(usernameColor[client], 16);
			} else {
				SetNativeCellRef(3, false);
				return COLOR_TEAM;
			}
		}
		case CCC_ChatColor: {
			if (StrEqual(chatColor[client], "T", false)) {
				SetNativeCellRef(3, false);
				return COLOR_TEAM;
			} else if (StrEqual(chatColor[client], "G", false)) {
				SetNativeCellRef(3, false);
				return COLOR_GREEN;
			} else if (StrEqual(chatColor[client], "O", false)) {
				SetNativeCellRef(3, false);
				return COLOR_OLIVE;
			} else if (strlen(chatColor[client]) == 6 || strlen(chatColor[client]) == 8) {
				SetNativeCellRef(3, strlen(chatColor[client]) == 8);
				return StringToInt(chatColor[client], 16);
			} else {
				SetNativeCellRef(3, false);
				return COLOR_NONE;
			}
		}
	}
	return COLOR_NONE;
}

public int Native_SetColor(Handle plugin, int numParams) {
	int client = GetNativeCell(1);
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) {
		ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
		return false;
	}
	char color[32];
	if (GetNativeCell(3) < 0) {
		switch(GetNativeCell(3)) {
			case COLOR_GREEN: {
				Format(color, sizeof(color), "G");
			}
			case COLOR_OLIVE: {
				Format(color, sizeof(color), "O");
			}
			case COLOR_TEAM: {
				Format(color, sizeof(color), "T");
			}
			case COLOR_NONE: {
				Format(color, sizeof(color), "");
			}
		}
	} else {
		if (!GetNativeCell(4)) {
			// No alpha
			Format(color, sizeof(color), "%06X", GetNativeCell(3));
		} else {
			// Alpha specified
			Format(color, sizeof(color), "%08X", GetNativeCell(3));
		}
	}
	if (strlen(color) != 6 && strlen(color) != 8 && !StrEqual(color, "G", false) && !StrEqual(color, "O", false) && !StrEqual(color, "T", false)) {
		return false;
	}
	switch(GetNativeCell(2)) {
		case CCC_TagColor: {
			strcopy(tagColor[client], sizeof(tagColor[]), color);
		}
		case CCC_NameColor: {
			strcopy(usernameColor[client], sizeof(usernameColor[]), color);
		}
		case CCC_ChatColor: {
			strcopy(chatColor[client], sizeof(chatColor[]), color);
		}
	}
	return true;
}

public int Native_GetTag(Handle plugin, int numParams)
{
	int client = GetNativeCell(1);
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) {
		ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
		return;
	}
	SetNativeString(2, tag[client], GetNativeCell(3));
}

public int Native_SetTag(Handle plugin, int numParams) {
	int client = GetNativeCell(1);
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) {
		ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
		return;
	}
	GetNativeString(2, tag[client], sizeof(tag[]));
}

public int Native_ResetColor(Handle plugin, int numParams) {
	int client = GetNativeCell(1);
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) {
		ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
		return;
	}
	switch(GetNativeCell(2)) {
		case CCC_TagColor: {
			strcopy(tagColor[client], sizeof(tagColor[]), defaultTagColor[client]);
		}
		case CCC_NameColor: {
			strcopy(usernameColor[client], sizeof(usernameColor[]), defaultUsernameColor[client]);
		}
		case CCC_ChatColor: {
			strcopy(chatColor[client], sizeof(chatColor[]), defaultChatColor[client]);
		}
	}
}

public int Native_ResetTag(Handle plugin, int numParams) {
	int client = GetNativeCell(1);
	if (client < 1 || client > MaxClients || !IsClientInGame(client)) {
		ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
		return;
	}
	strcopy(tag[client], sizeof(tag[]), defaultTag[client]);
}

error: pathspec 'scripting/ngs_chatcolgroupoverride.sp' did not match any file(s) known to git


Works, is inconsistent (see bug tracker).

#include <sourcemod>
#include <sdkhooks>
#define SPLIT 5
#pragma semicolon 1

public Plugin:myinfo =
{
	name = "Smooth witch damage",
	author = "Darkid",
	description = "Smooths out the damage taken from a witch while incapped.",
	version = "1.5",
	url = "https://github.com/jbzdarkid/Random/witchdamage"
}

new Float:witchDamage;
new Handle:deadWitches;
new Float:startTick;
new bool:lateLoad = false;

public APLRes:AskPluginLoad2(Handle:plugin, bool:late, String:error[], errMax) {
	lateLoad = late;
	return APLRes_Success;
}

public OnPluginStart() {
	if (lateLoad) {
		for (new client=1; client<=MaxClients; client++) {
			if (!IsClientInGame(client)) continue;
			OnClientPostAdminCheck(client);
		}
	}

	decl String:witchDamageString[64];
	GetConVarString(FindConVar("z_witch_damage_per_kill_hit"), witchDamageString, sizeof(witchDamageString));
	HookConVarChange(FindConVar("z_witch_damage_per_kill_hit"), OnWitchDamageChange);
	witchDamage = 1.0*StringToInt(witchDamageString);

	deadWitches = CreateArray(64);

	HookEvent("round_start", round_start);
	HookEvent("witch_killed", witch_killed);
	startTick = 0.0;
}

public OnWitchDamageChange(Handle:cvar, const String:oldVal[], const String:newVal[]) {
	witchDamage = 1.0*StringToInt(newVal);
}

public OnClientPostAdminCheck(client) {
	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public round_start(Handle:event, const String:name[], bool:dontBroadcast) {
	ClearArray(deadWitches);
}

bool:IsWitch(entity) {
	if (entity <= 0 || !IsValidEntity(entity) || !IsValidEdict(entity)) return false;
	decl String:className[8];
	GetEdictClassname(entity, className, sizeof(className));
	return strcmp(className, "witch") == 0;
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damageType) {
	if (victim <= 0 || victim > MaxClients || !IsClientInGame(victim)) return Plugin_Continue;
	if (!IsWitch(attacker)) return Plugin_Continue;
	if (damage != witchDamage) return Plugin_Continue; // A hack. We assume the first scratch isn't the same damage as an incap scratch.
	if (startTick == 0.0) startTick = GetEngineTime();
	new Handle:data = CreateArray(64);
	PushArrayCell(data, victim);
	PushArrayCell(data, attacker);
	PushArrayCell(data, inflictor);
	PushArrayCell(data, damageType);
	PushArrayCell(data, SPLIT-1);
	// The witch scratch animation is every 1/4 second. Repeat until all the damage is done.
	CreateTimer(0.25, WitchScratch, data, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);

	// Allow this scratch's damage through, to an appropriate degree.
	damage = witchDamage/SPLIT;
	PrintToChatAll("[%2.3f] Player %d took %3f damage (%d of %d) from witch %d/%d.", GetEngineTime()-startTick, victim, witchDamage/SPLIT, 1, SPLIT, attacker, inflictor);
	return Plugin_Continue;
}

public Action:WitchScratch(Handle:timer, any:data) {
	new victim = GetArrayCell(data, 0);
	// If defibrillator_use_time is less than .25, this may bug out.
	if (!IsPlayerAlive(victim)) return Plugin_Stop;
	new attacker = GetArrayCell(data, 1);
	new inflictor = GetArrayCell(data, 2);
	new damageType = GetArrayCell(data, 3);
	new count = GetArrayCell(data, 4);
	if (count <= 0) return Plugin_Stop;
	new index = FindValueInArray(deadWitches, attacker);
	if (index != -1) return Plugin_Stop;
	SDKHooks_TakeDamage(victim, attacker, inflictor, witchDamage/SPLIT, damageType);
	SetArrayCell(data, 4, count-1);
	return Plugin_Continue;
}

public witch_killed(Handle:event, const String:name[], bool:dontBroadcast) {
	new witch = GetEventInt(event, "witchid");
	PushArrayCell(deadWitches, witch);
}

error: pathspec 'smooth_witch_damage.sp' did not match any file(s) known to git


Disable Trickle Charge (to be revisted in the near future)


Preserve Cleaner's Carbine "Crikey" meter