@@ -214,38 +214,26 @@ local Hitbox = {
214
214
Chest = 7
215
215
}
216
216
217
- local options = {
218
- AutoShoot = true ,
219
- Silent = false ,
220
- AimPos = Hitbox .Pelvis ,
221
- AimFov = 360
222
- }
223
-
224
- local currentTarget = nil
225
-
226
- local function CalculateAngle (fromPos , toPos )
227
- local delta = toPos - fromPos
228
- local angle = math.atan (delta .y , delta .x ) * 180 / math.pi
229
- return angle
230
- end
231
-
232
217
--[[ Code needed to run 66 times a second ]] --
233
218
local function OnCreateMove (pCmd )
234
219
if not Swingpred :GetValue () then goto continue end -- enable or distable script
235
-
220
+ -- [--if we are not existign then stop code--]
236
221
pLocal = entities .GetLocalPlayer () -- Immediately set "pLocal" to the local player (entities.GetLocalPlayer)
237
222
if not pLocal then return end -- Immediately check if the local player exists. If it doesn't, return.
238
223
239
- pLocalClass = pLocal :GetPropInt (" m_iClass" ) -- getlocalclass
224
+ -- [--Check local player class if spy or none then stop code--]
225
+
226
+ pLocalClass = pLocal :GetPropInt (" m_iClass" ) -- getlocalclass
240
227
if pLocalClass == nil then goto continue end -- when local player did not chose class then skip code
241
228
if pLocalClass == 8 then goto continue end -- when local player is spy then skip code
242
- local pWeapon = pLocal :GetPropEntity (" m_hActiveWeapon" )
243
-
244
- local flags = pLocal :GetPropInt ( " m_fFlags" )
245
- local players = entities .FindByClass (" CTFPlayer" ) -- Create a table of all players in the game
246
- local time = mtime :GetValue ()
247
229
230
+ -- [--obtain secondary information after confirming we need it for fps boost whe nnot using script]
231
+ local pWeapon = pLocal :GetPropEntity (" m_hActiveWeapon" )
232
+ local players = entities .FindByClass (" CTFPlayer" ) -- Create a table of all players in the game
233
+ local time = mtime :GetValue ()
234
+ -- [--if we enabled trodlier assist run auto weapon script]
248
235
if mAutoGarden :GetValue () == true then
236
+ local flags = pLocal :GetPropInt ( " m_fFlags" )
249
237
local bhopping = false
250
238
local state = " "
251
239
local downheight = Vector3 (0 , 0 , - 250 )
@@ -268,11 +256,14 @@ local function OnCreateMove(pCmd)
268
256
pCmd :SetButtons (pCmd .buttons & (~IN_DUCK ))
269
257
end
270
258
end
259
+
260
+ -- [-Don`t run script below when not usign melee--]
271
261
272
- -- Initialize closest distance and closest player
273
262
isMelee = pWeapon :IsMeleeWeapon () -- check if using melee weapon
274
263
if not isMelee then goto continue end -- if not melee then skip code
275
- -- try get vierwhegiht without crash
264
+
265
+ -- [-------get vierwhegiht Optymised--------]
266
+
276
267
if pLocalClass ~= pLocalClasslast then
277
268
if pLocal == nil then pLocalOrigin = pLocal :GetAbsOrigin () return pLocalOrigin end
278
269
-- get pLocal eye level and set vector at our eye level to ensure we cehck distance from eyes
@@ -284,8 +275,10 @@ local function OnCreateMove(pCmd)
284
275
pLocalOrigin = (pLocal :GetAbsOrigin () + Vheight )
285
276
end
286
277
278
+ -- [-----Get closestPlayer------------------]
287
279
closestPlayer = GetClosestEnemy (pLocal , pLocalOrigin , players )
288
- -- handle lack of enemies
280
+ -- [-----Refil and skip code when alone-----]
281
+
289
282
if closestPlayer == nil then
290
283
if mAutoRefill :GetValue () and pWeapon :GetCritTokenBucket () <= 27 then
291
284
pCmd :SetButtons (pCmd :GetButtons () | IN_ATTACK )
294
287
295
288
vPlayerOrigin = closestPlayer :GetAbsOrigin ()
296
289
297
- -- [--------------AutoAim-------------------]
290
+ -- [--------------AutoAim-------------------]
298
291
if Maimbot :GetValue () then
299
292
-- get hitbox of ennmy pelwis(jittery but works)
300
293
local hitboxes = closestPlayer :GetHitboxes ()
@@ -308,15 +301,18 @@ end
308
301
--end]]
309
302
end
310
303
311
- -- get current distance between local player and closest player
312
- vdistance = (vPlayerOrigin - pLocalOrigin ):Length ()
313
304
314
- -- predict both players position after swing
305
+ -- [--------------Prediction-------------------] -- predict both players position after swing
306
+
315
307
vPlayerFuture = TargetPositionPrediction (vPlayerOrigin , tickRate , time , closestPlayer )
316
308
pLocalFuture = TargetPositionPrediction (pLocalOrigin , tickRate , time , pLocal )
317
309
310
+ -- [--------------Distance check-------------------]
311
+ -- get current distance between local player and closest player
312
+ vdistance = (vPlayerOrigin - pLocalOrigin ):Length ()
313
+
318
314
-- get distance between local player and closest player after swing
319
- fDistance = (vPlayerFuture - pLocalFuture ):Length ()
315
+ fDistance = (vPlayerFuture - pLocalFuture ):Length ()
320
316
321
317
--[[ -----------------------------Swing Prediction------------------------------------------------------------------------]]
322
318
local can_attack = false
0 commit comments