[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(client, TFWeaponSlot_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(client, TFWeaponSlot_Secondary); if (medigun <= MaxClients || !IsValidEdict(medigun)) return -1; GetEdictClassname(medigun, s, sizeof(s)); if (strcmp(s, "tf_weapon_medigun", false) == 0) { if (GetEntProp(medigun, Prop_Send, "m_bHealing")) return GetEntPropEnt(medigun, Prop_Send, "m_hHealingTarget"); } return -1; }
stock bool:IsValidClient(client, bool:replaycheck = true) { if (client <= 0 || client > MaxClients) return false; if (!IsClientInGame(client)) return false; if (GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false; if (replaycheck) { if (IsClientSourceTV(client) || IsClientReplay(client)) return false; } return true; }
stock bool:IsValidClient(client, bool:replaycheck = true) { if (client <= 0 || client > MaxClients) return false; if (!IsClientInGame(client)) return false; if (GetEntProp(client, Prop_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.
|