View Single Post
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-04-2022 , 00:19   Re: [TF2] Give addcond effect to a player who calls "MEDIC"
Reply With Quote #2

This should do what you want. I added a timer to prevent command spamming.

PHP Code:
#include <tf2>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo 
{
    
name "Call for Medic",
    
author "PC Gamer",
    
description "Add condition when medic is called",
    
version "1.0",
    
url "www.sourcemod.com"    
}

bool g_wait[MAXPLAYERS 1] = {false, ...}; 

public 
void OnPluginStart()
{
    
AddCommandListener(Command_Listening"voicemenu");
}

public 
Action Command_Listening(int clientchar[] commandint args)
{
    
char arguments[4];
    
GetCmdArgString(argumentssizeof(arguments));
    if (
StrEqual(arguments"0 0") && g_wait[client] == false)
    {
        
//PrintToChatAll("Player %N called for a Medic", client);
        
TF2_AddCondition(clientTFCond_RadiusHealOnDamage0.1);
        
g_wait[client] = true;
        
CreateTimer(10.0Waitingclient); //How long you have to wait to use it again    
    
}
    
    return 
Plugin_Continue;
}

public 
Action Waiting(Handle timerany client
{
    
g_wait[client] = false;
    
    return 
Plugin_Handled;     

Attached Files
File Type: sp Get Plugin or Get Source (callmedic.sp - 71 views - 983 Bytes)
PC Gamer is offline