Raised This Month: $ Target: $400
 0% 

Solved [TF2] Don't Heal Me Plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-10-2022 , 16:54   Re: [TF2] Don't Heal Me Plugin
Reply With Quote #3

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 clientint 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 clientint 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);

PC Gamer is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode