· 6 years ago · Sep 15, 2019, 07:46 PM
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)
87local DefuseESP = gui.Reference("VISUALS", "OTHER", "Options");
88local DefuseCheckbox = gui.Checkbox(DefuseESP, "lua_defuseesp", "Defuse Kit", false);
89
90local shouldGetKits = 1
91local kits = {}
92local curtime = globals.CurTime()
93
94
95local function getKits()
96local lp = entities.GetLocalPlayer()
97 if lp == nil then shouldGetKits = 0 return end
98 if lp:GetTeamNumber() == 3 then
99 if lp:GetPropBool("m_bHasDefuser") == false then
100 if curtime + 1 <= globals.CurTime() then
101 curtime = globals.CurTime()
102 kits = {}
103 for i,v in pairs(entities.FindByClass("CEconEntity")) do
104 if v:GetName() == "EconEntity" then
105 table.insert(kits, v)
106 end
107 end
108 end
109 if shouldGetKits == 1 then
110 kits = {}
111 for i,v in pairs(entities.FindByClass("CEconEntity")) do
112 if v:GetName() == "EconEntity" then
113 table.insert(kits, v)
114 end
115 shouldGetKits = 0
116 end
117 end
118 else
119 shouldGetKits = 0
120 end
121 else
122 shouldGetKits = 0
123 end
124end
125
126callbacks.Register("Draw",getKits)
127
128local function events(event)
129 if event:GetName() == "player_death" then
130 local id = event:GetInt("userid")
131 local ent = entities.GetByUserID(id)
132 if ent ~= nil then
133 if ent:GetTeamNumber() == 3 then
134 shouldGetKits = 1
135 end
136 end
137 end
138 if event:GetName() == "player_disconnect" then
139 shouldGetKits = 1
140 end
141 if event:GetName() == "item_pickup" then
142 if event:GetString("item") == "defuser" then
143 shouldGetKits = 1
144 end
145 end
146 if event:GetName() == "round_officially_ended" then
147 kits = {}
148 end
149end
150
151callbacks.Register("FireGameEvent",events)
152
153local function kitESP()
154if DefuseCheckbox:GetValue() == true then
155local lp = entities.GetLocalPlayer()
156 if lp == nil then return end
157 if lp:GetTeamNumber() == 3 then
158 if lp:GetPropBool("m_bHasDefuser") == false then
159 local lpx, lpy, lpz = lp:GetAbsOrigin()
160 for i,v in pairs(kits) do
161 if v ~= nil then
162 local kitx, kity, kitz = v:GetAbsOrigin()
163 local x, y = client.WorldToScreen( kitx, kity, kitz )
164 if x ~= nil and y ~= nil then
165 local distance = vector.Distance({lpx,lpy,lpz},{kitx,kity,kitz})
166 local resize = 40 / (distance / 1000)
167 if resize > 40 then resize = 40 end
168 if resize < 25 then resize = 25 end
169 draw.Color(255,255,255,255)
170 draw.SetTexture(iconTexture)
171 draw.FilledRect(x - (resize / 2), y - (resize / 2), x + (resize / 2), y + (resize / 2))
172 draw.SetTexture(outlineTexture)
173 draw.FilledRect(x - (resize / 2), y - (resize / 2), x + (resize / 2), y + (resize / 2))
174 end
175 end
176 end
177 end
178 end
179end
180end
181
182callbacks.Register("Draw",kitESP)
183
184client.AllowListener( "item_pickup" )
185client.AllowListener( "player_death" )
186client.AllowListener( "round_officially_ended" )
187client.AllowListener( "player_disconnect" )
188
189
190
191
192
193
194
195
196
197
198
199
200-- Auto defuse
201local DefuseL = gui.Reference("MISC", "AUTOMATION", "Other");
202local DCheckbox = gui.Checkbox(DefuseL, "lua_autodefuse", "Auto Defuse", false);
203
204local function are_all_enemies_dead()
205 for i = globals.MaxClients(), 1, -1 do
206 local forced_index = math.floor(i)
207 local name = client.GetPlayerNameByIndex(forced_index)
208
209 if (name ~= nil and forced_index ~= client.GetLocalPlayerIndex()) then
210 local info = client.GetPlayerInfo(forced_index)
211 if (info["IsGOTV"] == false) then
212 local team = entities.GetPlayerResources():GetPropInt("m_iTeam", forced_index)
213 if (entities.GetLocalPlayer():GetTeamNumber() ~= team) then
214 if (entities.GetPlayerResources():GetPropBool("m_bAlive", forced_index)) then
215 return false
216 end
217 end
218 end
219 end
220 end
221 return true
222end
223
224callbacks.Register("CreateMove", function(cmd)
225if DCheckbox:GetValue() == true then
226 -- define localplayer and bomb entity
227 local local_player = entities.GetLocalPlayer();
228 local bomb = entities.FindByClass("CPlantedC4")[1];
229
230 -- proceed if localplayer exists and bomb is planted
231 if (local_player == nil or bomb == nil) then
232 return
233 end
234
235 -- make sure we're on CT side
236 if (local_player:GetTeamNumber() ~= 3) then
237 return
238 end
239
240 -- if there are any alive enemies left, don't autodefuse
241 if (not are_all_enemies_dead()) then
242 return
243 end
244
245 -- further checks to make sure bomb is still ticking
246 if not (bomb:GetProp("m_bBombTicking") and bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < bomb:GetProp("m_flC4Blow")) then
247 return
248 end
249
250 -- make sure we have enough time to defuse, if not then abort
251 if bomb:GetProp("m_flDefuseCountDown") > bomb:GetProp("m_flC4Blow") then
252 return
253 end
254
255 -- calculate distance from localplayer to the bomb
256 local distance = vector.Distance( {bomb:GetAbsOrigin()}, {local_player:GetAbsOrigin()} )
257
258 -- if we're close enough to the bomb
259 if(distance <= 75) then
260 -- if player isn't trying to move away from the bomb
261 if (not (input.IsButtonDown(65) or input.IsButtonDown(68) or input.IsButtonDown(87) or input.IsButtonDown(83))) then
262 -- defuse
263 cmd:SetButtons(cmd:GetButtons() | (1 << 5))
264 end
265 end
266end
267end)
268
269
270
271
272
273
274
275
276-- Engine Radar by Nyanpasu!
277local ButtonLo = gui.Reference("VISUALS", "MISC", "Assistance");
278local TCheckbox = gui.Checkbox(ButtonLo, "lua_engineradar", "Engine Radar", false);
279
280local function drawing_callback()
281if TCheckbox:GetValue() == true then
282 for index, Player in pairs(entities.FindByClass("CCSPlayer")) do
283 Player:SetProp("m_bSpotted", 1);
284 end
285end
286end
287callbacks.Register("Draw", "engine_radar_draw", drawing_callback);
288
289
290
291
292
293
294
295
296-- Grenade timers by Nyanpasu! (- Luiz)
297
298local updatetick = 0;
299local grenades = {};
300local GrenadeT = gui.Reference("VISUALS", "OTHER", "Options");
301local GCheckbox = gui.Checkbox(GrenadeT, "lua_grenadetimer", "Grenade Timer", false);
302
303
304function EventHook(Event)
305-- Clean table on round start
306if Event:GetName() == "round_start" then
307grenades = {};
308end
309-- Remove expired grenades from Table
310if Event:GetName() == "hegrenade_detonate" or Event:GetName() == "flashbang_detonate"
311or Event:GetName() == "inferno_expire" or Event:GetName() == "inferno_extinguish" then
312updatetick = globals.TickCount();
313for index,value in pairs(grenades) do
314if value[1] == Event:GetInt("entityid") then
315table.remove(grenades, index);
316end
317end
318end
319
320end
321
322function ESPHook(Builder)
323-- Smoke Grenades
324if Builder:GetEntity():GetClass() == "CSmokeGrenadeProjectile"
325and Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin") ~= 0 then
326delta = (globals.TickCount() - Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin")) * globals.TickInterval();
327Builder:AddBarBottom( 1 - (delta/17.5) )
328-- Flash and HE Grenades
329elseif Builder:GetEntity():GetClass() == "CBaseCSGrenadeProjectile" then
330local found = false;
331for index,value in pairs(grenades) do
332if value[1] == Builder:GetEntity():GetIndex() then
333DeltaT = (globals.TickCount() - grenades[index][2]) * globals.TickInterval();
334Builder:AddBarBottom( 1 - (DeltaT/1.65) )
335found = true;
336break;
337end
338end
339if found == false and globals.TickCount() > updatetick then
340local gMatrix = {Builder:GetEntity():GetIndex(), globals.TickCount()};
341table.insert(grenades, gMatrix);
342end
343end
344
345end
346
347function DrawingHook()
348if GCheckbox:GetValue() == true then
349for indexF,valueF in pairs(entities.FindByClass("CInferno")) do
350local found = false;
351for indexT,valueT in pairs(grenades) do
352if valueT[1] == valueF:GetIndex() then
353x, y = client.WorldToScreen( valueF:GetAbsOrigin() )
354local mollysize = 25;
355if x ~= nil and y ~= nil then
356draw.Color(0, 0, 0, 255);
357draw.RoundedRectFill( x - mollysize, y, x + mollysize, y + 4 );
358draw.Color(227, 227, 227, 255);
359local math = (((globals.TickCount() - valueT[2]) * ((-1) - 1))
360/ ( (valueT[2] + 7 / globals.TickInterval()) - valueT[2])) + 1
361draw.RoundedRectFill( x - mollysize, y, x + mollysize * math, y + 4 )
362draw.Color(255, 255, 255, 255);
363draw.RoundedRect( x - mollysize, y, x + mollysize, y + 4)
364local w,h = draw.GetTextSize( "MOLLY" )
365draw.Text(x - w/2, y - h * 1.25 , "MOLLY");
366draw.TextShadow(x - w/2, y - h * 1.25 , "MOLLY");
367end
368found = true;
369break;
370end
371end
372
373if found == false and globals.TickCount() > updatetick then
374local gMatrix = {valueF:GetIndex(), globals.TickCount()};
375table.insert(grenades, gMatrix);
376end
377end
378end
379end
380
381client.AllowListener("round_start");
382client.AllowListener("inferno_expire");
383client.AllowListener("inferno_extinguish");
384client.AllowListener("molotov_detonate");
385client.AllowListener("hegrenade_detonate");
386client.AllowListener("flashbang_detonate");
387
388callbacks.Register("FireGameEvent", "EventHookG", EventHook);
389callbacks.Register( "Draw", "DrawingHookG", DrawingHook );
390callbacks.Register( "DrawESP", "ESPHookG", ESPHook );
391
392
393
394
395
396
397-- Grenade Helper by ShadyRetard
398local THROW_RADIUS = 20;
399local WALK_SPEED = 100;
400local DRAW_MARKER_DISTANCE = 100;
401local GH_ACTION_COOLDOWN = 30;
402local GAME_COMMAND_COOLDOWN = 40;
403local GRENADE_SAVE_FILE_NAME = "grenade_helper_data.dat";
404
405local maps = {}
406
407local GH_WINDOW_ACTIVE = gui.Checkbox(gui.Reference("VISUALS", "MISC", "Assistance"), "GH_WINDOW_ACTIVE", "Grenade Helper", false);
408local GH_WINDOW = gui.Window("GH_WINDOW", "Grenade Helper", 200, 200, 450, 150);
409local GH_NEW_NADE_GB = gui.Groupbox(GH_WINDOW, "Add grenade throw", 15, 15, 200, 100);
410local GH_ENABLE_KEYBINDS = gui.Checkbox(GH_NEW_NADE_GB, "GH_ENABLE_KEYBINDS", "Enable Add Keybinds", false);
411local GH_ADD_KB = gui.Keybox(GH_NEW_NADE_GB, "GH_ADD_KB", "Add key", "");
412local GH_DEL_KB = gui.Keybox(GH_NEW_NADE_GB, "GH_DEL_KB", "Remove key", "");
413
414local GH_SETTINGS_GB = gui.Groupbox(GH_WINDOW, "Settings", 230, 15, 200, 100);
415local GH_HELPER_ENABLED = gui.Checkbox(GH_SETTINGS_GB, "GH_HELPER_ENABLED", "Enable Grenade Helper", false);
416local GH_VISUALS_DISTANCE_SL = gui.Slider(GH_SETTINGS_GB, "GH_VISUALS_DISTANCE_SL", "Display Distance", 800, 1, 9999);
417
418local window_show = false;
419local window_cb_pressed = true;
420local should_load_data = true;
421local last_action = globals.TickCount();
422local throw_to_add;
423local chat_add_step = 1;
424local message_to_say;
425local my_last_message = globals.TickCount();
426local screen_w, screen_h = 0,0;
427local should_load_data = true;
428
429local nade_type_mapping = {
430 "auto",
431 "smokegrenade",
432 "flashbang",
433 "hegrenade",
434 "molotovgrenade";
435 "decoy";
436}
437
438local throw_type_mapping = {
439 "stand",
440 "jump",
441 "run",
442 "crouch",
443 "right";
444}
445
446local chat_add_messages = {
447 "[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):",
448 "[GH] Please enter the throw type (stand / jump / run / crouch / right):"
449}
450
451-- 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
452local my_file = file.Open(GRENADE_SAVE_FILE_NAME, "a");
453my_file:Close();
454
455local current_map_name;
456
457function gameEventHandler(event)
458 if (GH_HELPER_ENABLED:GetValue() == false) then
459 return;
460 end
461
462 local event_name = event:GetName();
463
464 if (event_name == "player_say" and throw_to_add ~= nil) then
465 local self_pid = client.GetLocalPlayerIndex();
466 print(self_pid);
467 local chat_uid = event:GetInt('userid');
468 local chat_pid = client.GetPlayerIndexByUserID(chat_uid);
469 print(chat_pid);
470
471 if (self_pid ~= chat_pid) then
472 return;
473 end
474
475 my_last_message = globals.TickCount();
476
477 local say_text = event:GetString('text');
478
479 if (say_text == "cancel") then
480 message_to_say = "[GH] Throw cancelled";
481 throw_to_add = nil;
482 chat_add_step = 0;
483 return;
484 end
485
486 -- Don't use the bot's messages
487 if (string.sub(say_text, 1, 4) == "[GH]") then
488 return;
489 end
490
491 -- Enter name
492 if (chat_add_step == 1) then
493 throw_to_add.name = say_text;
494 elseif (chat_add_step == 2) then
495 if (hasValue(throw_type_mapping, say_text) == false) then
496 message_to_say = "[GH] The throw type '" .. say_text .. "' is invalid, please enter one of the following values: stand / jump / run / crouch / right";
497 return;
498 end
499
500 throw_to_add.type = say_text;
501 message_to_say = "[GH] Your throw '" .. throw_to_add.name .. "' - " .. throw_to_add.type .. " has been added.";
502 table.insert(maps[current_map_name], throw_to_add);
503 throw_to_add = nil;
504 local value = convertTableToDataString(maps);
505 local data_file = file.Open(GRENADE_SAVE_FILE_NAME, "w");
506 if (data_file ~= nil) then
507 data_file:Write(value);
508 data_file:Close();
509 end
510
511 chat_add_step = 0;
512 return;
513 else
514 chat_add_step = 0;
515 return;
516 end
517
518 chat_add_step = chat_add_step + 1;
519 message_to_say = chat_add_messages[chat_add_step];
520
521 return;
522 end
523end
524
525function drawEventHandler()
526 if (should_load_data) then
527 loadData();
528 should_load_data = false;
529 end
530
531 showWindow();
532
533 if (GH_HELPER_ENABLED:GetValue() == false) then
534 return;
535 end
536
537 screen_w, screen_h = draw.GetScreenSize();
538
539 local active_map_name = engine.GetMapName();
540
541 -- If we don't have an active map, stop
542 if (active_map_name == nil or maps == nil) then
543 return;
544 end
545
546 if (maps[active_map_name] == nil) then
547 maps[active_map_name] = {};
548 end
549
550 if (current_map_name ~= active_map_name) then
551 current_map_name = active_map_name;
552 end
553
554 if (maps[current_map_name] == nil) then
555 return;
556 end
557
558 if (my_last_message ~= nil and my_last_message > globals.TickCount()) then
559 my_last_message = globals.TickCount();
560 end
561
562 if (message_to_say ~= nil and globals.TickCount() - my_last_message > 100) then
563 client.ChatTeamSay(message_to_say);
564 message_to_say = nil;
565 end
566
567 showNadeThrows();
568end
569
570function moveEventHandler(cmd)
571 if (GH_HELPER_ENABLED:GetValue() == false) then
572 return;
573 end
574
575 local me = entities.GetLocalPlayer();
576 if (current_map_name == nil or maps == nil or maps[current_map_name] == nil or me == nil or not me:IsAlive()) then
577 throw_to_add = nil;
578 chat_add_step = 1;
579 message_to_say = nil;
580 return;
581 end
582
583 if (throw_to_add ~= nil) then
584 return;
585 end
586
587
588 local add_keybind = GH_ADD_KB:GetValue();
589 local del_keybind = GH_DEL_KB:GetValue();
590 if (GH_ENABLE_KEYBINDS:GetValue() == false or (add_keybind == 0 and del_keybind == 0)) then
591 return;
592 end
593
594 if (last_action ~= nil and last_action > globals.TickCount()) then
595 last_action = globals.TickCount();
596 end
597
598 if (add_keybind ~= 0 and input.IsButtonDown(add_keybind) and globals.TickCount() - last_action > GH_ACTION_COOLDOWN) then
599 last_action = globals.TickCount();
600 return doAdd(cmd);
601 end
602
603 local closest_throw, distance = getClosestThrow(maps[current_map_name], me, cmd);
604 if (closest_throw == nil or distance > THROW_RADIUS) then
605 return;
606 end
607
608 if (del_keybind ~= 0 and input.IsButtonDown(del_keybind) and globals.TickCount() - last_action > GH_ACTION_COOLDOWN) then
609 last_action = globals.TickCount();
610 return doDel(closest_throw);
611 end
612end
613
614function showWindow()
615 window_show = GH_WINDOW_ACTIVE:GetValue();
616
617 if input.IsButtonPressed(gui.GetValue("msc_menutoggle")) then
618 window_cb_pressed = not window_cb_pressed;
619 end
620
621 if (window_show and window_cb_pressed) then
622 GH_WINDOW:SetActive(1);
623 else
624 GH_WINDOW:SetActive(0);
625 end
626end
627
628function loadData()
629 local data_file = file.Open(GRENADE_SAVE_FILE_NAME, "r");
630 if (data_file == nil) then
631 return;
632 end
633
634 local throw_data = data_file:Read();
635 data_file:Close();
636 if (throw_data ~= nil and throw_data ~= "") then
637 maps = parseStringifiedTable(throw_data);
638 end
639end
640
641function doAdd(cmd)
642 local me = entities.GetLocalPlayer();
643 if (current_map_name == nil or maps[current_map_name] == nil or me == nil or not me:IsAlive()) then
644 return;
645 end
646
647 local my_x, my_y, my_z = me:GetAbsOrigin();
648 local ax, ay, az = cmd:GetViewAngles();
649
650 local nade_type = getWeaponName(me);
651 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
652 return;
653 end
654
655 local new_throw = {
656 name = "",
657 type = "not_set",
658 nade = nade_type,
659 pos = {
660 x = my_x,
661 y = my_y,
662 z = my_z
663 },
664 ax = ax,
665 ay = ay
666 };
667
668 throw_to_add = new_throw;
669 chat_add_step = 1;
670 message_to_say = chat_add_messages[chat_add_step];
671end
672
673function doDel(throw)
674 if (current_map_name == nil or maps[current_map_name] == nil) then
675 return;
676 end
677
678 removeFirstThrow(throw);
679
680 local value = convertTableToDataString(maps);
681 local data_file = file.Open(GRENADE_SAVE_FILE_NAME, "w");
682 if (data_file ~= nil) then
683 data_file:Write(value);
684 data_file:Close();
685 end
686end
687
688function showNadeThrows()
689 local me = entities:GetLocalPlayer();
690
691 if (me == nil) then
692 return;
693 end
694
695 local weapon_name = getWeaponName(me);
696
697 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
698 return;
699 end
700
701 local throws_to_show, within_distance = getActiveThrows(maps[current_map_name], me, weapon_name);
702
703 for i=1, #throws_to_show do
704 local throw = throws_to_show[i];
705 local cx, cy = client.WorldToScreen(throw.pos.x, throw.pos.y, throw.pos.z);
706 local text_color_r, text_color_g, text_color_b, text_color_a = gui.GetValue('clr_grenadetracer_text');
707 local line_color_r, line_color_g, line_color_b, line_color_a = gui.GetValue('clr_grenadetracer_line');
708 local bounce_color_r, bounce_color_g, bounce_color_b, bounce_color_a = gui.GetValue('clr_grenadetracer_bounce');
709 local final_color_r, final_color_g, final_color_b, final_color_a = gui.GetValue('clr_grenadetracer_final');
710
711 if (within_distance) then
712 local z_offset = 64;
713 if (throw.type == "crouch") then
714 z_offset = 46;
715 end
716
717 local t_x, t_y, t_z = getThrowPosition(throw.pos.x, throw.pos.y, throw.pos.z, throw.ax, throw.ay, z_offset);
718 local draw_x, draw_y = client.WorldToScreen(t_x, t_y, t_z);
719 if (draw_x ~= nil and draw_y ~= nil) then
720 draw.Color(final_color_r, final_color_g, final_color_b, final_color_a);
721 draw.RoundedRect(draw_x - 10, draw_y - 10, draw_x + 10, draw_y + 10);
722
723 -- Draw a line from the center of our screen to the throw position
724 draw.Color(line_color_r, line_color_g, line_color_b, line_color_a);
725 draw.Line(draw_x, draw_y, screen_w / 2, screen_h / 2);
726
727 draw.Color(text_color_r, text_color_g, text_color_b, text_color_a);
728 local text_size_w, text_size_h = draw.GetTextSize(throw.name);
729 draw.Text(draw_x - text_size_w / 2, draw_y - 30 - text_size_h / 2, throw.name);
730 text_size_w, text_size_h = draw.GetTextSize(throw.type);
731 draw.Text(draw_x - text_size_w / 2, draw_y - 20 - text_size_h / 2, throw.type);
732 end
733 end
734
735 local ulx, uly = client.WorldToScreen(throw.pos.x - THROW_RADIUS / 2, throw.pos.y - THROW_RADIUS / 2, throw.pos.z);
736 local blx, bly = client.WorldToScreen(throw.pos.x - THROW_RADIUS / 2, throw.pos.y + THROW_RADIUS / 2, throw.pos.z);
737 local urx, ury = client.WorldToScreen(throw.pos.x + THROW_RADIUS / 2, throw.pos.y - THROW_RADIUS / 2, throw.pos.z);
738 local brx, bry = client.WorldToScreen(throw.pos.x + THROW_RADIUS / 2, throw.pos.y + THROW_RADIUS / 2, throw.pos.z);
739
740 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
741 local alpha = 0;
742 if (throw.distance < GH_VISUALS_DISTANCE_SL:GetValue()) then
743 alpha = (1 - throw.distance / GH_VISUALS_DISTANCE_SL:GetValue()) * text_color_a;
744 end
745
746 if (throw.name ~= nil) then
747 local text_size_w, text_size_h = draw.GetTextSize(throw.name);
748 draw.Color(text_color_r, text_color_g, text_color_b, alpha);
749 draw.Text(cx - text_size_w / 2, cy - 20 - text_size_h / 2, throw.name);
750 end
751
752 -- Show radius as green when in distance, blue otherwise
753 if (within_distance) then
754 draw.Color(final_color_r, final_color_g, final_color_b, final_color_a);
755 else
756 draw.Color(bounce_color_r, bounce_color_g, bounce_color_b, alpha);
757 end
758
759 -- Top left to rest
760 draw.Line(ulx, uly, blx, bly);
761 draw.Line(ulx, uly, urx, ury);
762 draw.Line(ulx, uly, brx, bry);
763
764 -- Bottom right to rest
765 draw.Line(brx, bry, blx, bly);
766 draw.Line(brx, bry, urx, ury);
767
768 -- Diagonal
769 draw.Line(blx, bly, urx, ury);
770 end
771 end
772end
773
774function getThrowPosition(pos_x, pos_y, pos_z, ax, ay, z_offset)
775 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;
776end
777
778function getWeaponName(me)
779 local my_weapon = me:GetPropEntity("m_hActiveWeapon");
780 if (my_weapon == nil) then
781 return nil;
782 end
783
784 local weapon_name = my_weapon:GetClass();
785 weapon_name = weapon_name:gsub("CWeapon", "");
786 weapon_name = weapon_name:lower();
787
788 if (weapon_name:sub(1, 1) == "c") then
789 weapon_name = weapon_name:sub(2)
790 end
791
792 if (weapon_name == "incendiarygrenade") then
793 weapon_name = "molotovgrenade";
794 end
795
796 return weapon_name;
797end
798
799function getDistanceToTarget(my_x, my_y, my_z, t_x, t_y, t_z)
800 local dx = my_x - t_x;
801 local dy = my_y - t_y;
802 local dz = my_z - t_z;
803 return math.sqrt(dx^2 + dy^2 + dz^2);
804end
805
806function getActiveThrows(map, me, nade_name)
807 local throws = {};
808 local throws_in_distance = {};
809 -- Determine if any are within range, we should only show those if that's the case
810 for i=1, #map do
811 local throw = map[i];
812 if (throw ~= nil and throw.nade == nade_name) then
813 local my_x, my_y, my_z = me:GetAbsOrigin();
814 local distance = getDistanceToTarget(my_x, my_y, throw.pos.z, throw.pos.x, throw.pos.y, throw.pos.z);
815 throw.distance = distance;
816 if (distance < THROW_RADIUS) then
817 table.insert(throws_in_distance, throw);
818 else
819 table.insert(throws, throw);
820 end
821 end
822 end
823
824 if (#throws_in_distance > 0) then
825 return throws_in_distance, true;
826 end
827
828 return throws, false;
829end
830
831function getClosestThrow(map, me, cmd)
832 local closest_throw;
833 local closest_distance;
834 local closest_distance_from_center;
835 local my_x, my_y, my_z = me:GetAbsOrigin();
836 for i = 1, #map do
837 local throw = map[i];
838 local distance = getDistanceToTarget(my_x, my_y, throw.pos.z, throw.pos.x, throw.pos.y, throw.pos.z);
839 local z_offset = 64;
840 if (throw.type == "crouch") then
841 z_offset = 46;
842 end
843 local pos_x, pos_y, pos_z = getThrowPosition(throw.pos.x, throw.pos.y, throw.pos.z, throw.ax, throw.ay, z_offset);
844 local draw_x, draw_y = client.WorldToScreen(pos_x, pos_y, pos_z);
845 local distance_from_center;
846
847 if (draw_x ~= nil and draw_y ~= nil) then
848 distance_from_center = math.abs(screen_w / 2 - draw_x + screen_h / 2 - draw_y);
849 end
850
851 if (
852 closest_distance == nil
853 or (
854 distance <= THROW_RADIUS
855 and (
856 closest_distance_from_center == nil
857 or (closest_distance_from_center ~= nil and distance_from_center ~= nil and distance_from_center < closest_distance_from_center)
858 )
859 )
860 or (
861 (closest_distance_from_center == nil and distance < closest_distance)
862 )
863 ) then
864 closest_throw = throw;
865 closest_distance = distance;
866 closest_distance_from_center = distance_from_center;
867 end
868 end
869
870 return closest_throw, closest_distance;
871end
872
873function parseStringifiedTable(stringified_table)
874 local new_map = {};
875
876 local strings_to_parse = {};
877 for i in string.gmatch(stringified_table, "([^\n]*)\n") do
878 table.insert(strings_to_parse, i);
879 end
880
881 for i=1, #strings_to_parse do
882 local matches = {};
883
884 for word in string.gmatch(strings_to_parse[i], "([^,]*)") do
885 table.insert(matches, word);
886 end
887
888 local map_name = matches[1];
889 if new_map[map_name] == nil then
890 new_map[map_name] = {};
891 end
892
893 table.insert(new_map[map_name], {
894 name = matches[2],
895 type = matches[3],
896 nade = matches[4],
897 pos = {
898 x = tonumber(matches[5]),
899 y = tonumber(matches[6]),
900 z = tonumber(matches[7])
901 },
902 ax = tonumber(matches[8]),
903 ay = tonumber(matches[9]);
904 });
905 end
906
907 return new_map;
908end
909
910function convertTableToDataString(object)
911 local converted = "";
912 for map_name, map in pairs(object) do
913 for i, throw in ipairs(map) do
914 if (throw ~= nil) then
915 converted = converted..map_name.. ','..throw.name..','..throw.type..','..throw.nade..','..throw.pos.x..','..throw.pos.y..','..throw.pos.z..','..throw.ax..','..throw.ay..'\n';
916 end
917 end
918 end
919
920 return converted;
921end
922
923function hasValue(tab, val)
924 for index, value in ipairs(tab) do
925 if value == val then
926 return true
927 end
928 end
929
930 return false
931end
932
933function removeFirstThrow(throw)
934 for i, v in ipairs(maps[current_map_name]) do
935 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
936 return table.remove(maps[current_map_name], i);
937 end
938 end
939end
940
941client.AllowListener("player_say");
942callbacks.Register("FireGameEvent", "GH_EVENT", gameEventHandler);
943callbacks.Register("CreateMove", "GH_MOVE", moveEventHandler);
944callbacks.Register("Draw", "GH_DRAW", drawEventHandler);
945
946
947
948
949
950
951
952
953-- Recoil Crosshair by Cheeseot
954local ButtonPosition = gui.Reference( "VISUALS", "MISC", "Assistance" );
955local PunchCheckbox = gui.Checkbox( ButtonPosition, "lua_recoilcrosshair", "Recoil Crosshair", 0 );
956local IdleCheckbox = gui.Checkbox( ButtonPosition, "lua_recoilidle", "Hide Recoil Crosshair When Idle", 0 );
957
958function punch()
959
960local rifle = 0;
961local me = entities.GetLocalPlayer();
962if me ~=nil then
963 local scoped = me:GetProp("m_bIsScoped");
964 if scoped == 256 then scoped = 0 end
965 if scoped == 257 then scoped = 1 end
966 local my_weapon = me:GetPropEntity("m_hActiveWeapon");
967 if my_weapon ~=nil then
968 local weapon_name = my_weapon:GetClass();
969 local canDraw = 0;
970 local snipercrosshair = 0;
971 weapon_name = weapon_name:gsub("CWeapon", "");
972 if weapon_name == "Aug" or weapon_name == "SG556" then
973 rifle = 1;
974 else
975 rifle = 0;
976 end
977
978 if scoped == 0 or (scoped == 1 and rifle == 1) then
979 canDraw = 1;
980 else
981 canDraw = 0;
982 end
983
984 if weapon_name == "Taser" or weapon_name == "CKnife" then
985 canDraw = 0;
986 end
987
988 if weapon_name == "AWP" or weapon_name == "SCAR20" or weapon_name == "G3SG1" or weapon_name == "SSG08" then
989 snipercrosshair = 1;
990 end
991
992
993 if me:IsAlive() and PunchCheckbox:GetValue() and canDraw == 1 then
994 local punchAngleX, punchAngleY = me:GetPropVector("localdata", "m_Local", "m_aimPunchAngle");
995 local w, h = draw.GetScreenSize();
996 local x = w / 2;
997 local y = h / 2;
998 local fov = gui.GetValue("vis_view_fov");
999
1000 if fov == 0 then
1001 fov = 90;
1002 end
1003 if scoped == 1 and rifle == 1 then
1004 fov = 45;
1005 end
1006
1007 local dx = w / fov;
1008 local dy = h / fov;
1009
1010 local px = 0
1011 local py = 0
1012
1013 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
1014 px = x;
1015 py = y;
1016 elseif gui.GetValue("vis_norecoil") then
1017 px = x - (dx * punchAngleY)*1.2;
1018 py = y + (dy * punchAngleX)*2;
1019 else
1020 px = x - (dx * punchAngleY)*0.6;
1021 py = y + (dy * punchAngleX);
1022 end
1023
1024 if px > x-0.5 and px < x then px = x end
1025 if px < x+0.5 and px > x then px = x end
1026 if py > y-0.5 and py < y then py = y end
1027 if py < y+0.5 and py > y then py = y end
1028
1029 if IdleCheckbox:GetValue() then
1030 if px == x and py == y and snipercrosshair ~=1 then return; end
1031 end
1032
1033 draw.Color(gui.GetValue("clr_esp_crosshair_recoil"));
1034 draw.FilledRect(px-3, py-1, px+3, py+1);
1035 draw.FilledRect(px-1, py-3, px+1, py+3);
1036 end
1037 end
1038 end
1039end
1040callbacks.Register("Draw", "punch", punch);
1041
1042
1043
1044
1045
1046
1047-- Viewmodel Changer
1048local xO = 0; local yO = 0; local zO = 0; local fO = 0;
1049local 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()
1050local visref = gui.Reference("SETTINGS", "Miscellaneous");
1051local wind = gui.Window("wind", "Viewmodel Extender", 200,200,200,270);
1052local gr = gui.Groupbox(wind, "Viewmodel Stuff", 10,10, 180,218)
1053local c = gui.Checkbox(visref, "c", "Show Viewmodel Extender", false)
1054local xS = gui.Slider(gr, "xS", "X", xO, -20, 20);
1055local yS = gui.Slider(gr, "yS", "Y", yO, -100, 100);
1056local zS = gui.Slider(gr, "zS", "Z", zO, -20, 20);
1057local vfov = gui.Slider(gr, "vfov", "Viewmodel FOV", fO, 0, 120);
1058
1059function doesthing()
1060if c:GetValue() then wind:SetActive(1); else wind:SetActive(0); end
1061client.SetConVar("viewmodel_offset_x", xS:GetValue(), true);
1062client.SetConVar("viewmodel_offset_y", yS:GetValue(), true);
1063client.SetConVar("viewmodel_offset_z", zS:GetValue(), true);
1064client.SetConVar("viewmodel_fov", vfov:GetValue(), true); end
1065callbacks.Register("Draw", "sets", doesthing);