The Jarate events never actually fire, but they exist.
Anyway, here's my solution. Enjoy it while I brace for attacks on bad coding style.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define PL_VERSION "1.0"
public Plugin:myinfo = {
name = "Acid Jarate",
author = "Theme97",
description = "Players take damage while Jarated",
version = "1.0.0",
url = "http://forums.alliedmods.net/"
}
new Handle:cvar_time;
new Handle:cvar_damage;
public OnPluginStart() {
cvar_time = CreateConVar("sm_acidjarate_time", "3.0", "Time inbetween each damage tick", FCVAR_PLUGIN, true, 0.1, false, _);
cvar_damage = CreateConVar("sm_acidjarate_damage", "5", "Damage to do per tick", FCVAR_PLUGIN, true, 1.0, false, _);
}
public OnMapStart() {
CreateTimer(GetConVarFloat(cvar_time), timer_damageplayer);
}
public Action:timer_damageplayer(Handle:timer) {
new damage = GetConVarInt(cvar_damage), health;
for (new i = 1; i <= MaxClients; i++) {
if (IsClientInGame(i) && GetEntData(i, FindSendPropInfo("CTFPlayer", "m_nPlayerCond")) & (1 << 19)) {
health = GetEntProp(i, Prop_Send, "m_iHealth") - damage;
if (health < 1) health = 1;
SetEntProp(i, Prop_Send, "m_iHealth", health);
}
}
CreateTimer(GetConVarFloat(cvar_time), timer_damageplayer);
}
There's no easy way to check who threw the Jarate, so we can't make the player die by it with the right death message, but if you still want them to die, just change timer_damageplayer:
PHP Code:
public Action:timer_damageplayer(Handle:timer) {
new damage = GetConVarInt(cvar_damage), health;
for (new i = 1; i <= MaxClients; i++) {
if (IsClientInGame(i) && GetEntData(i, FindSendPropInfo("CTFPlayer", "m_nPlayerCond")) & (1 << 19)) {
health = GetEntProp(i, Prop_Send, "m_iHealth") - damage;
if (health < 1) {
ForcePlayerSuicide(i);
} else {
SetEntProp(i, Prop_Send, "m_iHealth", health);
}
}
}
CreateTimer(GetConVarFloat(cvar_time), timer_damageplayer, _, TIMER_FLAG_NO_MAPCHANGE);
}