Raised This Month: $32 Target: $400
 8% 

[TF2] Change medic's speed if healing a scout


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 07-28-2016 , 13:29   [TF2] Change medic's speed if healing a scout
Reply With Quote #1

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <tf2attributes>
#include <tf2_stocks>

public Plugin myinfo =
{
    
name "Pre-Meet Your Match Mediguns"
    
author "Nursik"
    
description "Reverts every medigun, but quickfix change"
    
version "1.0"
    
url "http://www.teamfortress.com" 
};

public 
Action:ClientTimer(Handle:hTimer)
{
    new 
client 1;
    new 
index GetIndexOfWeaponSlot(clientTFWeaponSlot_Secondary);
    if (
index == 29)
    {
        new 
healtarget GetHealingTarget(client);
        if (
IsValidClient(healtarget) && TF2_GetPlayerClass(healtarget) == TFClass_Scout)
        {
            
TF2Attrib_SetByName(client"move speed bonus"0.8);
        }
    }
    return 
Plugin_Continue;
}

stock GetHealingTarget(client)
{
    new 
String:s[64];
    new 
medigun GetPlayerWeaponSlot(clientTFWeaponSlot_Secondary);
    if (
medigun <= MaxClients || !IsValidEdict(medigun))
        return -
1;
    
GetEdictClassname(medigunssizeof(s));
    if (
strcmp(s"tf_weapon_medigun"false) == 0)
    {
        if (
GetEntProp(medigunProp_Send"m_bHealing"))
        return 
GetEntPropEnt(medigunProp_Send"m_hHealingTarget");
    }
    return -
1;
}

stock bool:IsValidClient(clientbool:replaycheck true)
{
    if (
client <= || client MaxClients) return false;
    if (!
IsClientInGame(client)) return false;
    if (
GetEntProp(clientProp_Send"m_bIsCoaching")) return false;
    if (
replaycheck)
    {
        if (
IsClientSourceTV(client) || IsClientReplay(client)) return false;
    }
    return 
true;
}

stock bool:IsValidClient(clientbool:replaycheck true)
{
    if (
client <= || client MaxClients) return false;
    if (!
IsClientInGame(client)) return false;
    if (
GetEntProp(clientProp_Send"m_bIsCoaching")) return false;
    if (
replaycheck)
    {
        if (
IsClientSourceTV(client) || IsClientReplay(client)) return false;
    }
    return 
true;

Hi, I need some little help. This is supposed to change medic's speed back to 320 if he starts to heal a scout, but it doesn't work at all. P.S I got this code from VSH.

Last edited by Nursik; 07-28-2016 at 13:37.
Nursik is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 07-28-2016 , 22:52   Re: [TF2] Change medic's speed if healing a scout
Reply With Quote #2

I told you in the other thread you posted that setting attributes won't work.

The game will simply pick the faster movement speed of your heal target and ignore any attributes you set on the player.
__________________
pheadxdll is offline
Reply



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 17:57.


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