-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathability_paid_disruptor_pyro_astrobot_ability.sp
70 lines (59 loc) · 2.42 KB
/
ability_paid_disruptor_pyro_astrobot_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
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <sm_logger>
#include <berobot_constants>
#include <berobot>
#define PLUGIN_VERSION "1.0"
#define ROBOT_NAME "Astrobot"
public Plugin:myinfo =
{
name = "[TF2] Astro bot flying skill",
author = "Erofix using the code from: Pelipoika, PC Gamer, Jaster and StormishJustice",
description = "Play as the Giant Agro Pyro from Kritzkast",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
float fl_NextSecondaryAttack[MAXPLAYERS+1] = {0.0,...};
float AirblastPower = 400.0;
public void OnMapStart()
{
for(int i = 0; i <= MAXPLAYERS; i++)
{
fl_NextSecondaryAttack[i] = 0.0;
}
}
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2])
{
if(IsRobot(client, ROBOT_NAME) && IsPlayerAlive(client))
{
// Class Check
new String:weaponname[64], wep, Float:fl_EyeAngles[3], Float:fl_vel[3];
GetClientEyeAngles(client, fl_EyeAngles);
fl_EyeAngles[0] = DegToRad(-1.0 * fl_EyeAngles[0]);
fl_EyeAngles[1] = DegToRad(fl_EyeAngles[1]);
GetEntPropVector(client, Prop_Data, "m_vecVelocity", fl_vel);
wep = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
GetEntityClassname(wep, weaponname, sizeof(weaponname));
if(buttons & IN_ATTACK2 &&
(GetEntPropFloat(wep, Prop_Send, "m_flNextSecondaryAttack") - fl_NextSecondaryAttack[client]) > 0.0)
{
fl_NextSecondaryAttack[client] = GetEntPropFloat(wep, Prop_Send, "m_flNextSecondaryAttack");
fl_vel[0] -= AirblastPower * Cosine(fl_EyeAngles[0]) * Cosine(fl_EyeAngles[1]);
fl_vel[1] -= AirblastPower * Cosine(fl_EyeAngles[0]) * Sine(fl_EyeAngles[1]);
fl_vel[2] -= AirblastPower * Sine(fl_EyeAngles[0]);
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fl_vel);
SetEntProp(client, Prop_Send, "m_bJumping", 1);
}
// // Flamethrower Jetpack
// if(buttons & IN_ATTACK && RadToDeg(-fl_EyeAngles[0]) >= 60.0)
// {
// fl_vel[0] -= GetConVarFloat(mobp_JetpackPower) * Cosine(fl_EyeAngles[0]) * Cosine(fl_EyeAngles[1]);
// fl_vel[1] -= GetConVarFloat(mobp_JetpackPower) * Cosine(fl_EyeAngles[0]) * Sine(fl_EyeAngles[1]);
// fl_vel[2] -= GetConVarFloat(mobp_JetpackPower) * Sine(fl_EyeAngles[0]);
// TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fl_vel);
// }
}
return Plugin_Continue;
}