This repository has been archived by the owner on Aug 6, 2022. It is now read-only.
/
ff2_csgo.sp
105 lines (90 loc) · 2.76 KB
/
ff2_csgo.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
93
94
95
96
97
98
99
100
101
102
103
104
105
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <tf2_stocks>
#include <morecolors>
#include <freak_fortress_2>
#include <freak_fortress_2_subplugin>
public Plugin:myinfo=
{
name="Freak Fortress 2 : CSGO",
author="Nopied",
description="FF2",
version="1.0",
};
bool IsCSGO=false;
bool PlayerRecoiled[MAXPLAYERS+1];
public void OnPluginStart2()
{
HookEvent("arena_round_start", OnRoundStart);
// HookEvent("player_spawn", OnPlayerSpawn);
}
public Action FF2_OnAbility2(int boss, const char[] plugin_name, const char[] ability_name, int status)
{
}
public Action OnRoundStart(Handle event, const char[] name, bool dont)
{
CheckAbility();
}
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(IsCSGO && FF2_GetRoundState() == 1 && IsClientInGame(client) && IsPlayerAlive(client) && !IsWeaponSlotActive(client, TFWeaponSlot_Melee))
{
// int weapon2 = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if(!PlayerRecoiled[client] && GetEntPropFloat(client, Prop_Send, "m_flNextAttack") >= GetGameTime())
{
if(buttons & IN_ATTACK)
{
PlayerRecoiled[client]=true;
float punchAng[3];
GetEntPropVector(client, Prop_Send, "m_vecPunchAngle", punchAng);
punchAng[1]+=GetRandomFloat(-10.0, 10.0);
punchAng[2]+=GetRandomFloat(5.0, 25.0);
SetEntPropVector(client, Prop_Send, "m_vecPunchAngle", punchAng);
}
}
else if(PlayerRecoiled[client] && GetEntPropFloat(client, Prop_Send, "m_flNextAttack") <= GetGameTime())
{
PlayerRecoiled[client]=false;
}
else
PlayerRecoiled[client]=false;
}
}
/*
public void OnWeaponFire(int client, int shots, const char[] weaponname)
{
float punchAng[3];
GetEntPropVector(client, Prop_Send, "m_vecPunchAngle", punchAng);
punchAng[1]+=GetRandomFloat(-3.0, 3.0);
punchAng[2]+=GetRandomFloat(0.1, 5.0);
SetEntPropVector(client, Prop_Send, "m_vecPunchAngle", punchAng);
}
*/
void CheckAbility()
{
IsCSGO=false;
int client, boss;
for(client=1; client<=MaxClients; client++)
{
if((boss = FF2_GetBossIndex(client)) != -1 && FF2_HasAbility(boss, this_plugin_name, "ff2_csgo"))
{
IsCSGO=true;
}
}
/*
for(client=1; client<=MaxClients; client++)
{
if(IsClientInGame(client) && IsPlayerAlive(client))
{
SDKHook(client, SDKHook_FireBulletsPost, OnWeaponFire);
}
}
*/
}
stock bool IsWeaponSlotActive(iClient, iSlot)
{
new hActive = GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon");
new hWeapon = GetPlayerWeaponSlot(iClient, iSlot);
return (hWeapon == hActive);
}