Advertisement
Mister_Stefan

LW4 Static Legs in air

Jun 6th, 2021
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.40 KB | None | 0 0
  1. local ffi = require  ("ffi")
  2.  
  3. ffi.cdef[[
  4.     typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);
  5.  
  6.     typedef struct
  7.     {
  8.         float x;
  9.         float y;
  10.         float z;
  11.     } Vector_t;
  12.  
  13.     typedef struct
  14.     {
  15.         char        pad0[0x60]; // 0x00
  16.         void*       pEntity; // 0x60
  17.         void*       pActiveWeapon; // 0x64
  18.         void*       pLastActiveWeapon; // 0x68
  19.         float        flLastUpdateTime; // 0x6C
  20.         int            iLastUpdateFrame; // 0x70
  21.         float        flLastUpdateIncrement; // 0x74
  22.         float        flEyeYaw; // 0x78
  23.         float        flEyePitch; // 0x7C
  24.         float        flGoalFeetYaw; // 0x80
  25.         float        flLastFeetYaw; // 0x84
  26.         float        flMoveYaw; // 0x88
  27.         float        flLastMoveYaw; // 0x8C // changes when moving/jumping/hitting ground
  28.         float        flLeanAmount; // 0x90
  29.         char        pad1[0x4]; // 0x94
  30.         float        flFeetCycle; // 0x98 0 to 1
  31.         float        flMoveWeight; // 0x9C 0 to 1
  32.         float        flMoveWeightSmoothed; // 0xA0
  33.         float        flDuckAmount; // 0xA4
  34.         float        flHitGroundCycle; // 0xA8
  35.         float        flRecrouchWeight; // 0xAC
  36.         Vector_t    vecOrigin; // 0xB0
  37.         Vector_t    vecLastOrigin;// 0xBC
  38.         Vector_t    vecVelocity; // 0xC8
  39.         Vector_t    vecVelocityNormalized; // 0xD4
  40.         Vector_t    vecVelocityNormalizedNonZero; // 0xE0
  41.         float        flVelocityLenght2D; // 0xEC
  42.         float        flJumpFallVelocity; // 0xF0
  43.         float        flSpeedNormalized; // 0xF4 // clamped velocity from 0 to 1
  44.         float        flRunningSpeed; // 0xF8
  45.         float        flDuckingSpeed; // 0xFC
  46.         float        flDurationMoving; // 0x100
  47.         float        flDurationStill; // 0x104
  48.         bool        bOnGround; // 0x108
  49.         bool        bHitGroundAnimation; // 0x109
  50.         char        pad2[0x2]; // 0x10A
  51.         float        flNextLowerBodyYawUpdateTime; // 0x10C
  52.         float        flDurationInAir; // 0x110
  53.         float        flLeftGroundHeight; // 0x114
  54.         float        flHitGroundWeight; // 0x118 // from 0 to 1, is 1 when standing
  55.         float        flWalkToRunTransition; // 0x11C // from 0 to 1, doesnt change when walking or crouching, only running
  56.         char        pad3[0x4]; // 0x120
  57.         float        flAffectedFraction; // 0x124 // affected while jumping and running, or when just jumping, 0 to 1
  58.         char        pad4[0x208]; // 0x128
  59.         float        flMinBodyYaw; // 0x330
  60.         float        flMaxBodyYaw; // 0x334
  61.         float        flMinPitch; //0x338
  62.         float        flMaxPitch; // 0x33C
  63.         int            iAnimsetVersion; // 0x340
  64.     } CCSGOPlayerAnimationState_534535_t;
  65. ]]
  66.  
  67. local entity_list_ptr = ffi.cast("void***", utils.create_interface("client.dll", "VClientEntityList003"))
  68. local get_client_entity_fn = ffi.cast("GetClientEntity_4242425_t", entity_list_ptr[0][3])
  69.  
  70. local ffi_helpers = {
  71.     get_entity_address = function(ent_index)
  72.         local addr = get_client_entity_fn(entity_list_ptr, ent_index)
  73.         return addr
  74.     end
  75. }
  76.  
  77. local shared_onground
  78.  
  79. client.add_callback("on_paint", function()
  80.     local localplayer = entitylist.get_local_player()
  81.     if not localplayer then return end
  82.     local bOnGround = bit.band(math.floor(localplayer:get_prop_float("CBasePlayer", "m_fFlags")), bit.lshift(1,0)) ~= 0
  83.     if not bOnGround then
  84.         ffi.cast("CCSGOPlayerAnimationState_534535_t**", ffi_helpers.get_entity_address(localplayer:get_index()) + 14612)[0].flDurationInAir = 99
  85.         ffi.cast("CCSGOPlayerAnimationState_534535_t**", ffi_helpers.get_entity_address(localplayer:get_index()) + 14612)[0].flHitGroundCycle = 0
  86.         ffi.cast("CCSGOPlayerAnimationState_534535_t**", ffi_helpers.get_entity_address(localplayer:get_index()) + 14612)[0].bHitGroundAnimation = false
  87.     end
  88.  
  89.     shared_onground = bOnGround
  90. end)
  91.  
  92. client.add_callback("on_paint", function()
  93.     local localplayer = entitylist.get_local_player()
  94.     if not localplayer then return end
  95.     local bOnGround = bit.band(math.floor(localplayer:get_prop_float("CBasePlayer", "m_fFlags")), bit.lshift(1,0)) ~= 0
  96.     if bOnGround and not shared_onground then ffi.cast("CCSGOPlayerAnimationState_534535_t**", ffi_helpers.get_entity_address(localplayer:get_index()) + 14612)[0].flDurationInAir = 0.5 end -- ACT_CSGO_LAND_LIGHT
  97. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement