Skip to content

Commit

Permalink
Added new convar to set which team spawns revive markers
Browse files Browse the repository at this point in the history
Added `sm_allclassrevivemarker_spawnrevivemarker` that controls what team spawns the revive markers. By default it's set to 0, which doesn't spawn revive markers. 1 for all, 2 only for red and 3 only for blue
  • Loading branch information
tsuza committed Feb 17, 2023
1 parent 18b190f commit d4eaae0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripting/AllClassReviveMarker.sp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ public Plugin myinfo =
name = "[TF2] AllClassReviveMarker",
author = "Zabaniya001",
description = "[TF2] Allows every class to revive players from revive markers.",
version = "1.0.0",
version = "1.0.1",
url = "https://github.com/Zabaniya001/AllClassReviveMarker"
};

ConVar g_convar_distance;
ConVar g_convar_reviverate;
ConVar g_convar_spawnReviveMarker;

int g_CTFReviveMarker_pReviver;
int g_CTFReviveMarker_bOwnerPromptedToRevive;
Expand All @@ -32,6 +33,7 @@ public void OnPluginStart()
{
g_convar_distance = CreateConVar("sm_allclassrevivemarker_revivedistance", "120.0", "Dictates the maximum distance between the client and the revive marker while reviving");
g_convar_reviverate = CreateConVar("sm_allclassrevivemarker_reviverate", "0.2", "Dictates the amount of healing done every frame ( this is close to medic's revive rate )");
g_convar_spawnReviveMarker = CreateConVar("sm_allclassrevivemarker_spawnrevivemarker", "0", "It decides whether or not the revive markers should spawn. 0 ( default value ) - Doesn't spawn revive markers | 1 - Spawns for all teams | 2 - Spawns only for red team | 3 - Spawns only for blue team");

int CTFReviveMarker_nRevives = FindSendPropInfo("CTFReviveMarker", "m_nRevives");

Expand Down Expand Up @@ -91,6 +93,14 @@ void OnTakeDamagePost(int victim, int attacker, int inflictor, float damage, int
if(GetClientHealth(victim) > 0.0)
return;

if(!g_convar_spawnReviveMarker.IntValue)
return;

int victim_team = GetClientTeam(victim);

if(g_convar_spawnReviveMarker.IntValue != 1 && g_convar_spawnReviveMarker.IntValue != victim_team)
return;

SpawnReviveMarker(victim);

return;
Expand Down

0 comments on commit d4eaae0

Please sign in to comment.