· 6 years ago · Aug 20, 2019, 12:27 AM
1-- Defuse kit ESP
2local iconData = [[<svg width="40" height="40">
3 <title>Layer 1</title>
4 <path fill="#ffffff" id="svg_1" d="m34.904,18.621c-0.307,0.154 -0.652,0.336 -1.016,0.288c-0.521,-0.071 -1.125,-0.601 -1.543,-0.858
5 c-1.645,-1.011 -3.383,-1.828 -5.275,-2.246c-1.084,-0.239 -2.053,-0.188 -3.148,-0.146c-1.41,0.054 -2.785,0.381 -4.193,0.472
6 c-0.803,0.052 -1.406,0.069 -2.143,-0.233c-0.271,-0.111 -0.557,-0.192 -0.834,-0.285c-0.176,-0.059 -0.334,-0.197 -0.438,-0.024
7 c-0.107,0.178 -0.189,0.362 -0.35,0.494c-0.275,0.229 -0.34,0.193 -0.152,0.489c0.143,0.226 0.277,0.458 0.428,0.678
8 c0.197,0.288 0.848,0.861 0.848,1.203c0,0.25 0.939,0.824 1.137,0.988c0.098,0.081 0.295,0.007 0.152,0.221c-0.051,0.077 -0.211,0.295 -0.326,0.238
9 c-0.238,-0.12 -0.443,-0.29 -0.66,-0.448c0.154,0.643 0.371,1.3 0.453,1.956c0.127,0.998 0.213,1.997 0.482,2.969c0.5,1.806 1.383,3.528 2.639,4.925
10 c0.594,0.657 1.262,1.241 1.982,1.756c0.311,0.222 0.99,0.563 1.027,1.006c0.027,0.299 0.053,0.66 -0.078,0.942c-0.066,0.139 -0.24,0.228 -0.283,0.378
11 c-0.074,0.276 -0.045,0.32 -0.316,0.4c-0.174,0.051 -0.377,0.182 -0.543,0.211c-0.313,0.056 -0.619,-0.189 -0.867,-0.337c-0.768,-0.459 -1.496,-0.994 -2.176,-1.573
12 c-2.447,-2.084 -4.336,-5.148 -4.676,-8.382c-0.156,-1.479 -0.352,-2.938 -0.535,-4.411c-0.035,-0.29 -0.281,-0.396 -0.428,-0.636
13 c-0.213,-0.352 -0.406,-0.728 -0.645,-1.063c-0.371,-0.522 -0.881,-1.325 -1.467,-1.567c-0.686,-0.282 -1.357,-0.571 -2.051,-0.83
14 c-0.441,-0.164 -0.797,-0.557 -1.156,-0.851c-1.475,-1.204 -2.945,-2.406 -4.416,-3.608c-0.144,-0.122 -0.226,-0.208 -0.337,-0.363
15 c0.008,0.011 0.133,-0.389 0.182,-0.437c0.102,-0.103 0.262,-0.089 0.385,-0.043c0.732,0.281 1.465,0.562 2.197,0.841c0.959,0.367 1.92,0.735 2.879,1.103
16 c0.688,0.263 0.863,0.254 0.947,1.024c0.045,0.4 0.637,0.374 0.871,0.117c0.041,-0.046 0.098,-0.299 0.166,-0.389c0.156,-0.204 0.311,-0.407 0.465,-0.611
17 c0.266,-0.35 -0.133,-0.499 -0.41,-0.406c-0.27,0.09 -0.486,-0.012 -0.648,-0.225c-1.098,-1.45 -2.193,-2.9 -3.291,-4.35c-0.143,-0.188 -0.286,-0.376 -0.429,-0.564
18 c-0.32,-0.423 0.207,-0.434 0.45,-0.434c0.123,0 0.287,0.174 0.383,0.24c0.353,0.247 0.708,0.495 1.062,0.742c0.871,0.607 1.742,1.216 2.613,1.825
19 c0.281,0.195 0.561,0.39 0.84,0.585c0.09,0.063 0.395,0.135 0.42,0.171c0.459,0.638 0.918,1.276 1.373,1.916c0.199,0.278 0.412,0.517 0.646,0.767
20 c0.164,0.177 0.707,0.226 0.959,0.303c0.717,0.214 1.432,0.421 2.166,0.558c0.705,0.132 1.523,-0.069 2.234,-0.128c1.404,-0.117 2.828,-0.108 4.234,-0.163
21 c1.104,-0.042 2.324,-0.045 3.395,0.236c0.592,0.156 1.238,0.245 1.783,0.537c0.668,0.359 1.34,0.72 2.01,1.08c1.127,0.606 2.168,1.482 3.227,2.206
22 c0.405,0.406 0.401,1.444 -0.205,1.746zm-15.109,-0.391c-0.203,-0.409 -0.369,-0.417 -0.801,-0.586c-0.262,-0.102 -0.668,-0.376 -0.961,-0.261
23 c-0.301,0 -0.104,0.465 0.084,0.512c0.221,0.056 0.441,0.11 0.662,0.166c0.231,0.057 0.795,0.316 1.016,0.169zm-2.184,-0.219
24 c-0.227,-0.076 -0.297,0.201 -0.146,0.352c0.264,0.264 0.799,0.448 1.125,0.638c0.189,0.111 0.709,0.315 0.563,-0.16c-0.361,-0.208 -0.727,-0.409 -1.092,-0.613
25 c-0.151,-0.085 -0.286,-0.163 -0.45,-0.217zm2.659,-1.034c-0.137,-0.104 -0.322,-0.111 -0.488,-0.139c-0.391,-0.067 -0.781,-0.134 -1.172,-0.2
26 c-0.209,0 -0.248,0.542 0,0.542c0.086,0.058 0.34,0.041 0.439,0.054c0.391,0.048 0.783,0.116 1.178,0.116c0.195,0 0.119,-0.285 0.043,-0.373z"/>
27</svg>]]
28
29local outlineData = [[<svg width="40" height="40">
30 <title>Layer 1</title>
31 <path id="svg_1" d="m22.661,34.3c-0.317,0 -0.59,-0.174 -0.81,-0.314l-0.119,-0.074c-0.749,-0.448 -1.495,-0.987 -2.216,-1.603
32 c-2.667,-2.271 -4.454,-5.478 -4.779,-8.579c-0.118,-1.118 -0.259,-2.225 -0.399,-3.335l-0.135,-1.07c-0.009,-0.077 -0.05,-0.125 -0.157,-0.236
33 c-0.074,-0.077 -0.157,-0.163 -0.229,-0.281c-0.072,-0.119 -0.141,-0.24 -0.211,-0.361c-0.134,-0.233 -0.268,-0.468 -0.422,-0.685l-0.127,-0.182
34 c-0.324,-0.464 -0.768,-1.1 -1.209,-1.282l-0.511,-0.212c-0.508,-0.211 -1.013,-0.421 -1.53,-0.614c-0.383,-0.142 -0.7,-0.424 -0.979,-0.673
35 c-0.088,-0.078 -0.175,-0.155 -0.262,-0.227l-4.416,-3.608c-0.167,-0.136 -0.266,-0.241 -0.392,-0.416c-0.066,-0.092 -0.075,-0.214 -0.022,-0.314
36 c0,-0.001 0.001,-0.002 0.001,-0.003l0.032,-0.085c0.091,-0.251 0.132,-0.353 0.204,-0.423c0.163,-0.165 0.435,-0.209 0.701,-0.109l5.25,2.009
37 c0.618,0.229 0.873,0.356 0.966,1.207c0.025,0.059 0.286,0.02 0.351,-0.053c-0.022,0.021 -0.01,-0.012 0.002,-0.05c0.04,-0.113 0.08,-0.23 0.146,-0.318l0.424,-0.558
38 c-0.016,0.001 -0.027,0.004 -0.036,0.007c-0.095,0.032 -0.191,0.048 -0.285,0.048c-0.188,0 -0.46,-0.065 -0.697,-0.376l-3.72,-4.915
39 c-0.207,-0.274 -0.177,-0.48 -0.115,-0.604c0.155,-0.311 0.593,-0.311 0.804,-0.311c0.198,0 0.356,0.131 0.484,0.237c0.025,0.021 0.049,0.041 0.068,0.055l4.519,3.154
40 c0.033,0.018 0.105,0.04 0.169,0.061c0.159,0.053 0.255,0.085 0.324,0.184c0.457,0.636 0.917,1.274 1.372,1.915c0.182,0.255 0.38,0.479 0.621,0.736
41 c0.066,0.058 0.369,0.119 0.514,0.148c0.12,0.024 0.231,0.048 0.314,0.073c0.717,0.214 1.422,0.417 2.133,0.55c0.468,0.088 0.994,0.013 1.507,-0.056
42 c0.222,-0.03 0.439,-0.059 0.648,-0.076c0.942,-0.079 1.902,-0.102 2.832,-0.124c0.473,-0.011 0.945,-0.022 1.416,-0.041c0.319,-0.012 0.647,-0.021 0.979,-0.021
43 c1.016,0 1.812,0.084 2.504,0.267c0.15,0.04 0.304,0.075 0.458,0.11c0.468,0.107 0.951,0.217 1.39,0.453l2.01,1.08c0.771,0.415 1.503,0.953 2.21,1.473
44 c0.348,0.256 0.695,0.511 1.043,0.75c0.334,0.328 0.469,0.836 0.388,1.331c-0.07,0.427 -0.299,0.767 -0.629,0.931c-0.369,0.186 -0.753,0.375 -1.189,0.316
45 c-0.458,-0.062 -0.912,-0.382 -1.313,-0.665c-0.125,-0.088 -0.242,-0.17 -0.347,-0.235c-1.816,-1.117 -3.511,-1.839 -5.183,-2.208
46 c-0.549,-0.121 -1.104,-0.175 -1.8,-0.175c-0.37,0 -0.743,0.015 -1.131,0.03l-0.141,0.005c-0.739,0.028 -1.488,0.136 -2.213,0.24c-0.642,0.093 -1.307,0.188 -1.973,0.231
47 c-0.156,0.01 -0.305,0.019 -0.448,0.024l0.618,0.102c0.16,0.022 0.36,0.051 0.534,0.183c0.151,0.165 0.26,0.449 0.158,0.673c-0.143,0.311 -0.587,0.243 -0.934,0.205
48 c0.141,0.096 0.267,0.235 0.389,0.481c0.067,0.135 0.023,0.299 -0.102,0.383c-0.195,0.13 -0.513,0.101 -0.808,0.016c0.049,0.028 0.099,0.056 0.148,0.085
49 c0.065,0.038 0.114,0.099 0.137,0.171c0.064,0.209 0.049,0.381 -0.047,0.511c-0.049,0.066 -0.163,0.177 -0.38,0.177c-0.114,0 -0.231,-0.031 -0.331,-0.068
50 c0.008,0.014 0.015,0.029 0.022,0.046c0.073,0.185 -0.036,0.347 -0.077,0.408c-0.166,0.252 -0.346,0.381 -0.535,0.381c-0.046,0 -0.132,-0.02 -0.174,-0.041
51 c-0.012,-0.006 -0.023,-0.012 -0.035,-0.018c0.105,0.398 0.207,0.807 0.259,1.219l0.066,0.541c0.099,0.828 0.193,1.61 0.408,2.385c0.509,1.837 1.398,3.498 2.573,4.804
52 c0.56,0.62 1.21,1.196 1.934,1.712c0.055,0.039 0.122,0.082 0.195,0.129c0.386,0.249 0.915,0.589 0.957,1.096c0.034,0.365 0.053,0.753 -0.105,1.093
53 c-0.053,0.111 -0.129,0.188 -0.191,0.251c-0.027,0.028 -0.068,0.07 -0.077,0.087l-0.021,0.086c-0.069,0.281 -0.153,0.414 -0.498,0.515c-0.063,0.019 -0.13,0.051 -0.198,0.082
54 c-0.121,0.056 -0.246,0.113 -0.378,0.136c-0.049,0.012 -0.098,0.016 -0.146,0.016zm-18.32,-23.976c0.053,0.062 0.107,0.112 0.186,0.176l4.417,3.608
55 c0.093,0.077 0.187,0.159 0.281,0.243c0.252,0.224 0.512,0.456 0.79,0.559c0.524,0.196 1.037,0.409 1.551,0.623l0.509,0.211c0.604,0.25 1.085,0.939 1.473,1.494l0.125,0.177
56 c0.165,0.232 0.31,0.483 0.453,0.733c0.067,0.117 0.134,0.234 0.204,0.349c0.037,0.061 0.088,0.114 0.148,0.176c0.127,0.133 0.287,0.298 0.321,0.58l0.135,1.068
57 c0.141,1.114 0.282,2.226 0.401,3.347c0.31,2.952 2.02,6.012 4.572,8.185c0.697,0.594 1.415,1.113 2.135,1.544l0.133,0.083c0.162,0.103 0.345,0.22 0.487,0.22l0.04,-0.003
58 c0.057,-0.01 0.149,-0.052 0.231,-0.09c0.096,-0.044 0.191,-0.087 0.28,-0.113c0.045,-0.014 0.07,-0.022 0.084,-0.028c0,0 0,0 0,0c-0.012,0 -0.007,-0.025 0,-0.055l0.028,-0.108
59 c0.046,-0.161 0.15,-0.267 0.226,-0.344c0.027,-0.027 0.068,-0.069 0.076,-0.086c0.094,-0.202 0.076,-0.499 0.05,-0.785c-0.018,-0.215 -0.435,-0.483 -0.685,-0.644
60 c-0.082,-0.053 -0.157,-0.101 -0.218,-0.145c-0.758,-0.542 -1.441,-1.147 -2.031,-1.799c-1.237,-1.375 -2.172,-3.12 -2.705,-5.046
61 c-0.227,-0.819 -0.328,-1.66 -0.425,-2.473l-0.065,-0.538c-0.055,-0.437 -0.176,-0.889 -0.293,-1.326c-0.054,-0.2 -0.107,-0.4 -0.154,-0.598
62 c-0.03,-0.122 0.021,-0.25 0.125,-0.319c0.031,-0.021 0.065,-0.035 0.101,-0.043c-0.374,-0.29 -0.537,-0.487 -0.537,-0.707c-0.009,-0.131 -0.335,-0.495 -0.492,-0.669
63 c-0.125,-0.14 -0.237,-0.267 -0.304,-0.364c-0.104,-0.151 -0.2,-0.308 -0.296,-0.465l-0.138,-0.222c-0.229,-0.362 -0.204,-0.554 0.104,-0.792l0.11,-0.087
64 c0.084,-0.07 0.145,-0.176 0.215,-0.299l0.07,-0.12c0.155,-0.256 0.49,-0.237 0.697,-0.143c0.03,0.013 0.061,0.028 0.092,0.038l0.243,0.079c0.205,0.065 0.411,0.132 0.61,0.213
65 c0.592,0.243 1.188,0.264 2.01,0.212c0.643,-0.042 1.295,-0.135 1.926,-0.226c0.74,-0.106 1.505,-0.216 2.275,-0.246l0.141,-0.005c0.396,-0.016 0.777,-0.03 1.155,-0.03
66 c0.741,0 1.336,0.058 1.929,0.189c1.738,0.384 3.494,1.13 5.368,2.283c0.114,0.07 0.242,0.16 0.378,0.255c0.328,0.231 0.736,0.518 1.048,0.561
67 c0.256,0.034 0.537,-0.106 0.807,-0.241c0.247,-0.123 0.316,-0.371 0.339,-0.509c0.049,-0.296 -0.026,-0.622 -0.178,-0.774c-0.311,-0.206 -0.663,-0.465 -1.017,-0.725
68 c-0.691,-0.508 -1.405,-1.033 -2.139,-1.428l-2.01,-1.08c-0.368,-0.197 -0.811,-0.298 -1.24,-0.396c-0.161,-0.037 -0.321,-0.074 -0.477,-0.115
69 c-0.642,-0.168 -1.389,-0.247 -2.352,-0.247c-0.324,0 -0.644,0.009 -0.955,0.021c-0.474,0.019 -0.949,0.03 -1.425,0.041c-0.92,0.021 -1.872,0.044 -2.796,0.121
70 c-0.199,0.017 -0.407,0.045 -0.618,0.073c-0.574,0.077 -1.207,0.144 -1.697,0.051c-0.74,-0.138 -1.461,-0.346 -2.197,-0.565c-0.07,-0.021 -0.161,-0.04 -0.259,-0.059
71 c-0.321,-0.065 -0.653,-0.133 -0.834,-0.328c-0.256,-0.273 -0.468,-0.514 -0.67,-0.796c-0.44,-0.62 -0.885,-1.237 -1.329,-1.854c-0.021,-0.007 -0.045,-0.015 -0.07,-0.023
72 c-0.145,-0.049 -0.246,-0.085 -0.323,-0.139l-4.516,-3.155c-0.03,-0.02 -0.068,-0.051 -0.11,-0.086c-0.04,-0.032 -0.113,-0.093 -0.143,-0.105
73 c-0.053,0.002 -0.096,0.005 -0.131,0.008l3.682,4.865c0.105,0.139 0.19,0.139 0.219,0.139c0.029,0 0.061,-0.006 0.095,-0.018c0.327,-0.105 0.716,0.01 0.843,0.267
74 c0.053,0.107 0.111,0.329 -0.099,0.605l-0.466,0.612c-0.01,0.019 -0.04,0.104 -0.056,0.15c-0.038,0.11 -0.065,0.189 -0.124,0.255c-0.164,0.181 -0.429,0.291 -0.692,0.291
75 c-0.381,0 -0.663,-0.23 -0.702,-0.572c-0.056,-0.517 -0.066,-0.521 -0.578,-0.71l-5.255,-2.011c-0.025,-0.01 -0.052,-0.015 -0.072,-0.015
76 c0.011,0.001 -0.017,0.088 -0.045,0.164zm11.714,6.069c0.003,0.005 0.007,0.011 0.011,0.017l0.142,0.229c0.091,0.148 0.182,0.297 0.28,0.44c0.055,0.081 0.151,0.186 0.255,0.302
77 c0.168,0.187 0.314,0.355 0.425,0.513c0.083,-0.123 0.218,-0.196 0.371,-0.196c0.013,0 0.039,0.003 0.067,0.007c-0.024,-0.082 -0.033,-0.164 -0.023,-0.237
78 c0.026,-0.211 0.181,-0.359 0.393,-0.382c0.055,-0.017 0.114,-0.027 0.174,-0.03c-0.008,-0.048 -0.011,-0.093 -0.011,-0.13c0,-0.222 0.089,-0.408 0.227,-0.508
79 c-0.31,-0.043 -0.596,-0.123 -0.892,-0.245c-0.184,-0.075 -0.375,-0.136 -0.565,-0.196l-0.25,-0.081c-0.048,-0.016 -0.096,-0.037 -0.142,-0.058l-0.006,0.011
80 c-0.087,0.152 -0.185,0.324 -0.354,0.463l-0.102,0.081z"/>
81</svg>]]
82
83local iconRGBA, iconW, iconH = common.RasterizeSVG(iconData, 1)
84local outlineRGBA, outlineW, outlineH = common.RasterizeSVG(outlineData, 1)
85local iconTexture = draw.CreateTexture(iconRGBA, iconW, iconH)
86local outlineTexture = draw.CreateTexture(outlineRGBA, outlineW, outlineH)
87
88local shouldGetKits = 1
89local kits = {}
90local curtime = globals.CurTime()
91
92local function getKits()
93local lp = entities.GetLocalPlayer()
94 if lp == nil then shouldGetKits = 0 return end
95 if lp:GetTeamNumber() == 3 then
96 if lp:GetPropBool("m_bHasDefuser") == false then
97 if curtime + 1 <= globals.CurTime() then
98 curtime = globals.CurTime()
99 kits = {}
100 for i,v in pairs(entities.FindByClass("CEconEntity")) do
101 if v:GetName() == "EconEntity" then
102 table.insert(kits, v)
103 end
104 end
105 end
106 if shouldGetKits == 1 then
107 kits = {}
108 for i,v in pairs(entities.FindByClass("CEconEntity")) do
109 if v:GetName() == "EconEntity" then
110 table.insert(kits, v)
111 end
112 shouldGetKits = 0
113 end
114 end
115 else
116 shouldGetKits = 0
117 end
118 else
119 shouldGetKits = 0
120 end
121end
122
123callbacks.Register("Draw",getKits)
124
125local function events(event)
126 if event:GetName() == "player_death" then
127 local id = event:GetInt("userid")
128 local ent = entities.GetByUserID(id)
129 if ent ~= nil then
130 if ent:GetTeamNumber() == 3 then
131 shouldGetKits = 1
132 end
133 end
134 end
135 if event:GetName() == "player_disconnect" then
136 shouldGetKits = 1
137 end
138 if event:GetName() == "item_pickup" then
139 if event:GetString("item") == "defuser" then
140 shouldGetKits = 1
141 end
142 end
143 if event:GetName() == "round_officially_ended" then
144 kits = {}
145 end
146end
147
148callbacks.Register("FireGameEvent",events)
149
150local function kitESP()
151local lp = entities.GetLocalPlayer()
152 if lp == nil then return end
153 if lp:GetTeamNumber() == 3 then
154 if lp:GetPropBool("m_bHasDefuser") == false then
155 local lpx, lpy, lpz = lp:GetAbsOrigin()
156 for i,v in pairs(kits) do
157 if v ~= nil then
158 local kitx, kity, kitz = v:GetAbsOrigin()
159 local x, y = client.WorldToScreen( kitx, kity, kitz )
160 if x ~= nil and y ~= nil then
161 local distance = vector.Distance({lpx,lpy,lpz},{kitx,kity,kitz})
162 local resize = 40 / (distance / 1000)
163 if resize > 40 then resize = 40 end
164 if resize < 25 then resize = 25 end
165 draw.Color(255,255,255,255)
166 draw.SetTexture(iconTexture)
167 draw.FilledRect(x - (resize / 2), y - (resize / 2), x + (resize / 2), y + (resize / 2))
168 draw.SetTexture(outlineTexture)
169 draw.FilledRect(x - (resize / 2), y - (resize / 2), x + (resize / 2), y + (resize / 2))
170 end
171 end
172 end
173 end
174 end
175end
176
177callbacks.Register("Draw",kitESP)
178
179client.AllowListener( "item_pickup" )
180client.AllowListener( "player_death" )
181client.AllowListener( "round_officially_ended" )
182client.AllowListener( "player_disconnect" )
183
184
185
186
187
188
189
190
191-- Auto defuse
192local function are_all_enemies_dead()
193 for i = globals.MaxClients(), 1, -1 do
194 local forced_index = math.floor(i)
195 local name = client.GetPlayerNameByIndex(forced_index)
196
197 if (name ~= nil and forced_index ~= client.GetLocalPlayerIndex()) then
198 local info = client.GetPlayerInfo(forced_index)
199 if (info["IsGOTV"] == false) then
200 local team = entities.GetPlayerResources():GetPropInt("m_iTeam", forced_index)
201 if (entities.GetLocalPlayer():GetTeamNumber() ~= team) then
202 if (entities.GetPlayerResources():GetPropBool("m_bAlive", forced_index)) then
203 return false
204 end
205 end
206 end
207 end
208 end
209 return true
210end
211
212callbacks.Register("CreateMove", function(cmd)
213 -- define localplayer and bomb entity
214 local local_player = entities.GetLocalPlayer();
215 local bomb = entities.FindByClass("CPlantedC4")[1];
216
217 -- proceed if localplayer exists and bomb is planted
218 if (local_player == nil or bomb == nil) then
219 return
220 end
221
222 -- make sure we're on CT side
223 if (local_player:GetTeamNumber() ~= 3) then
224 return
225 end
226
227 -- if there are any alive enemies left, don't autodefuse
228 if (not are_all_enemies_dead()) then
229 return
230 end
231
232 -- further checks to make sure bomb is still ticking
233 if not (bomb:GetProp("m_bBombTicking") and bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < bomb:GetProp("m_flC4Blow")) then
234 return
235 end
236
237 -- make sure we have enough time to defuse, if not then abort
238 if bomb:GetProp("m_flDefuseCountDown") > bomb:GetProp("m_flC4Blow") then
239 return
240 end
241
242 -- calculate distance from localplayer to the bomb
243 local distance = vector.Distance( {bomb:GetAbsOrigin()}, {local_player:GetAbsOrigin()} )
244
245 -- if we're close enough to the bomb
246 if(distance <= 75) then
247 -- if player isn't trying to move away from the bomb
248 if (not (input.IsButtonDown(65) or input.IsButtonDown(68) or input.IsButtonDown(87) or input.IsButtonDown(83))) then
249 -- defuse
250 cmd:SetButtons(cmd:GetButtons() | (1 << 5))
251 end
252 end
253end)
254
255
256
257
258
259
260
261-- Engine Radar by Nyanpasu!
262
263local function drawing_callback()
264 for index, Player in pairs(entities.FindByClass("CCSPlayer")) do
265 Player:SetProp("m_bSpotted", 1);
266 end
267end
268callbacks.Register("Draw", "engine_radar_draw", drawing_callback);
269
270
271
272
273
274
275-- Grenade timers by Nyanpasu! (- Luiz)
276
277local updatetick = 0;
278local grenades = {};
279
280function EventHook(Event)
281-- Clean table on round start
282if Event:GetName() == "round_start" then
283grenades = {};
284end
285-- Remove expired grenades from Table
286if Event:GetName() == "hegrenade_detonate" or Event:GetName() == "flashbang_detonate"
287or Event:GetName() == "inferno_expire" or Event:GetName() == "inferno_extinguish" then
288updatetick = globals.TickCount();
289for index,value in pairs(grenades) do
290if value[1] == Event:GetInt("entityid") then
291table.remove(grenades, index);
292end
293end
294end
295
296end
297
298function ESPHook(Builder)
299-- Smoke Grenades
300if Builder:GetEntity():GetClass() == "CSmokeGrenadeProjectile"
301and Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin") ~= 0 then
302delta = (globals.TickCount() - Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin")) * globals.TickInterval();
303Builder:AddBarBottom( 1 - (delta/17.5) )
304-- Flash and HE Grenades
305elseif Builder:GetEntity():GetClass() == "CBaseCSGrenadeProjectile" then
306local found = false;
307for index,value in pairs(grenades) do
308if value[1] == Builder:GetEntity():GetIndex() then
309DeltaT = (globals.TickCount() - grenades[index][2]) * globals.TickInterval();
310Builder:AddBarBottom( 1 - (DeltaT/1.65) )
311found = true;
312break;
313end
314end
315if found == false and globals.TickCount() > updatetick then
316local gMatrix = {Builder:GetEntity():GetIndex(), globals.TickCount()};
317table.insert(grenades, gMatrix);
318end
319end
320
321end
322
323function DrawingHook()
324for indexF,valueF in pairs(entities.FindByClass("CInferno")) do
325local found = false;
326for indexT,valueT in pairs(grenades) do
327if valueT[1] == valueF:GetIndex() then
328x, y = client.WorldToScreen( valueF:GetAbsOrigin() )
329local mollysize = 25;
330if x ~= nil and y ~= nil then
331draw.Color(0, 0, 0, 255);
332draw.RoundedRectFill( x - mollysize, y, x + mollysize, y + 4 );
333draw.Color(227, 227, 227, 255);
334local math = (((globals.TickCount() - valueT[2]) * ((-1) - 1))
335/ ( (valueT[2] + 7 / globals.TickInterval()) - valueT[2])) + 1
336draw.RoundedRectFill( x - mollysize, y, x + mollysize * math, y + 4 )
337draw.Color(255, 255, 255, 255);
338draw.RoundedRect( x - mollysize, y, x + mollysize, y + 4)
339local w,h = draw.GetTextSize( "MOLLY" )
340draw.Text(x - w/2, y - h * 1.25 , "MOLLY");
341draw.TextShadow(x - w/2, y - h * 1.25 , "MOLLY");
342end
343found = true;
344break;
345end
346end
347
348if found == false and globals.TickCount() > updatetick then
349local gMatrix = {valueF:GetIndex(), globals.TickCount()};
350table.insert(grenades, gMatrix);
351end
352end
353end
354
355client.AllowListener("round_start");
356client.AllowListener("inferno_expire");
357client.AllowListener("inferno_extinguish");
358client.AllowListener("molotov_detonate");
359client.AllowListener("hegrenade_detonate");
360client.AllowListener("flashbang_detonate");
361
362callbacks.Register("FireGameEvent", "EventHookG", EventHook);
363callbacks.Register( "Draw", "DrawingHookG", DrawingHook );
364callbacks.Register( "DrawESP", "ESPHookG", ESPHook );
365
366
367
368
369
370
371-- Grenade Helper by ShadyRetard
372local THROW_RADIUS = 20;
373local WALK_SPEED = 100;
374local DRAW_MARKER_DISTANCE = 100;
375local GH_ACTION_COOLDOWN = 30;
376local GAME_COMMAND_COOLDOWN = 40;
377local GRENADE_SAVE_FILE_NAME = "grenade_helper_data.dat";
378
379local maps = {}
380
381local GH_WINDOW_ACTIVE = gui.Checkbox(gui.Reference("VISUALS", "MISC", "Assistance"), "GH_WINDOW_ACTIVE", "Grenade Helper", false);
382local GH_WINDOW = gui.Window("GH_WINDOW", "Grenade Helper", 200, 200, 450, 150);
383local GH_NEW_NADE_GB = gui.Groupbox(GH_WINDOW, "Add grenade throw", 15, 15, 200, 100);
384local GH_ENABLE_KEYBINDS = gui.Checkbox(GH_NEW_NADE_GB, "GH_ENABLE_KEYBINDS", "Enable Add Keybinds", false);
385local GH_ADD_KB = gui.Keybox(GH_NEW_NADE_GB, "GH_ADD_KB", "Add key", "");
386local GH_DEL_KB = gui.Keybox(GH_NEW_NADE_GB, "GH_DEL_KB", "Remove key", "");
387
388local GH_SETTINGS_GB = gui.Groupbox(GH_WINDOW, "Settings", 230, 15, 200, 100);
389local GH_HELPER_ENABLED = gui.Checkbox(GH_SETTINGS_GB, "GH_HELPER_ENABLED", "Enable Grenade Helper", false);
390local GH_VISUALS_DISTANCE_SL = gui.Slider(GH_SETTINGS_GB, "GH_VISUALS_DISTANCE_SL", "Display Distance", 800, 1, 9999);
391
392local window_show = false;
393local window_cb_pressed = true;
394local should_load_data = true;
395local last_action = globals.TickCount();
396local throw_to_add;
397local chat_add_step = 1;
398local message_to_say;
399local my_last_message = globals.TickCount();
400local screen_w, screen_h = 0,0;
401local should_load_data = true;
402
403local nade_type_mapping = {
404 "auto",
405 "smokegrenade",
406 "flashbang",
407 "hegrenade",
408 "molotovgrenade";
409 "decoy";
410}
411
412local throw_type_mapping = {
413 "stand",
414 "jump",
415 "run",
416 "crouch",
417 "right";
418}
419
420local chat_add_messages = {
421 "[GH] Welcome to GH Setup. Type 'cancel' at any time to cancel. Please enter the name of the throw (e.g. CT to B site):",
422 "[GH] Please enter the throw type (stand / jump / run / crouch / right):"
423}
424
425-- Just open up the file in append mode, should create the file if it doesn't exist and won't override anything if it does
426local my_file = file.Open(GRENADE_SAVE_FILE_NAME, "a");
427my_file:Close();
428
429local current_map_name;
430
431function gameEventHandler(event)
432 if (GH_HELPER_ENABLED:GetValue() == false) then
433 return;
434 end
435
436 local event_name = event:GetName();
437
438 if (event_name == "player_say" and throw_to_add ~= nil) then
439 local self_pid = client.GetLocalPlayerIndex();
440 print(self_pid);
441 local chat_uid = event:GetInt('userid');
442 local chat_pid = client.GetPlayerIndexByUserID(chat_uid);
443 print(chat_pid);
444
445 if (self_pid ~= chat_pid) then
446 return;
447 end
448
449 my_last_message = globals.TickCount();
450
451 local say_text = event:GetString('text');
452
453 if (say_text == "cancel") then
454 message_to_say = "[GH] Throw cancelled";
455 throw_to_add = nil;
456 chat_add_step = 0;
457 return;
458 end
459
460 -- Don't use the bot's messages
461 if (string.sub(say_text, 1, 4) == "[GH]") then
462 return;
463 end
464
465 -- Enter name
466 if (chat_add_step == 1) then
467 throw_to_add.name = say_text;
468 elseif (chat_add_step == 2) then
469 if (hasValue(throw_type_mapping, say_text) == false) then
470 message_to_say = "[GH] The throw type '" .. say_text .. "' is invalid, please enter one of the following values: stand / jump / run / crouch / right";
471 return;
472 end
473
474 throw_to_add.type = say_text;
475 message_to_say = "[GH] Your throw '" .. throw_to_add.name .. "' - " .. throw_to_add.type .. " has been added.";
476 table.insert(maps[current_map_name], throw_to_add);
477 throw_to_add = nil;
478 local value = convertTableToDataString(maps);
479 local data_file = file.Open(GRENADE_SAVE_FILE_NAME, "w");
480 if (data_file ~= nil) then
481 data_file:Write(value);
482 data_file:Close();
483 end
484
485 chat_add_step = 0;
486 return;
487 else
488 chat_add_step = 0;
489 return;
490 end
491
492 chat_add_step = chat_add_step + 1;
493 message_to_say = chat_add_messages[chat_add_step];
494
495 return;
496 end
497end
498
499function drawEventHandler()
500 if (should_load_data) then
501 loadData();
502 should_load_data = false;
503 end
504
505 showWindow();
506
507 if (GH_HELPER_ENABLED:GetValue() == false) then
508 return;
509 end
510
511 screen_w, screen_h = draw.GetScreenSize();
512
513 local active_map_name = engine.GetMapName();
514
515 -- If we don't have an active map, stop
516 if (active_map_name == nil or maps == nil) then
517 return;
518 end
519
520 if (maps[active_map_name] == nil) then
521 maps[active_map_name] = {};
522 end
523
524 if (current_map_name ~= active_map_name) then
525 current_map_name = active_map_name;
526 end
527
528 if (maps[current_map_name] == nil) then
529 return;
530 end
531
532 if (my_last_message ~= nil and my_last_message > globals.TickCount()) then
533 my_last_message = globals.TickCount();
534 end
535
536 if (message_to_say ~= nil and globals.TickCount() - my_last_message > 100) then
537 client.ChatTeamSay(message_to_say);
538 message_to_say = nil;
539 end
540
541 showNadeThrows();
542end
543
544function moveEventHandler(cmd)
545 if (GH_HELPER_ENABLED:GetValue() == false) then
546 return;
547 end
548
549 local me = entities.GetLocalPlayer();
550 if (current_map_name == nil or maps == nil or maps[current_map_name] == nil or me == nil or not me:IsAlive()) then
551 throw_to_add = nil;
552 chat_add_step = 1;
553 message_to_say = nil;
554 return;
555 end
556
557 if (throw_to_add ~= nil) then
558 return;
559 end
560
561
562 local add_keybind = GH_ADD_KB:GetValue();
563 local del_keybind = GH_DEL_KB:GetValue();
564 if (GH_ENABLE_KEYBINDS:GetValue() == false or (add_keybind == 0 and del_keybind == 0)) then
565 return;
566 end
567
568 if (last_action ~= nil and last_action > globals.TickCount()) then
569 last_action = globals.TickCount();
570 end
571
572 if (add_keybind ~= 0 and input.IsButtonDown(add_keybind) and globals.TickCount() - last_action > GH_ACTION_COOLDOWN) then
573 last_action = globals.TickCount();
574 return doAdd(cmd);
575 end
576
577 local closest_throw, distance = getClosestThrow(maps[current_map_name], me, cmd);
578 if (closest_throw == nil or distance > THROW_RADIUS) then
579 return;
580 end
581
582 if (del_keybind ~= 0 and input.IsButtonDown(del_keybind) and globals.TickCount() - last_action > GH_ACTION_COOLDOWN) then
583 last_action = globals.TickCount();
584 return doDel(closest_throw);
585 end
586end
587
588function showWindow()
589 window_show = GH_WINDOW_ACTIVE:GetValue();
590
591 if input.IsButtonPressed(gui.GetValue("msc_menutoggle")) then
592 window_cb_pressed = not window_cb_pressed;
593 end
594
595 if (window_show and window_cb_pressed) then
596 GH_WINDOW:SetActive(1);
597 else
598 GH_WINDOW:SetActive(0);
599 end
600end
601
602function loadData()
603 local data_file = file.Open(GRENADE_SAVE_FILE_NAME, "r");
604 if (data_file == nil) then
605 return;
606 end
607
608 local throw_data = data_file:Read();
609 data_file:Close();
610 if (throw_data ~= nil and throw_data ~= "") then
611 maps = parseStringifiedTable(throw_data);
612 end
613end
614
615function doAdd(cmd)
616 local me = entities.GetLocalPlayer();
617 if (current_map_name == nil or maps[current_map_name] == nil or me == nil or not me:IsAlive()) then
618 return;
619 end
620
621 local my_x, my_y, my_z = me:GetAbsOrigin();
622 local ax, ay, az = cmd:GetViewAngles();
623
624 local nade_type = getWeaponName(me);
625 if (nade_type ~= nil and nade_type ~= "smokegrenade" and nade_type ~= "flashbang" and nade_type ~= "molotovgrenade" and nade_type ~= "hegrenade" and nade_type ~= "decoy") then
626 return;
627 end
628
629 local new_throw = {
630 name = "",
631 type = "not_set",
632 nade = nade_type,
633 pos = {
634 x = my_x,
635 y = my_y,
636 z = my_z
637 },
638 ax = ax,
639 ay = ay
640 };
641
642 throw_to_add = new_throw;
643 chat_add_step = 1;
644 message_to_say = chat_add_messages[chat_add_step];
645end
646
647function doDel(throw)
648 if (current_map_name == nil or maps[current_map_name] == nil) then
649 return;
650 end
651
652 removeFirstThrow(throw);
653
654 local value = convertTableToDataString(maps);
655 local data_file = file.Open(GRENADE_SAVE_FILE_NAME, "w");
656 if (data_file ~= nil) then
657 data_file:Write(value);
658 data_file:Close();
659 end
660end
661
662function showNadeThrows()
663 local me = entities:GetLocalPlayer();
664
665 if (me == nil) then
666 return;
667 end
668
669 local weapon_name = getWeaponName(me);
670
671 if (weapon_name ~= nil and weapon_name ~= "smokegrenade" and weapon_name ~= "flashbang" and weapon_name ~= "molotovgrenade" and weapon_name ~= "hegrenade" and weapon_name ~= "decoy") then
672 return;
673 end
674
675 local throws_to_show, within_distance = getActiveThrows(maps[current_map_name], me, weapon_name);
676
677 for i=1, #throws_to_show do
678 local throw = throws_to_show[i];
679 local cx, cy = client.WorldToScreen(throw.pos.x, throw.pos.y, throw.pos.z);
680 local text_color_r, text_color_g, text_color_b, text_color_a = gui.GetValue('clr_grenadetracer_text');
681 local line_color_r, line_color_g, line_color_b, line_color_a = gui.GetValue('clr_grenadetracer_line');
682 local bounce_color_r, bounce_color_g, bounce_color_b, bounce_color_a = gui.GetValue('clr_grenadetracer_bounce');
683 local final_color_r, final_color_g, final_color_b, final_color_a = gui.GetValue('clr_grenadetracer_final');
684
685 if (within_distance) then
686 local z_offset = 64;
687 if (throw.type == "crouch") then
688 z_offset = 46;
689 end
690
691 local t_x, t_y, t_z = getThrowPosition(throw.pos.x, throw.pos.y, throw.pos.z, throw.ax, throw.ay, z_offset);
692 local draw_x, draw_y = client.WorldToScreen(t_x, t_y, t_z);
693 if (draw_x ~= nil and draw_y ~= nil) then
694 draw.Color(final_color_r, final_color_g, final_color_b, final_color_a);
695 draw.RoundedRect(draw_x - 10, draw_y - 10, draw_x + 10, draw_y + 10);
696
697 -- Draw a line from the center of our screen to the throw position
698 draw.Color(line_color_r, line_color_g, line_color_b, line_color_a);
699 draw.Line(draw_x, draw_y, screen_w / 2, screen_h / 2);
700
701 draw.Color(text_color_r, text_color_g, text_color_b, text_color_a);
702 local text_size_w, text_size_h = draw.GetTextSize(throw.name);
703 draw.Text(draw_x - text_size_w / 2, draw_y - 30 - text_size_h / 2, throw.name);
704 text_size_w, text_size_h = draw.GetTextSize(throw.type);
705 draw.Text(draw_x - text_size_w / 2, draw_y - 20 - text_size_h / 2, throw.type);
706 end
707 end
708
709 local ulx, uly = client.WorldToScreen(throw.pos.x - THROW_RADIUS / 2, throw.pos.y - THROW_RADIUS / 2, throw.pos.z);
710 local blx, bly = client.WorldToScreen(throw.pos.x - THROW_RADIUS / 2, throw.pos.y + THROW_RADIUS / 2, throw.pos.z);
711 local urx, ury = client.WorldToScreen(throw.pos.x + THROW_RADIUS / 2, throw.pos.y - THROW_RADIUS / 2, throw.pos.z);
712 local brx, bry = client.WorldToScreen(throw.pos.x + THROW_RADIUS / 2, throw.pos.y + THROW_RADIUS / 2, throw.pos.z);
713
714 if (cx ~= nil and cy ~= nil and ulx ~= nil and uly ~= nil and blx ~= nil and bly ~= nil and urx ~= nil and ury ~= nil and brx ~= nil and bry ~= nil) then
715 local alpha = 0;
716 if (throw.distance < GH_VISUALS_DISTANCE_SL:GetValue()) then
717 alpha = (1 - throw.distance / GH_VISUALS_DISTANCE_SL:GetValue()) * text_color_a;
718 end
719
720 if (throw.name ~= nil) then
721 local text_size_w, text_size_h = draw.GetTextSize(throw.name);
722 draw.Color(text_color_r, text_color_g, text_color_b, alpha);
723 draw.Text(cx - text_size_w / 2, cy - 20 - text_size_h / 2, throw.name);
724 end
725
726 -- Show radius as green when in distance, blue otherwise
727 if (within_distance) then
728 draw.Color(final_color_r, final_color_g, final_color_b, final_color_a);
729 else
730 draw.Color(bounce_color_r, bounce_color_g, bounce_color_b, alpha);
731 end
732
733 -- Top left to rest
734 draw.Line(ulx, uly, blx, bly);
735 draw.Line(ulx, uly, urx, ury);
736 draw.Line(ulx, uly, brx, bry);
737
738 -- Bottom right to rest
739 draw.Line(brx, bry, blx, bly);
740 draw.Line(brx, bry, urx, ury);
741
742 -- Diagonal
743 draw.Line(blx, bly, urx, ury);
744 end
745 end
746end
747
748function getThrowPosition(pos_x, pos_y, pos_z, ax, ay, z_offset)
749 return pos_x - DRAW_MARKER_DISTANCE * math.cos(math.rad(ay + 180)), pos_y - DRAW_MARKER_DISTANCE * math.sin(math.rad(ay + 180)), pos_z - DRAW_MARKER_DISTANCE * math.tan(math.rad(ax)) + z_offset;
750end
751
752function getWeaponName(me)
753 local my_weapon = me:GetPropEntity("m_hActiveWeapon");
754 if (my_weapon == nil) then
755 return nil;
756 end
757
758 local weapon_name = my_weapon:GetClass();
759 weapon_name = weapon_name:gsub("CWeapon", "");
760 weapon_name = weapon_name:lower();
761
762 if (weapon_name:sub(1, 1) == "c") then
763 weapon_name = weapon_name:sub(2)
764 end
765
766 if (weapon_name == "incendiarygrenade") then
767 weapon_name = "molotovgrenade";
768 end
769
770 return weapon_name;
771end
772
773function getDistanceToTarget(my_x, my_y, my_z, t_x, t_y, t_z)
774 local dx = my_x - t_x;
775 local dy = my_y - t_y;
776 local dz = my_z - t_z;
777 return math.sqrt(dx^2 + dy^2 + dz^2);
778end
779
780function getActiveThrows(map, me, nade_name)
781 local throws = {};
782 local throws_in_distance = {};
783 -- Determine if any are within range, we should only show those if that's the case
784 for i=1, #map do
785 local throw = map[i];
786 if (throw ~= nil and throw.nade == nade_name) then
787 local my_x, my_y, my_z = me:GetAbsOrigin();
788 local distance = getDistanceToTarget(my_x, my_y, throw.pos.z, throw.pos.x, throw.pos.y, throw.pos.z);
789 throw.distance = distance;
790 if (distance < THROW_RADIUS) then
791 table.insert(throws_in_distance, throw);
792 else
793 table.insert(throws, throw);
794 end
795 end
796 end
797
798 if (#throws_in_distance > 0) then
799 return throws_in_distance, true;
800 end
801
802 return throws, false;
803end
804
805function getClosestThrow(map, me, cmd)
806 local closest_throw;
807 local closest_distance;
808 local closest_distance_from_center;
809 local my_x, my_y, my_z = me:GetAbsOrigin();
810 for i = 1, #map do
811 local throw = map[i];
812 local distance = getDistanceToTarget(my_x, my_y, throw.pos.z, throw.pos.x, throw.pos.y, throw.pos.z);
813 local z_offset = 64;
814 if (throw.type == "crouch") then
815 z_offset = 46;
816 end
817 local pos_x, pos_y, pos_z = getThrowPosition(throw.pos.x, throw.pos.y, throw.pos.z, throw.ax, throw.ay, z_offset);
818 local draw_x, draw_y = client.WorldToScreen(pos_x, pos_y, pos_z);
819 local distance_from_center;
820
821 if (draw_x ~= nil and draw_y ~= nil) then
822 distance_from_center = math.abs(screen_w / 2 - draw_x + screen_h / 2 - draw_y);
823 end
824
825 if (
826 closest_distance == nil
827 or (
828 distance <= THROW_RADIUS
829 and (
830 closest_distance_from_center == nil
831 or (closest_distance_from_center ~= nil and distance_from_center ~= nil and distance_from_center < closest_distance_from_center)
832 )
833 )
834 or (
835 (closest_distance_from_center == nil and distance < closest_distance)
836 )
837 ) then
838 closest_throw = throw;
839 closest_distance = distance;
840 closest_distance_from_center = distance_from_center;
841 end
842 end
843
844 return closest_throw, closest_distance;
845end
846
847function parseStringifiedTable(stringified_table)
848 local new_map = {};
849
850 local strings_to_parse = {};
851 for i in string.gmatch(stringified_table, "([^\n]*)\n") do
852 table.insert(strings_to_parse, i);
853 end
854
855 for i=1, #strings_to_parse do
856 local matches = {};
857
858 for word in string.gmatch(strings_to_parse[i], "([^,]*)") do
859 table.insert(matches, word);
860 end
861
862 local map_name = matches[1];
863 if new_map[map_name] == nil then
864 new_map[map_name] = {};
865 end
866
867 table.insert(new_map[map_name], {
868 name = matches[2],
869 type = matches[3],
870 nade = matches[4],
871 pos = {
872 x = tonumber(matches[5]),
873 y = tonumber(matches[6]),
874 z = tonumber(matches[7])
875 },
876 ax = tonumber(matches[8]),
877 ay = tonumber(matches[9]);
878 });
879 end
880
881 return new_map;
882end
883
884function convertTableToDataString(object)
885 local converted = "";
886 for map_name, map in pairs(object) do
887 for i, throw in ipairs(map) do
888 if (throw ~= nil) then
889 converted = converted..map_name.. ','..throw.name..','..throw.type..','..throw.nade..','..throw.pos.x..','..throw.pos.y..','..throw.pos.z..','..throw.ax..','..throw.ay..'\n';
890 end
891 end
892 end
893
894 return converted;
895end
896
897function hasValue(tab, val)
898 for index, value in ipairs(tab) do
899 if value == val then
900 return true
901 end
902 end
903
904 return false
905end
906
907function removeFirstThrow(throw)
908 for i, v in ipairs(maps[current_map_name]) do
909 if (v.name == throw.name and v.pos.x == throw.pos.x and v.pos.y == throw.pos.y and v.pos.z == throw.pos.z) then
910 return table.remove(maps[current_map_name], i);
911 end
912 end
913end
914
915client.AllowListener("player_say");
916callbacks.Register("FireGameEvent", "GH_EVENT", gameEventHandler);
917callbacks.Register("CreateMove", "GH_MOVE", moveEventHandler);
918callbacks.Register("Draw", "GH_DRAW", drawEventHandler);
919
920
921
922
923
924
925
926
927-- Recoil Crosshair by Cheeseot
928local ButtonPosition = gui.Reference( "VISUALS", "MISC", "Assistance" );
929local PunchCheckbox = gui.Checkbox( ButtonPosition, "lua_recoilcrosshair", "Recoil Crosshair", 0 );
930local IdleCheckbox = gui.Checkbox( ButtonPosition, "lua_recoilidle", "Hide Recoil Crosshair When Idle", 0 );
931
932function punch()
933
934local rifle = 0;
935local me = entities.GetLocalPlayer();
936if me ~=nil then
937 local scoped = me:GetProp("m_bIsScoped");
938 if scoped == 256 then scoped = 0 end
939 if scoped == 257 then scoped = 1 end
940 local my_weapon = me:GetPropEntity("m_hActiveWeapon");
941 if my_weapon ~=nil then
942 local weapon_name = my_weapon:GetClass();
943 local canDraw = 0;
944 local snipercrosshair = 0;
945 weapon_name = weapon_name:gsub("CWeapon", "");
946 if weapon_name == "Aug" or weapon_name == "SG556" then
947 rifle = 1;
948 else
949 rifle = 0;
950 end
951
952 if scoped == 0 or (scoped == 1 and rifle == 1) then
953 canDraw = 1;
954 else
955 canDraw = 0;
956 end
957
958 if weapon_name == "Taser" or weapon_name == "CKnife" then
959 canDraw = 0;
960 end
961
962 if weapon_name == "AWP" or weapon_name == "SCAR20" or weapon_name == "G3SG1" or weapon_name == "SSG08" then
963 snipercrosshair = 1;
964 end
965
966
967 if me:IsAlive() and PunchCheckbox:GetValue() and canDraw == 1 then
968 local punchAngleX, punchAngleY = me:GetPropVector("localdata", "m_Local", "m_aimPunchAngle");
969 local w, h = draw.GetScreenSize();
970 local x = w / 2;
971 local y = h / 2;
972 local fov = gui.GetValue("vis_view_fov");
973
974 if fov == 0 then
975 fov = 90;
976 end
977 if scoped == 1 and rifle == 1 then
978 fov = 45;
979 end
980
981 local dx = w / fov;
982 local dy = h / fov;
983
984 local px = 0
985 local py = 0
986
987 if (gui.GetValue("vis_norecoil") and gui.GetValue("rbot_active") and gui.GetValue("rbot_antirecoil")) or (gui.GetValue("rbot_active") and gui.GetValue("rbot_antirecoil")) then
988 px = x;
989 py = y;
990 elseif gui.GetValue("vis_norecoil") then
991 px = x - (dx * punchAngleY)*1.2;
992 py = y + (dy * punchAngleX)*2;
993 else
994 px = x - (dx * punchAngleY)*0.6;
995 py = y + (dy * punchAngleX);
996 end
997
998 if px > x-0.5 and px < x then px = x end
999 if px < x+0.5 and px > x then px = x end
1000 if py > y-0.5 and py < y then py = y end
1001 if py < y+0.5 and py > y then py = y end
1002
1003 if IdleCheckbox:GetValue() then
1004 if px == x and py == y and snipercrosshair ~=1 then return; end
1005 end
1006
1007 draw.Color(gui.GetValue("clr_esp_crosshair_recoil"));
1008 draw.FilledRect(px-3, py-1, px+3, py+1);
1009 draw.FilledRect(px-1, py-3, px+1, py+3);
1010 end
1011 end
1012 end
1013end
1014callbacks.Register("Draw", "punch", punch);
1015
1016
1017
1018
1019
1020
1021-- Viewmodel Changer
1022local xO = 0; local yO = 0; local zO = 0; local fO = 0;
1023local function cache() xO = client.GetConVar("viewmodel_offset_x"); yO = client.GetConVar("viewmodel_offset_y"); zO = client.GetConVar("viewmodel_offset_z"); fO = client.GetConVar("viewmodel_fov"); end cache()
1024local visref = gui.Reference("SETTINGS", "Miscellaneous");
1025local wind = gui.Window("wind", "Viewmodel Extender", 200,200,200,270);
1026local gr = gui.Groupbox(wind, "Viewmodel Stuff", 10,10, 180,218)
1027local c = gui.Checkbox(visref, "c", "Show Viewmodel Extender", false)
1028local xS = gui.Slider(gr, "xS", "X", xO, -20, 20);
1029local yS = gui.Slider(gr, "yS", "Y", yO, -100, 100);
1030local zS = gui.Slider(gr, "zS", "Z", zO, -20, 20);
1031local vfov = gui.Slider(gr, "vfov", "Viewmodel FOV", fO, 0, 120);
1032
1033function doesthing()
1034if c:GetValue() then wind:SetActive(1); else wind:SetActive(0); end
1035client.SetConVar("viewmodel_offset_x", xS:GetValue(), true);
1036client.SetConVar("viewmodel_offset_y", yS:GetValue(), true);
1037client.SetConVar("viewmodel_offset_z", zS:GetValue(), true);
1038client.SetConVar("viewmodel_fov", vfov:GetValue(), true); end
1039callbacks.Register("Draw", "sets", doesthing);