Code:
stock RemovePlayerTarge(client)
{
new edict = MaxClients+1;
while((edict = FindEntityByClassname2(edict, "tf_wearable_demoshield")) != -1)
{
new idx = GetEntProp(edict, Prop_Send, "m_iItemDefinitionIndex");
if ((idx == 131 || idx == 406) && GetEntPropEnt(edict, Prop_Send, "m_hOwnerEntity") == client && !GetEntProp(edict, Prop_Send, "m_bDisguiseWearable"))
{
AcceptEntityInput(edict, "Kill");
}
}
}
stock FindPlayerTarge(client)
{
new edict = MaxClients+1;
while((edict = FindEntityByClassname2(edict, "tf_wearable_demoshield")) != -1)
{
new idx = GetEntProp(edict, Prop_Send, "m_iItemDefinitionIndex");
if ((idx == 131 || idx == 406) && GetEntPropEnt(edict, Prop_Send, "m_hOwnerEntity") == client && !GetEntProp(edict, Prop_Send, "m_bDisguiseWearable"))
{
return edict;
}
}
return -1;
}
stock GetPlayerWeaponSlot_Wearable(client, slot)
{
new edict = MaxClients+1;
if (slot == TFWeaponSlot_Secondary)
{
while((edict = FindEntityByClassname2(edict, "tf_wearable_demoshield")) != -1)
{
new idx = GetEntProp(edict, Prop_Send, "m_iItemDefinitionIndex");
if ((idx == 131 || idx == 406) && GetEntPropEnt(edict, Prop_Send, "m_hOwnerEntity") == client && !GetEntProp(edict, Prop_Send, "m_bDisguiseWearable"))
{
return edict;
}
}
}
edict = MaxClients+1;
while((edict = FindEntityByClassname2(edict, "tf_wearable")) != -1)
{
decl String:netclass[32];
if (GetEntityNetClass(edict, netclass, sizeof(netclass)) && StrEqual(netclass, "CTFWearable"))
{
new idx = GetEntProp(edict, Prop_Send, "m_iItemDefinitionIndex");
if (((slot == TFWeaponSlot_Primary && (idx == 405 || idx == 608)) || (slot == TFWeaponSlot_Secondary && (idx == 57 || idx == 133 || idx == 231 || idx == 444))) && GetEntPropEnt(edict, Prop_Send, "m_hOwnerEntity") == client && !GetEntProp(edict, Prop_Send, "m_bDisguiseWearable"))
{
return edict;
}
}
}
return -1;
}
stock FindEntityByClassname2(startEnt, const String:classname[])
{
/* If startEnt isn't valid shifting it back to the nearest valid one */
while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
return FindEntityByClassname(startEnt, classname);
}
There's others e.g. ones tuned to non-demoshield wearable weapons, but you can figure those out easily.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.
All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You
will be fed to javalia otherwise.
Psyduck likes replays.