Thanks Bacardi!
I made this plugin which works most of the time but it has two issues:
1. I'd prefer to find an solution that doesn't involve attributes.
2. Its buggy. The player will sometimes still get healed by a Medic.
If you have a better solution please share.
PHP Code:
#include <tf2_stocks>
#include <tf2attributes>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
#define CHEER "/ambient_mp3/bumper_car_cheer3.mp3"
public Plugin myinfo =
{
name = "No Healing",
author = "PC Gamer",
description = "Medics cannot heal Player",
version = PLUGIN_VERSION,
url = "https://forums.alliedmods.net/"
}
public void OnPluginStart()
{
RegConsoleCmd("sm_noheal", No_Heal, "Medics cannot heal you");
RegConsoleCmd("sm_nohealing", No_Heal, "Medics cannot heal you");
RegConsoleCmd("sm_nomedic", No_Heal, "Medics cannot heal you");
RegConsoleCmd("sm_heal", Zombie_Mode, "Medics can heal you");
RegConsoleCmd("sm_healing", Zombie_Mode, "Medics can heal you");
RegConsoleCmd("sm_medic", Zombie_Mode, "Medics can heal you");
}
public void OnMapStart()
{
PrecacheSound(CHEER);
}
public Action No_Heal(int client, int args)
{
if(IsValidClient(client))
{
TF2Attrib_SetByName(client, "mod weapon blocks healing", 1.0);
EmitSoundToAll(CHEER);
PrintToChat(client, "You can no longer be healed by Medics");
PrintToChat(client, "To reverse this effect type: !medic");
}
return Plugin_Handled;
}
public Action Zombie_Mode(int client, int args)
{
if(IsValidClient(client))
{
TF2Attrib_RemoveByName(client, "mod weapon blocks healing");
PrintToChat(client, "You can now be healed by Medics");
}
return Plugin_Handled;
}
stock bool IsValidClient(int client)
{
if (client <= 0) return false;
if (client > MaxClients) return false;
return IsClientInGame(client);
}