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

Solved [TF2] Help getting Headless Horsemann on grey team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gamerz103
Junior Member
Join Date: Mar 2022
Old 10-24-2022 , 14:53   [TF2] Help getting Headless Horsemann on grey team
Reply With Quote #1

I would like to make him spawn on grey team instead of red/blue.
PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
//#include <sdkhooks>
#include <tf2_stocks>
#include <tf2items>
#include <tf2attributes>

#define PLUGIN_VERSION "1.5"

#define HHH "models/bots/headless_hatman.mdl"
#define AXE "models/weapons/c_models/c_bigaxe/c_bigaxe.mdl"
#define SPAWN "ui/halloween_boss_summoned_fx.wav"
#define SPAWNRUMBLE "ui/halloween_boss_summon_rumble.wav"
#define SPAWNVO "vo/halloween_boss/knight_spawn.mp3"
#define BOO "vo/halloween_boss/knight_alert.mp3"
#define ATTACK "vo/halloween_boss/knight_attack01.mp3"
#define ATTACK2 "vo/halloween_boss/knight_attack02.mp3"
#define ATTACK3 "vo/halloween_boss/knight_attack03.mp3"
#define ATTACK4 "vo/halloween_boss/knight_attack04.mp3"
#define PAIN "vo/halloween_boss/knight_pain01.mp3"
#define PAIN2 "vo/halloween_boss/knight_pain02.mp3"
#define LAUGH "vo/halloween_boss/knight_laugh01.mp3"
#define LAUGH2 "vo/halloween_boss/knight_laugh02.mp3"
#define LAUGH3 "vo/halloween_boss/knight_laugh03.mp3"
#define LAUGH4 "vo/halloween_boss/knight_laugh04.mp3"
#define DEATH "ui/halloween_boss_defeated_fx.wav"
#define DEATHVO "vo/halloween_boss/knight_death02.wav"
#define DEATHVO2 "vo/halloween_boss/knight_dying.wav"
#define LEFTFOOT "player/footsteps/giant1.wav"
#define RIGHTFOOT "player/footsteps/giant2.wav"
#define SND_AXEHITFLESH "Halloween.HeadlessBossAxeHitFlesh"
#define SND_AXEHITWORLD "Halloween.HeadlessBossAxeHitWorld"
//#define SND_BOO "Halloween.HeadlessBossBoo"
//#define Boo "Halloween_HeadlessBossBoo
#define SND_ALERT "Halloween.HeadlessBossAlert"
#define SND_LAUGH "Halloween.HeadlessBossLaugh"
#define SND_DYING "Halloween.HeadlessBossDying"
#define SND_DEATH "Halloween.HeadlessBossDeath"
#define SND_PAIN "Halloween.HeadlessBossPain"
#define SND_ATTACK "Halloween.HeadlessBossAttack"
#define SND_SPAWN "Halloween.HeadlessBossSpawn"
#define SND_SPAWNRUMBLE "Halloween.HeadlessBossSpawnRumble"
#define SND_FOOT "Halloween.HeadlessBossFootfalls"
#define SND_AXEHITFLESH "Halloween.HeadlessBossAxeHitFlesh"
#define SND_AXEHITWORLD "Halloween.HeadlessBossAxeHitWorld"

public Plugin myinfo =
{
    
name "[TF2] Be the Horsemann",
    
author "FlaminSarge, Pelipoika, modified by gamerz103",
    
description "Be the Horsemann",
    
version PLUGIN_VERSION,
    
url "http://forums.alliedmods.net/showthread.php?t=166819"
}

new 
Handle:hCvarThirdPerson;
new 
Handle:hCvarHealth;
new 
Handle:hCvarSounds;
new 
Handle:hCvarBoo;
new 
bool:g_IsModel[MAXPLAYERS+1] = { false, ... };
new 
bool:g_bIsTP[MAXPLAYERS+1] = { false, ... };
new 
bool:g_bIsHHH[MAXPLAYERS 1] = { false, ... };
new 
g_iHHHParticle[MAXPLAYERS 1][3];
//new bool:g_bLeftFootstep[MAXPLAYERS + 1] = { 0, ... };
new lastTeam[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
LoadTranslations("common.phrases");
    
CreateConVar("bethehorsemann_version"PLUGIN_VERSION"[TF2] Be the Horsemann version"FCVAR_NOTIFY FCVAR_NONE FCVAR_SPONLY);
    
hCvarHealth CreateConVar("behhhboss_health""750""Amount of health to ADD to the HHH (stacks on current class health)"FCVAR_NONE);
    
hCvarSounds CreateConVar("behhhboss_sounds""1""Use Horsemann sounds (spawn, death, footsteps; will not disable BOO)"FCVAR_NONEtrue0.0true1.0);
    
hCvarBoo CreateConVar("behhhboss_boo""2""2-Boo stuns nearby enemies; 1-Boo is sound only; 0-no Boo"FCVAR_NONEtrue0.0true2.0);
    
hCvarThirdPerson CreateConVar("behhh_thirdperson""1""Whether or not Horsemenn ought to be in third-person"FCVAR_NONEtrue0.0true1.0);
    
RegAdminCmd("sm_behhhboss"Command_HorsemannADMFLAG_SLAY"It's a good time to run - turns <target> into a Horsemann");
    
RegAdminCmd("sm_horsemann"Command_HorsemannADMFLAG_SLAY"It's a good time to run - turns <target> into a Horsemann");
    
AddNormalSoundHook(HorsemannSH);
    
HookEvent("post_inventory_application"EventInventoryApplicationEventHookMode_Post);
    
HookEvent("player_hurt"Event_PlayerHurt);
    
HookEvent("player_death"Event_DeathEventHookMode_Post);
}

public 
OnClientPutInServer(client)
{
    
OnClientDisconnect_Post(client);
}

public 
OnClientDisconnect_Post(client)
{
    
g_IsModel[client] = false;
    
g_bIsTP[client] = false;
    
g_bIsHHH[client] = false;
    
ClearHorsemannParticles(client);
}

public 
OnPluginEnd()
{
    for (new 
client 1client <= MaxClientsclient++)
    {
        
ClearHorsemannParticles(client);
    }
}

public 
OnMapStart()
{
    
PrecacheModel(HHHtrue);
    
PrecacheModel(AXEtrue);
    
PrecacheSound(BOOtrue);
    
PrecacheSound(ATTACKtrue);
    
PrecacheSound(ATTACK2true);
    
PrecacheSound(ATTACK3true);
    
PrecacheSound(ATTACK4true);
    
PrecacheSound(PAINtrue);
    
PrecacheSound(PAIN2true);
    
PrecacheSound(SPAWNRUMBLEtrue);
    
PrecacheSound(SPAWNtrue);
    
PrecacheSound(LAUGHtrue);
    
PrecacheSound(LAUGH2true);
    
PrecacheSound(LAUGH3true);
    
PrecacheSound(LAUGH4true);
    
PrecacheSound(SPAWNVOtrue);
    
PrecacheSound(DEATHtrue);
    
PrecacheSound(DEATHVOtrue);
    
PrecacheSound(LEFTFOOTtrue);
    
PrecacheSound(RIGHTFOOTtrue);
    
PrecacheScriptSound(SND_LAUGH);
    
PrecacheScriptSound(SND_DYING);
    
PrecacheScriptSound(SND_DEATH);
    
PrecacheScriptSound(SND_PAIN);
//    PrecacheScriptSound(SND_BOO);
    
PrecacheScriptSound(SND_ALERT);
    
PrecacheScriptSound(SND_ATTACK);
    
PrecacheScriptSound(SND_SPAWN);
    
PrecacheScriptSound(SND_SPAWNRUMBLE);
    
PrecacheScriptSound(SND_FOOT);
    
PrecacheScriptSound(SND_AXEHITFLESH);
    
PrecacheScriptSound(SND_AXEHITWORLD);
    
PrecacheSound("ui/halloween_boss_defeated_fx.wav");
    
PrecacheSound("vo/halloween_boss/knight_dying.wav");
    
PrecacheSound("vo/halloween_boss/knight_laugh01.mp3");
    
PrecacheSound("vo/halloween_boss/knight_laugh02.mp3");
    
PrecacheSound("vo/halloween_boss/knight_laugh03.mp3");
    
PrecacheSound("vo/halloween_boss/knight_laugh04.mp3");
    
PrecacheSound("vo/halloween_boss/knight_alert.mp3");
    
// TF2Items_CreateWeapon(8266, "tf_weapon_sword", 266, 2, 5, 100, "15 ; 0 ; 26 ; 750.0 ; 2 ; 999.0 ; 107 ; 4.0 ; 109 ; 0.0 ; 62 ; 0.09 ; 205 ; 0.05 ; 206 ; 0.05 ; 68 ; -2 ; 236 ; 1.0 ; 53 ; 1.0 ; 27 ; 1.0 ; 180 ; -25 ; 219 ; 1.0", _, "models/weapons/c_models/c_bigaxe/c_bigaxe.mdl", true);
}

public 
EventInventoryApplication(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
RemoveModel(client);
    
ClearHorsemannParticles(client);
    if (
g_bIsHHH[client])
    {
        
SetVariantInt(0);
        
AcceptEntityInput(client"SetForcedTauntCam");
    }
    
g_bIsHHH[client] = false;
}

public 
Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    new 
deathflags GetEventInt(event"death_flags");
    if (!(
deathflags TF_DEATHFLAG_DEADRINGER))
    {
        if (
IsValidClient(client) && g_bIsHHH[client])
        {
            
ChangeClientTeam(clientlastTeam[client]);
            
// DoHorsemannDeath(client);
            
ClearHorsemannParticles(client);
            if (
GetConVarBool(hCvarSounds))
            {
                
EmitSoundToAll(DEATH);
                
EmitSoundToAll(DEATHVO);
            }
        }
    }
}

public 
Action:SetModel(client, const String:model[])
{
    if (
IsValidClient(client) && IsPlayerAlive(client))
    {
        
SetVariantString(model);
        
AcceptEntityInput(client"SetCustomModel");

        
SetEntProp(clientProp_Send"m_bUseClassAnimations"1);

        
g_IsModel[client] = true;
    }
}

public 
Action:RemoveModel(client)
{
    if (
IsValidClient(client) && g_IsModel[client])
    {
        
SetVariantString("");
        
AcceptEntityInput(client"SetCustomModel");
        
g_IsModel[client] = false;
    }
// return Plugin_Handled;
}

/*stock SwitchView (target, boolbserver, bool:viewmodel, bool:self)
{
    SetEntPropEnt(target, Prop_Send, "m_hObserverTarget", observer ? target:-1);
    SetEntProp(target, Prop_Send, "m_iObserverMode", observer ? 1:0);
    SetEntProp(target, Prop_Send, "m_iFOV", observer ? 100 : GetEntProp(target, Prop_Send, "m_iDefaultFOV"));
    SetEntProp(target, Prop_Send, "m_bDrawViewmodel", viewmodel ? 1:0);

    SetVariantBool(self);
    if (self) AcceptEntityInput(target, "SetCustomModelVisibletoSelf");
    g_bIsTP[target] = observer;
}*/

stock ClearHorsemannParticles(client)
{
    
TF2Attrib_SetByName(client"SPELL: set Halloween footstep type"0.0);
    
TE_ParticleToAll("halloween_boss_death"___client);

    for (new 
03i++)
    {
        new 
ent EntRefToEntIndex(g_iHHHParticle[client][i]);
        if (
ent MaxClients && IsValidEntity(ent)) AcceptEntityInput(ent"Kill");
        
g_iHHHParticle[client][i] = INVALID_ENT_REFERENCE;
    }
}

stock DoHorsemannParticles(client)
{
    
ClearHorsemannParticles(client);
    new 
lefteye MakeParticle(client"halloween_boss_eye_glow""lefteye");
    if (
IsValidEntity(lefteye))
    {
        
g_iHHHParticle[client][0] = EntIndexToEntRef(lefteye);
    }
    new 
righteye MakeParticle(client"halloween_boss_eye_glow""righteye");
    if (
IsValidEntity(righteye))
    {
        
g_iHHHParticle[client][1] = EntIndexToEntRef(righteye);
    }

    
TE_ParticleToAll("ghost_pumpkin"___client);
}

stock MakeParticle(clientString:effect[], String:attachment[])
{
    
decl Float:pos[3];
    
decl Float:ang[3];
    
decl String:buffer[128];
    
GetEntPropVector(clientProp_Send"m_vecOrigin"pos);
    
GetClientEyeAngles(clientang);
    
ang[0] *= -1;
    
ang[1] += 180.0;
    if (
ang[1] > 180.0ang[1] -= 360.0;
    
ang[2] = 0.0;
    
// GetAngleVectors(ang, pos2, NULL_VECTOR, NULL_VECTOR);
    
new particle CreateEntityByName("info_particle_system");
    if (!
IsValidEntity(particle)) return -1;
    
TeleportEntity(particleposangNULL_VECTOR);
    
DispatchKeyValue(particle"effect_name"effect);
    
SetVariantString("!activator");
    
AcceptEntityInput(particle"SetParent"clientparticle0);
    if (
attachment[0] != '\0')
    {
        
SetVariantString(attachment);
        
AcceptEntityInput(particle"SetParentAttachmentMaintainOffset"particleparticle0);
    }
    
Format(buffersizeof(buffer), "%s_%s%d"effectattachmentparticle);
    
DispatchKeyValue(particle"targetname"buffer);
    
DispatchSpawn(particle);
    
ActivateEntity(particle);
    
SetEntPropEnt(particleProp_Send"m_hOwnerEntity"client);
    
AcceptEntityInput(particle"Start");
    return 
particle;
}

public 
Action:Command_Horsemann(clientargs)
{
    
decl String:arg1[32];
    if (
args 1)
    {
        
arg1 "@me";
    }
    else 
GetCmdArg(1arg1sizeof(arg1));
    if (!
StrEqual(arg1"@me") && !CheckCommandAccess(client"sm_behhhboss_others"ADMFLAG_ROOTtrue))
    {
        
ReplyToCommand(client"[SM] %t""No Access");
        return 
Plugin_Handled;
    }
    
/**
    * target_name - stores the noun identifying the target(s)
    * target_list - array to store clients
    * target_count - variable to store number of clients
    * tn_is_ml - stores whether the noun must be translated
    */
    
new String:target_name[MAX_TARGET_LENGTH];
    new 
target_list[MAXPLAYERS], target_count;
    new 
bool:tn_is_ml;

    if ((
target_count ProcessTargetString(
    
arg1,
    
client,
    
target_list,
    
MAXPLAYERS,
    
COMMAND_FILTER_ALIVE|(args COMMAND_FILTER_NO_IMMUNITY 0), /* Only allow alive players. If targetting self, allow self. */
    
target_name,
    
sizeof(target_name),
    
tn_is_ml)) <= 0)
    {
    
/* if (strcmp(arg1, "@me", false) == 0 && target_count == COMMAND_TARGET_IMMUNE)
        {
            target_list[0] = client;
            target_count = 1;
        }
        else*/
    /* This function replies to the admin with a failure message */
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }
    for (new 
0target_counti++)
    {
        
MakeHorsemann(target_list[i]);
        
LogAction(clienttarget_list[i], "\"%L\" made \"%L\" a Horseless Headless Horsemann"clienttarget_list[i]);
    }
    if (
GetConVarBool(hCvarSounds))
    {
        
EmitSoundToAll(SPAWN);
        
EmitSoundToAll(SPAWNRUMBLE);
        
EmitSoundToAll(SPAWNVO);
    }
    return 
Plugin_Handled;
}

MakeHorsemann(client)
{
    
lastTeam[client] = GetClientTeam(client); 
    new 
Float:origin[3], Float:angles[3]; 
    
GetClientAbsOrigin(clientorigin); 
    
GetClientAbsAngles(clientangles); 
    
ChangeClientTeam(client0); 
    
    
TF2_SetPlayerClass(clientTFClass_DemoMan);
    
TF2_RegeneratePlayer(client);

    
EmitGameSoundToAll(SND_SPAWN);
    
EmitGameSoundToAll(SND_SPAWNRUMBLE);

    new 
ragdoll GetEntPropEnt(clientProp_Send"m_hRagdoll");
    if (
ragdoll MaxClients && IsValidEntity(ragdoll)) AcceptEntityInput(ragdoll"Kill");
    
decl String:weaponname[32];
    
GetClientWeapon(clientweaponnamesizeof(weaponname));
    if (
strcmp(weaponname"tf_weapon_minigun"false) == 0)
    {
        
SetEntProp(GetPlayerWeaponSlot(client0), Prop_Send"m_iWeaponState"0);
        
TF2_RemoveCondition(clientTFCond_Slowed);
    }
    
TF2_SwitchtoSlot(clientTFWeaponSlot_Melee);
    
CreateTimer(0.0Timer_Switchclient);
    
// TF2Items_GiveWeapon(client, 8266);
    
SetModel(clientHHH);
    if (
GetConVarBool(hCvarThirdPerson))
    {
        
SetVariantInt(1);
        
AcceptEntityInput(client"SetForcedTauntCam");
    }
    
DoHorsemannParticles(client);
    
TF2_RemoveWeaponSlot(client0);
    
TF2_RemoveWeaponSlot(client1);
    
TF2_RemoveWeaponSlot(client5);
    
TF2_RemoveWeaponSlot(client3);
    
TF2_SetHealth(client50000);
    
g_bIsHHH[client] = true;
    
// g_bIsTP[client] = true;
}

stock TF2_RemoveAllWearables(client)
{
    new 
wearable = -1;
    while ((
wearable FindEntityByClassname(wearable"tf_wearable*")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            new 
player GetEntPropEnt(wearableProp_Send"m_hOwnerEntity");
            if (
client == player)
            {
                
TF2_RemoveWearable(clientwearable);
            }
        }
    }

    while ((
wearable FindEntityByClassname(wearable"tf_powerup_bottle")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            new 
player GetEntPropEnt(wearableProp_Send"m_hOwnerEntity");
            if (
client == player)
            {
                
TF2_RemoveWearable(clientwearable);
            }
        }
    }

    while ((
wearable FindEntityByClassname(wearable"tf_weapon_spellbook")) != -1)
    {
        if (
IsValidEntity(wearable))
        {
            new 
player GetEntPropEnt(wearableProp_Send"m_hOwnerEntity");
            if (
client == player)
            {
                
TF2_RemoveWearable(clientwearable);
            }
        }
    }
}

TE_ParticleToAll(String:Name[], Float:origin[3]=NULL_VECTORFloat:start[3]=NULL_VECTORFloat:angles[3]=NULL_VECTORentindex=-1,attachtype=-1,attachpoint=-1bool:resetParticles=true)
{
    
// find string table
    
new tblidx FindStringTable("ParticleEffectNames");
    if (
tblidx==INVALID_STRING_TABLE
    {
        
LogError("Could not find string table: ParticleEffectNames");
        return;
    }
    
    
// find particle index
    
new String:tmp[256];
    new 
count GetStringTableNumStrings(tblidx);
    new 
stridx INVALID_STRING_INDEX;
    new 
i;
    for (
i=0i<counti++)
    {
        
ReadStringTable(tblidxitmpsizeof(tmp));
        if (
StrEqual(tmpNamefalse))
        {
            
stridx i;
            break;
        }
    }
    if (
stridx==INVALID_STRING_INDEX)
    {
        
LogError("Could not find particle: %s"Name);
        return;
    }
    
    
TE_Start("TFParticleEffect");
    
TE_WriteFloat("m_vecOrigin[0]"origin[0]);
    
TE_WriteFloat("m_vecOrigin[1]"origin[1]);
    
TE_WriteFloat("m_vecOrigin[2]"origin[2]);
    
TE_WriteFloat("m_vecStart[0]"start[0]);
    
TE_WriteFloat("m_vecStart[1]"start[1]);
    
TE_WriteFloat("m_vecStart[2]"start[2]);
    
TE_WriteVector("m_vecAngles"angles);
    
TE_WriteNum("m_iParticleSystemIndex"stridx);
    if (
entindex!=-1)
    {
        
TE_WriteNum("entindex"entindex);
    }
    if (
attachtype!=-1)
    {
        
TE_WriteNum("m_iAttachType"attachtype);
    }
    if (
attachpoint!=-1)
    {
        
TE_WriteNum("m_iAttachmentPointIndex"attachpoint);
    }
    
TE_WriteNum("m_bResetParticles"resetParticles 0);    
    
TE_SendToAll();
}    
stock TF2_SetHealth(clientNewHealth)
{
    
SetEntProp(clientProp_Send"m_iHealth"NewHealth1);
    
SetEntProp(clientProp_Data"m_iHealth"NewHealth1);
}

public 
Action:Timer_Switch(Handle:timerany:client)
{
    if (
IsValidClient(client))
    
GiveAxe(client);
}

stock GiveAxe(client)
{
    
TF2_RemoveAllWearables(client);

    
TF2_RemoveWeaponSlot(clientTFWeaponSlot_Melee);
    new 
Handle:hWeapon TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
    if (
hWeapon != INVALID_HANDLE)
    {
        
TF2Items_SetClassname(hWeapon"tf_weapon_sword");
        
TF2Items_SetItemIndex(hWeapon266);
        
TF2Items_SetLevel(hWeapon255);
        
TF2Items_SetQuality(hWeapon8);
        new 
String:weaponAttribs[256];
        
//This is so, so bad and I am so very, very sorry, but TF2Attributes will be better.
        
Format(weaponAttribssizeof(weaponAttribs), "264 ; 2.0 ; 263 ; 2.0 ; 15 ; 0 ; 26 ; %d ; 2 ; 1133123.0 ; 107 ; 4.0 ; 109 ; 0.0 ; 62 ; 0.70 ; 205 ; 0.05 ; 206 ; 0.05 ; 68 ; -2 ; 69 ; 0.0 ; 53 ; 1.0 ; 27 ; 1.0"GetConVarInt(hCvarHealth));
        new 
String:weaponAttribsArray[32][32];
        new 
attribCount ExplodeString(weaponAttribs" ; "weaponAttribsArray3232);
        if (
attribCount 0
        {
            
TF2Items_SetNumAttributes(hWeaponattribCount/2);
            new 
i2 0;
            for (new 
0attribCounti+=2
            {
                
TF2Items_SetAttribute(hWeaponi2StringToInt(weaponAttribsArray[i]), StringToFloat(weaponAttribsArray[i+1]));
                
i2++;
            }
        } 
        else 
        {
            
TF2Items_SetNumAttributes(hWeapon0);
        }
        new 
weapon TF2Items_GiveNamedItem(clienthWeapon);
        
EquipPlayerWeapon(clientweapon);

        
CloseHandle(hWeapon);
        
SetEntProp(weaponProp_Send"m_iWorldModelIndex"PrecacheModel(AXE));
        
SetEntProp(weaponProp_Send"m_nModelIndexOverrides"PrecacheModel(AXE), _0);
    }
}

stock TF2_SwitchtoSlot(clientslot)
{
    if (
slot >= && slot <= && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
decl String:classname[64];
        new 
wep GetPlayerWeaponSlot(clientslot);
        if (
wep MaxClients && IsValidEdict(wep) && GetEdictClassname(wepclassnamesizeof(classname)))
        {
            
FakeClientCommandEx(client"use %s"classname);
            
SetEntPropEnt(clientProp_Send"m_hActiveWeapon"wep);
        }
    }
}

public 
Event_PlayerHurt(Handle:hEvent, const String:strEventName[], bool:bDontBroadcast)
{
    new 
iVictim GetClientOfUserId(GetEventInt(hEvent"userid"));
    new 
iAttacker GetClientOfUserId(GetEventInt(hEvent"attacker"));
    if(
iVictim != iAttacker && iVictim >= && iVictim <= MaxClients && IsClientInGame(iVictim) && iAttacker >= && iAttacker <= MaxClients && IsClientInGame(iAttacker))
    {
        if(
IsPlayerAlive(iVictim) && GetEventInt(hEvent"health") > && !TF2_IsPlayerInCondition(iVictimTFCond_Dazed) && g_bIsHHH[iAttacker])
        {
            
TF2_StunPlayer(iVictim1.5_TF_STUNFLAGS_GHOSTSCARE);
        }
    }
}

public 
Action:HorsemannSH(clients[64], &numClientsString:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
{
    if (!
IsValidClient(entity)) return Plugin_Continue;
    if (!
g_bIsHHH[entity]) return Plugin_Continue;

    new 
iboo GetConVarInt(hCvarBoo);
    if (
iboo && StrContains(sample"_medic0"false) != -1)
    {
        
sample BOO;
        if (
iboo 1)
        {
            
DoHorsemannScare(entity);
        }
        return 
Plugin_Changed;
    }
    
    if (
strncmp(sample"player/footsteps/"17false) == 0)
    {
        switch(
GetRandomInt(12))
        {
        case 
1Format(samplesizeof(sample), "player/footsteps/giant1.wav");
        case 
2Format(samplesizeof(sample), "player/footsteps/giant2.wav");
        }
        
        
EmitSoundToAll(sampleentity);

        new 
Float:clientPos[3];
        
GetClientAbsOrigin(entityclientPos);

        for (new 
1<= MaxClientsi++)
        {
            if (!
IsClientInGame(i)) continue;
            if (!
IsPlayerAlive(i)) continue;
            if (
== entity) continue;

            new 
Float:zPos[3];
            
GetClientAbsOrigin(izPos);

            new 
Float:flDistance GetVectorDistance(clientPoszPos);

            if (
flDistance 500.0)
            {
            
ScreenShake(iFloatAbs((500.0 flDistance) / (500.0 0.0) * 15.0), 5.01.0);
            }
        }

        return 
Plugin_Changed;
    }
    
    if(
StrContains(sample"knight_axe_miss"false) != -|| StrContains(sample"knight_axe_hit"false) != -1)
    {
        new 
Float:clientPos[3];
        
GetClientAbsOrigin(entityclientPos);

        for (new 
1<= MaxClientsi++)
        {
            if (!
IsClientInGame(i)) continue;
            if (!
IsPlayerAlive(i)) continue;

            new 
Float:zPos[3];
            
GetClientAbsOrigin(izPos);

            new 
Float:flDistance GetVectorDistance(clientPoszPos);

            if (
flDistance 500.0)
            {
                
ScreenShake(iFloatAbs((500.0 flDistance) / (500.0 0.0) * 15.0), 5.01.0);
            }
        }
    }
    
    else if(
StrContains(sample"sword_swing"false) != -|| StrContains(sample"cbar_miss"false) != -1)
    {
        switch(
GetRandomInt(14))
        {
            case 
1Format(samplesizeof(sample), "vo/halloween_boss/knight_attack01.mp3v");
            case 
2Format(samplesizeof(sample), "vo/halloween_boss/knight_attack02.mp3");
            case 
3Format(samplesizeof(sample), "vo/halloween_boss/knight_attack03.mp3");
            case 
4Format(samplesizeof(sample), "vo/halloween_boss/knight_attack04.mp3");
        }
        
EmitSoundToAll(sampleentitySNDCHAN_VOICE9501.0100);
        
TE_ParticleToAll("ghost_pumpkin"___entity);

        return 
Plugin_Changed;
    }
    else if(
StrContains(sample"vo/"false) != -1)
    {
        if(
StrContains(sample"_medic0"false) != -1)
        {
            
Format(samplesizeof(sample), "vo/halloween_boss/knight_alert.mp3");
            
DoHorsemannScare(entity);
            return 
Plugin_Changed;
        }
        else if(
StrContains(sample"pain"false) != -1)
        {
        
// Format(sample, sizeof(sample), "Halloween.HeadlessBossPain");
            
switch(GetRandomInt(13))
            {
            case 
1Format(samplesizeof(sample), "vo/halloween_boss/knight_pain01.mp3");
            case 
2Format(samplesizeof(sample), "vo/halloween_boss/knight_pain02.mp3");
            case 
3Format(samplesizeof(sample), "vo/halloween_boss/knight_pain03.wav");
            }
            return 
Plugin_Changed;
        }
        else
        {
            switch(
GetRandomInt(14))
            {
                case 
1Format(samplesizeof(sample), "vo/halloween_boss/knight_laugh01.mp3");
                case 
2Format(samplesizeof(sample), "vo/halloween_boss/knight_laugh02.mp3");
                case 
3Format(samplesizeof(sample), "vo/halloween_boss/knight_laugh03.mp3");
                case 
4Format(samplesizeof(sample), "vo/halloween_boss/knight_laugh04.mp3");
            }

            return 
Plugin_Changed;
        }
    }

    return 
Plugin_Continue;
}

DoHorsemannScare(client)
{
    
decl Float:HorsemannPosition[3];
    
decl Float:pos[3];
    new 
HorsemannTeam;

    
GetClientAbsOrigin(clientHorsemannPosition);
    
HorsemannTeam GetClientTeam(client);
    
TF2_StunPlayer(client1.31.0TF_STUNFLAG_SLOWDOWN|TF_STUNFLAG_NOSOUNDOREFFECT);
    for (new 
1<= MaxClientsi++)
    {
        if (!
IsValidClient(i) || !IsPlayerAlive(i) || HorsemannTeam == GetClientTeam(i))
        continue;

        
GetClientAbsOrigin(ipos);
        if (
GetVectorDistance(HorsemannPositionpos) <= 500 && !FindHHHSaxton(i) && !g_bIsHHH[i])
        {
            
TF2_StunPlayer(i4.00.3TF_STUNFLAGS_GHOSTSCARE|TF_STUNFLAG_SLOWDOWN) ;
        }
    }
}

stock bool:IsValidClient(client)
{
    if (
client <= 0) return false;
    if (
client MaxClients) return false;
    
// if (!IsClientConnected(client)) return false;
    
return IsClientInGame(client);
}
stock bool:FindHHHSaxton(client)
{
    new 
edict MaxClients+1;
    while((
edict FindEntityByClassname2(edict"tf_wearable")) != -1)
    {
        
decl String:netclass[32];
        if (
GetEntityNetClass(edictnetclasssizeof(netclass)) && StrEqual(netclass"CTFWearable"))
        {
            new 
idx GetEntProp(edictProp_Send"m_iItemDefinitionIndex");
            if ((
idx == 277 || idx == 27 && GetEntPropEnt(edictProp_Send"m_hOwnerEntity") == client && !GetEntProp(edictProp_Send"m_bDisguiseWearable")))
            {
                return 
true;
            }
        }
    }
    return 
false;
}
stock FindEntityByClassname2(startEnt, const String:classname[])
{
    
/* If startEnt isn't valid shifting it back to the nearest valid one */
    
while (startEnt > -&& !IsValidEntity(startEnt)) startEnt--;
    return 
FindEntityByClassname(startEntclassname);
}

stock ScreenShake(targetFloat:intensity=30.0Float:duration=10.0Float:frequency=3.0)
{
    new 
Handle:bf;
    if ((
bf StartMessageOne("Shake"target)) != INVALID_HANDLE)
    {
        
BfWriteByte(bf0);
        
BfWriteFloat(bfintensity);
        
BfWriteFloat(bfduration);
        
BfWriteFloat(bffrequency);
        
EndMessage();
    }

Attached Files
File Type: sp Get Plugin or Get Source (bethehorsemann.sp - 23 views - 23.5 KB)

Last edited by gamerz103; 10-24-2022 at 20:16.
gamerz103 is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 10-24-2022 , 17:38   Re: [TF2] Help getting Headless Horsemann on grey team
Reply With Quote #2

Here's my version of the HHH Boss that puts him on the grey team. He can attack both RED and BLU teams. If he dies he reverts back to the players original team in their original class. HHH can cast unlimited Lightning spells with middle mouse button. HHH can stun nearby enemies by using the 'Medic' key (E by default).

Note: This is an overpowered version of a BOSS that is better suited for servers running a mod that increases player stats such as Uber Upgrades or X10. If you aren't running one of those you may want to consider nerfing the Boss within the sourcecode.

Installation:
Put smx file in /sourcemod/plugins folder
Put txt file in /sourcemod/gamedata folder
change map
Attached Files
File Type: sp Get Plugin or Get Source (behhhboss.sp - 26 views - 28.2 KB)
File Type: smx behhhboss.smx (19.4 KB, 23 views)
File Type: txt changeteam.txt (339 Bytes, 21 views)
PC Gamer is offline
gamerz103
Junior Member
Join Date: Mar 2022
Old 10-24-2022 , 18:09   Re: [TF2] Help getting Headless Horsemann on grey team
Reply With Quote #3

I tried your plugin and even tweaked mine a bit aswell. Whenever I type /behhhboss it doesn't work. I also put the txt file in gamedata

Last edited by gamerz103; 10-24-2022 at 18:17.
gamerz103 is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 10-24-2022 , 18:37   Re: [TF2] Help getting Headless Horsemann on grey team
Reply With Quote #4

Make sure you unload and remove your plugin before installing mine. The two plugins share the same command.
PC Gamer 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 14:44.


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