AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [TF2] Change medic's speed if healing a scout (https://forums.alliedmods.net/showthread.php?t=285700)

Nursik 07-28-2016 13:29

[TF2] Change medic's speed if healing a scout
 
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.

pheadxdll 07-28-2016 22:52

Re: [TF2] Change medic's speed if healing a scout
 
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.


All times are GMT -4. The time now is 10:45.

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