-
Notifications
You must be signed in to change notification settings - Fork 7
/
ability_free_sniper_crocotron_ability.sp
92 lines (65 loc) · 2.46 KB
/
ability_free_sniper_crocotron_ability.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <berobot_constants>
#include <berobot>
#include <tf_custom_attributes>
#include <tf_ontakedamage>
#define PLUGIN_VERSION "1.0"
#define ROBOT_NAME "Crocotron"
public Plugin:myinfo =
{
name = "[TF2] Crocoton Ability",
author = "Erofix using the code from: Pelipoika, PC Gamer, Jaster and StormishJustice",
description = "Play as the Giant Jbird",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
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) && damagecustom != 0)
{
SpawnBombs(victim, attacker);
}
return Plugin_Continue;
}
void SpawnBombs(int client, int attacker)
{
int team = GetClientTeam(attacker);
float pos[3], vel[3];// ang[3];
int children = 1;
float speed = 250.0;
GetEntPropVector(client, Prop_Data, "m_vecOrigin", pos);
GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel);
pos[2] += 80.0;
for (int i = 1; i <= children; i++)
{
int child = CreateEntityByName("tf_projectile_jar");
float child_vel[3];
float child_ang[3];
//Prevent child grenades from detonating on contact
SetEntProp(child, Prop_Send, "m_bTouched", 1);
//Set properties
//SetEntProp(child, Prop_Send, "m_bCritical", view_as<int>(crit));
SetEntPropEnt(child, Prop_Data, "m_hOwnerEntity", attacker);
SetEntPropEnt(child, Prop_Data, "m_hThrower", attacker);
// SetEntPropFloat(child, Prop_Send, "m_flDamage", 100.0);
// SetEntPropFloat(child, Prop_Send, "m_flModelScale", 1.2);
GetClientEyeAngles(client, child_ang);
GetAngleVectors(child_ang, child_vel, NULL_VECTOR, NULL_VECTOR);
ScaleVector(child_vel, speed);
//child_vel[2] = FloatAbs(child_vel[2]);
SetEntProp(child, Prop_Send, "m_iTeamNum", team);
SetEntProp(child, Prop_Send, "m_bIsLive", 1);
TeleportEntity(child, pos, child_ang, child_vel);
DispatchSpawn(child);
//SDKHook(child, SDKHook_Touch, OnMirvOverlap);
}
}