I'm trying to do something similar by making a Medigun with both features from the Quick-Fix and the Vaccinator. Unfortunately I believe they're hard-coded in, as they're based on the same attribute class, set_weapon_mode.
The same applies to the Ubercharges, which is dependent on set_charge_type. Setting it to 1 creates Kritzkrieg's Crits, 2 creates Quick-Fix's Megaheal, 3 creates Vaccinator's Resists (which can be very buggy), and leaving it empty is a standard Invulnerability. The VS Saxton Hale plug-in worked around it and I tweaked it a little for what I'm trying to make:
Code:
#include <tf2_stocks>
public OnPluginStart()
{
HookEvent("player_chargedeployed", event_uberdeployed);
CreateTimer(0.2, ClientTimer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
new uberTarget[MAXPLAYERS + 1];
public Action:event_uberdeployed(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new String:s[64];
if (IsValidClient(client) && IsPlayerAlive(client))
{
new medigun = GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary);
if (IsValidEntity(medigun))
{
GetEdictClassname(medigun, s, sizeof(s));
if (strcmp(s, "tf_weapon_medigun", false) == 0)
{
TF2_AddCondition(client, TFCond_HalloweenCritCandy, 0.5, client);
TF2_AddCondition(client, TFCond_MegaHeal, 0.5, client);
new target = GetHealingTarget(client);
if (IsValidClient(target, false) && IsPlayerAlive(target))
{
TF2_AddCondition(target, TFCond_HalloweenCritCandy, 0.5, client);
TF2_AddCondition(target, TFCond_MegaHeal, 0.5, client);
uberTarget[client] = target;
}
else uberTarget[client] = -1;
CreateTimer(0.4, Timer_Lazor, EntIndexToEntRef(medigun), TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
}
}
return Plugin_Continue;
}
public Action:Timer_Lazor(Handle:hTimer, any:medigunid)
{
new medigun = EntRefToEntIndex(medigunid);
if (medigun && IsValidEntity(medigun))
{
new client = GetEntPropEnt(medigun, Prop_Send, "m_hOwnerEntity");
if (IsValidClient(client, false) && IsPlayerAlive(client) && GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon") == medigun)
{
new target = GetHealingTarget(client);
if (TF2_IsPlayerInCondition(client, TFCond_Ubercharged))
{
TF2_AddCondition(client, TFCond_HalloweenCritCandy, 0.5);
TF2_AddCondition(client, TFCond_MegaHeal, 0.5);
if (IsValidClient(target, false) && IsPlayerAlive(target))
{
TF2_AddCondition(target, TFCond_HalloweenCritCandy, 0.5);
TF2_AddCondition(target, TFCond_MegaHeal, 0.5);
uberTarget[client] = target;
}
else uberTarget[client] = -1;
}
}
if (!TF2_IsPlayerInCondition(client, TFCond_Ubercharged))
{
return Plugin_Stop;
}
}
else
return Plugin_Stop;
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:nobots = true)
{
if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client)))
{
return false;
}
return IsClientInGame(client);
}
That'll only work with the normal Medigun. I hope that's what you're looking for!