-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,139 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// Copyright (C) 2023 Katsute | Licensed under CC BY-NC-SA 4.0 | ||
|
||
#pragma semicolon 1 | ||
|
||
#define RRM_VERSION "1.0" | ||
|
||
#include <sourcemod> | ||
#include <sdkhooks> | ||
#include <tf2attributes> | ||
#include <tf2> | ||
#include <tf2_stocks> | ||
#include <rrm> | ||
|
||
#pragma newdecls required | ||
|
||
int gEnabled = 0; | ||
ConVar cMin = null, cMax = null; | ||
float gMin = 0.0, gMax = 0.0; | ||
|
||
public Plugin myinfo = | ||
{ | ||
name = "[RRM] Health Modifier", | ||
author = "Katsute", | ||
description = "Modifier that changes max health.", | ||
version = "1.0" | ||
}; | ||
|
||
public void OnPluginStart() | ||
{ | ||
cMin = CreateConVar("rrm_health_min", "0.1", "Minimum value for the random number generator."); | ||
cMax = CreateConVar("rrm_health_max", "3.0", "Maximum value for the random number generator."); | ||
|
||
cMin.AddChangeHook(OnConvarChanged); | ||
cMax.AddChangeHook(OnConvarChanged); | ||
|
||
gMin = cMin.FloatValue; | ||
gMax = cMax.FloatValue; | ||
|
||
HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post); | ||
|
||
if(RRM_IsRegOpen()) | ||
RegisterModifiers(); | ||
|
||
AutoExecConfig(true, "rrm_health", "rrm"); | ||
} | ||
|
||
public void OnPluginEnd() | ||
{ | ||
RemoveHealth(); | ||
} | ||
|
||
public int RRM_OnRegOpen() | ||
{ | ||
RegisterModifiers(); | ||
} | ||
|
||
void RegisterModifiers() | ||
{ | ||
RRM_Register("Max Health", gMin, gMax, false, RRM_Callback_Health); | ||
} | ||
|
||
public void OnConvarChanged(Handle convar, char[] oldValue, char[] newValue) | ||
{ | ||
if (StrEqual(oldValue, newValue, true)) | ||
return; | ||
|
||
float fNewValue = StringToFloat(newValue); | ||
|
||
if(convar == cMin) | ||
gMin = fNewValue; | ||
else if(convar == cMax) | ||
gMax = fNewValue; | ||
} | ||
|
||
public Action OnPlayerSpawn(Handle event, const char[] name, bool dontBroadcast) | ||
{ | ||
if(!gEnabled) | ||
return Plugin_Continue; | ||
int i = GetClientOfUserId(GetEventInt(event, "userid")); | ||
SetEntPropFloat(i, Prop_Send, "m_iMaxHealth", RoundToCeil(GetEntProp(i, Prop_Data, "m_iMaxHealth") * gHealth)); | ||
return Plugin_Continue; | ||
} | ||
|
||
public void OnClientPostAdminCheck(int i) | ||
{ | ||
if(!gEnabled) | ||
return; | ||
SetEntPropFloat(i, Prop_Send, "m_iMaxHealth", RoundToCeil(GetEntProp(i, Prop_Data, "m_iMaxHealth") * gHealth)); | ||
} | ||
|
||
public int RRM_Callback_Health(bool enable, float value) | ||
{ | ||
gEnabled = enable; | ||
if(gEnabled) | ||
{ | ||
gHealth = value; | ||
AddHealth(); | ||
} | ||
else | ||
RemoveHealth(); | ||
return gEnabled; | ||
} | ||
|
||
void AddHealth() | ||
{ | ||
for (int i = 1; i <= MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
SetEntPropFloat(i, Prop_Send, "m_iMaxHealth", RoundToCeil(GetEntProp(i, Prop_Data, "m_iMaxHealth") * gHealth)); | ||
} | ||
} | ||
|
||
void RemoveHealth() | ||
{ | ||
for (int i = 1; i <= MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
SetEntPropFloat(i, Prop_Send, "m_iMaxHealth", RoundToCeil(GetEntProp(i, Prop_Data, "m_iMaxHealth") / gHealth)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Copyright (C) 2023 Katsute | Licensed under CC BY-NC-SA 4.0 | ||
|
||
#pragma semicolon 1 | ||
|
||
#define RRM_VERSION "1.0" | ||
|
||
#include <sourcemod> | ||
#include <sdkhooks> | ||
#include <tf2attributes> | ||
#include <tf2> | ||
#include <tf2_stocks> | ||
#include <rrm> | ||
|
||
#pragma newdecls required | ||
|
||
int gEnabled = 0; | ||
float gMirror = 0.0; | ||
ConVar cMin = null, cMax = null; | ||
float gMin = 0.0, gMax = 0.0; | ||
|
||
public Plugin myinfo = | ||
{ | ||
name = "[RRM] Mirrored Damage Modifier", | ||
author = "Katsute", | ||
description = "Modifier that adds mirrored damage.", | ||
version = "1.0" | ||
}; | ||
|
||
public void OnPluginStart() | ||
{ | ||
cMin = CreateConVar("rrm_mirror_min", "0.1", "Minimum value for the random number generator."); | ||
cMax = CreateConVar("rrm_mirror_max", "1.0", "Maximum value for the random number generator."); | ||
|
||
cMin.AddChangeHook(OnConvarChanged); | ||
cMax.AddChangeHook(OnConvarChanged); | ||
|
||
gMin = cMin.FloatValue; | ||
gMax = cMax.FloatValue; | ||
|
||
for (int i = 1; i < MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
SDKHook(i, SDKHook_OnTakeDamageAlive, OnTakeDamage); | ||
} | ||
|
||
if(RRM_IsRegOpen()) | ||
RegisterModifiers(); | ||
|
||
AutoExecConfig(true, "rrm_mirror", "rrm"); | ||
} | ||
|
||
public int RRM_OnRegOpen() | ||
{ | ||
RegisterModifiers(); | ||
} | ||
|
||
void RegisterModifiers() | ||
{ | ||
RRM_Register("Mirrored Damage", gMin, gMax, false, RRM_Callback_Mirrored); | ||
} | ||
|
||
public void OnConvarChanged(Handle convar, char[] oldValue, char[] newValue) | ||
{ | ||
if (StrEqual(oldValue, newValue, true)) | ||
return; | ||
|
||
float fNewValue = StringToFloat(newValue); | ||
|
||
if(convar == cMin) | ||
gMin = fNewValue; | ||
else if(convar == cMax) | ||
gMax = fNewValue; | ||
} | ||
|
||
public void OnClientPostAdminCheck(int client) | ||
{ | ||
SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamage); | ||
} | ||
|
||
public int RRM_Callback_Mirrored(bool enable, float value) | ||
{ | ||
gEnabled = enable; | ||
if(gEnabled) | ||
gMirror = value; | ||
return gEnabled; | ||
} | ||
|
||
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, | ||
float damageForce[3], float damagePosition[3], int damagecustom) | ||
{ | ||
if(!gEnabled) | ||
return Plugin_Continue; | ||
|
||
{ | ||
if(!(1 <= victim <= MaxClients)) | ||
return Plugin_Continue; | ||
if(!IsClientInGame(victim)) | ||
return Plugin_Continue; | ||
if(!(1 <= attacker <= MaxClients)) | ||
return Plugin_Continue; | ||
if(!IsClientInGame(attacker)) | ||
return Plugin_Continue; | ||
if(!IsPlayerAlive(victim)) | ||
return Plugin_Continue; | ||
SDKHooks_TakeDamage(client, inflictor, victim, RoundFloat(damage * gMirror), damagetype, weapon, null, null, true); | ||
} | ||
return Plugin_Continue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright (C) 2023 Katsute | Licensed under CC BY-NC-SA 4.0 | ||
|
||
#pragma semicolon 1 | ||
|
||
#define RRM_VERSION "1.0" | ||
|
||
#include <sourcemod> | ||
#include <sdkhooks> | ||
#include <tf2attributes> | ||
#include <tf2> | ||
#include <tf2_stocks> | ||
#include <rrm> | ||
|
||
#pragma newdecls required | ||
|
||
int gEnabled = 0; | ||
|
||
public Plugin myinfo = | ||
{ | ||
name = "[RRM] Agility Powerup Modifier", | ||
author = "Katsute", | ||
description = "Modifier that gives agility powerup.", | ||
version = "1.0" | ||
}; | ||
|
||
public void OnPluginStart() | ||
{ | ||
HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post); | ||
|
||
if(RRM_IsRegOpen()) | ||
RegisterModifiers(); | ||
|
||
AutoExecConfig(true, "rrm_powerup_agility", "rrm"); | ||
} | ||
|
||
public void OnPluginEnd() | ||
{ | ||
RemovePowerup(); | ||
} | ||
|
||
public int RRM_OnRegOpen() | ||
{ | ||
RegisterModifiers(); | ||
} | ||
|
||
void RegisterModifiers() | ||
{ | ||
RRM_Register("Agility Powerup", 0.0, 0.0, false, RRM_Callback_Powerup); | ||
} | ||
|
||
public Action OnPlayerSpawn(Handle event, const char[] name, bool dontBroadcast) | ||
{ | ||
if(!gEnabled) | ||
return Plugin_Continue; | ||
int i = GetClientOfUserId(GetEventInt(event, "userid")); | ||
TF2_AddCondition(i, TFCond_RuneAgility); | ||
return Plugin_Continue; | ||
} | ||
|
||
public int RRM_Callback_Powerup(bool enable, float value) | ||
{ | ||
gEnabled = enable; | ||
if(gEnabled) | ||
AddPowerup(); | ||
else | ||
RemovePowerup(); | ||
return gEnabled; | ||
} | ||
|
||
void AddPowerup() | ||
{ | ||
for (int i = 1; i <= MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
TF2_AddCondition(i, TFCond_RuneAgility); | ||
} | ||
} | ||
|
||
void RemovePowerup() | ||
{ | ||
for (int i = 1; i <= MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
TF2_RemoveCondition(i, TFCond_RuneAgility); | ||
} | ||
} |
Oops, something went wrong.