-
Notifications
You must be signed in to change notification settings - Fork 7
/
mm_attribute_resize_projectile.sp
91 lines (71 loc) · 2.41 KB
/
mm_attribute_resize_projectile.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
#include <sourcemod>
#include <sdkhooks>
#include <tf2>
#include <tf2_stocks>
#include <sdktools_stringtables>
#include <sdktools_tempents>
#include <sdktools>
#include <tf2attributes>
#include <tf_custom_attributes>
#include <stocksoup/var_strings>
#if defined __stocksoup_tf_tempents_stocks_included
#endinput
#endif
#define __stocksoup_tf_tempents_stocks_included
float g_Size = 0.0;
int g_UpdateHitBox = 0;
bool ActiveHasStatClient(int client)
{
char stat_buffer[256];
if (!TF2CustAttr_GetString(client, "projectile-size", stat_buffer, sizeof(stat_buffer))) {
return false;
}
g_Size = ReadFloatVar(stat_buffer, "size", 1.0);
g_UpdateHitBox = ReadIntVar(stat_buffer, "update-hitbox", 1);
// g_UpdateHitBox = ReadIntVar(stat_buffer, "update-hitbox", 1);
// g_bmod_disciplinary = ReadIntVar(stat_buffer, "bmod-disciplinary", 0);
return true;
}
stock bool IsValidClient(iClient)
{
return (0 < iClient && iClient <= MaxClients && IsClientInGame(iClient));
}
public void OnEntityCreated(int iEntity, const char[] sClassName)
{
if (StrContains(sClassName, "tf_projectile") == 0)
{
SDKHook(iEntity, SDKHook_Spawn, Hook_OnProjectileSpawn);
}
}
public void Hook_OnProjectileSpawn(iEntity) {
int iClient = GetEntPropEnt(iEntity, Prop_Data, "m_hOwnerEntity");
if (0 < iClient && iClient <= MaxClients && ActiveHasStatClient(iClient)) {
// PrintToChatAll("SETTING SCALE")
SetEntPropFloat(iEntity, Prop_Send, "m_flModelScale", g_Size);
if (g_UpdateHitBox)RequestFrame(SetProjectileSize, iEntity);
}
}
void SetProjectileSize (int iEntity)
{
// PrintToChatAll("SETTING HITBOX SIZE")
// g_fStockvecMin[0] = -g_Size + -g_Size;
// g_fStockvecMin[1] = -g_Size + -g_Size;
// g_fStockvecMin[2] = -g_Size + -g_Size;
// ScaleVector(g_fStockvecMin, -g_Size;)
// ScaleVector(g_fStockvecMax, g_Size;)
// g_fStockvecMax[0] = g_Size + g_Size;
// g_fStockvecMax[1] = g_Size + g_Size;
// g_fStockvecMax[2] = g_Size + g_Size;
// g_fStockvecMin[0] = -500.0;
// g_fStockvecMin[1] = -500.0;
// g_fStockvecMin[2] = -500.0;
// g_fStockvecMax[0] = 500.0;
// g_fStockvecMax[1] = 500.0;
// g_fStockvecMax[2] = 500.0;
float g_fStockvecMin[3] = {-1.0, -1.0, -1.0};
float g_fStockvecMax[3] = {1.0, 1.0, 1.0};
ScaleVector(g_fStockvecMin, g_Size);
ScaleVector(g_fStockvecMax, g_Size);
SetEntPropVector(iEntity, Prop_Send, "m_vecMins", g_fStockvecMin);
SetEntPropVector(iEntity, Prop_Send, "m_vecMaxs", g_fStockvecMax);
}