Skip to content

Commit

Permalink
added jontohil explosive backstab
Browse files Browse the repository at this point in the history
  • Loading branch information
higps committed Jun 25, 2024
1 parent fbbca0a commit 2382f30
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 2 deletions.
148 changes: 148 additions & 0 deletions ability_paid_spy_jontohil2_ability.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#pragma semicolon 1
#include <sdkhooks>
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <berobot_constants>
#include <berobot>
#include <tf_custom_attributes>
#include <dhooks>
#include <tf_ontakedamage>

#define ROBOT_NAME "Jontohil2"
#define sBoomNoise1 "weapons/tacky_grenadier_explode1.wav"
#define sBoomNoise2 "weapons/tacky_grenadier_explode2.wav"
#define sBoomNoise3 "weapons/tacky_grenadier_explode3.wav"
#define PLUGIN_VERSION "1.0"
//#define GIFTBRINGER 30747

public Plugin:myinfo =
{
name = "[TF2] Hoovy explosion skill",
author = "Erofix using the code from: Pelipoika, PC Gamer, Jaster and StormishJustice",
description = "Play as the Giant Deflector Heavy from MvM",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}

public OnPluginStart()
{
HookEvent("player_death", Event_Death, EventHookMode_Post);
}

public OnMapStart()
{
PrecacheSound(sBoomNoise1);
PrecacheSound(sBoomNoise2);
PrecacheSound(sBoomNoise3);
}

public Event_Death(Event event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
int victim = GetClientOfUserId(GetEventInt(event, "userid"));

//int weaponID = GetEntPropEnt(weapon, Prop_Send, "m_iItemDefinitionIndex");

//PrintToChatAll("Attacker %N , weaponID %i, logname: %s", attacker, weaponID, weapon_logname);
int customkill = event.GetInt("customkill");

// Assuming 2 is the custom kill ID for backstab (you might need to confirm this)
if (IsRobot(attacker, ROBOT_NAME) && customkill == 2)
{
// PrintToChatAll("Player %d was backstabbed by player %d!", victim, attacker);
Handle infokv = CreateKeyValues("infokv");
KvSetNum(infokv, "attacker", attacker);
KvSetNum(infokv, "victim", victim);
CreateTimer(0.0, HoovyBoom, infokv);
}

return Plugin_Continue;

}

public Action HoovyBoom(Handle timer, any data)
{
Handle infokv = data;
int attacker = KvGetNum(infokv, "attacker");
int victim = KvGetNum(infokv, "victim");
float pos1[3];
float pos22[3];
GetClientAbsOrigin(attacker, pos1); // hack: make the explosion actually come from the attacker, that way we only have to hook one client
GetClientAbsOrigin(victim, pos22);

int particle = CreateEntityByName("info_particle_system");
DispatchKeyValue(particle, "effect_name", "ExplosionCore_Wall");
AcceptEntityInput(particle, "Start");
TeleportEntity(particle, pos22, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(particle);
ActivateEntity(particle);
// float pos2[3];
// float ignitetime = GetConVarFloat(FindConVar("sharpened_volcano_fragment_firetime"));

for(int client = 1 ; client <= MaxClients ; client++ )
{
if(IsClientInGame(client))
{
GetClientAbsOrigin(client, pos22);
if(GetVectorDistance(pos1, pos22) <= 300.0 && TF2_GetClientTeam(attacker) != TF2_GetClientTeam(client))
{
SDKHooks_TakeDamage(client, 0, attacker, 120.0, 0, -1);

// ClientCommand(client, "playgamesound weapons/explode1.wav");
//ClientCommand(client, "playgamesound %s", sound);
int soudswitch = GetRandomInt(1,3);


switch(soudswitch)
{
case 1:
{
EmitAmbientSound(sBoomNoise1, pos22, client, SNDLEVEL_NORMAL, SND_NOFLAGS, 1.0, SNDPITCH_NORMAL, 0.0);
}
case 2:
{
EmitAmbientSound(sBoomNoise2, pos22, client, SNDLEVEL_NORMAL, SND_NOFLAGS, 1.0, SNDPITCH_NORMAL, 0.0);
}
case 3:
{
EmitAmbientSound(sBoomNoise3, pos22, client, SNDLEVEL_NORMAL, SND_NOFLAGS, 1.0, SNDPITCH_NORMAL, 0.0);
}
}

//return Plugin_Changed;

}
}
}
return Plugin_Continue;
}

/* Plugin Exclusive Functions */
//Code that stuns players
// public Action TF2_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom, CritType &critType)
// {
// // if (!g_Enable)
// // return Plugin_Continue;
// if(!IsValidClient(victim))
// return Plugin_Continue;
// if(!IsValidClient(attacker))
// return Plugin_Continue;


// if(IsRobot(attacker, ROBOT_NAME))
// {

// if(TF2_IsPlayerInCondition(victim, TFCond_Taunting) && !IsAnyRobot(victim))
// {
// int tauntid = GetEntProp(victim, Prop_Send, "m_iTauntItemDefIndex");
// // PrintToChatAll("Taunt ID %i", tauntid);
// if (tauntid != -1)SendVictimToSpace(victim);
// }

// }

// return Plugin_Continue;
// }


1 change: 1 addition & 0 deletions berobot_config_reader.sp
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ MakeRobotFrame(client)
float duration = i_hConfig.GetFloat(NULL_STRING);

// Apply the condition with the specified duration.
// Here we need some logic in case spy doesn't get the infinite cloak stat yet
if (duration >= 0.0)
{
TF2_AddCondition(client, conditionID, duration);
Expand Down
6 changes: 4 additions & 2 deletions cfg/robots/paid_spy_jontohil.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
{
"model" "models/bots/spy/bot_spy.mdl"
"class" "Spy"
"shortdescription" "Revolver, Knife, Invis"
"shortdescription" "Explosive backstab, Revolver"
"name" "Jontohil2"
"deathtip" "Pyro's flames & airblast can shut down spies"
"deathtip" "Don't stand to close when he backstabs, it goes boom"
"role" "Spy"
"subclass" "Spy"
"tips" "Infinite cloak"
Expand Down Expand Up @@ -56,6 +56,7 @@
"attributes"
{
"killstreak tier" "1.0"
"dmg penalty vs players" "1.2"
}
}

Expand All @@ -69,6 +70,7 @@
"attributes"
{
"killstreak tier" "1.0"

}
}
"tf_weapon_invis"
Expand Down

0 comments on commit 2382f30

Please sign in to comment.