Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.55 KB | None | 0 0
  1.  
  2. local Anim = {
  3.     ["pose_ducking_01"] = {
  4.         name = "Сесть на колено",
  5.         ACT = 2067
  6.     },
  7.     ["pose_ducking_02"] = {
  8.         name = "лотус",
  9.         ACT = 2068,
  10.     },
  11.     ["pose_standing_01"] = {
  12.         name = "Стоит сложа руки",
  13.         ACT = 2063,
  14.     },
  15.     ["pose_standing_02"] = {
  16.         name = "Руки в бока",
  17.         ACT = 2064,
  18.     },
  19.     ["lean_back"] = {
  20.         name = "lean back",
  21.         ACT = 389,
  22.         Out = {
  23.             ACT = 391,
  24.             SEQUENCE = "lean_back_to_idle"
  25.         }
  26.     },
  27.     ["lean_left"] = {
  28.         name = "lean left",
  29.         ACT = 386,
  30.         Out = {
  31.             ACT = 399,
  32.             SEQUENCE = "lean_left_to_idle"
  33.         }
  34.     },
  35.     ["lying_down"] = {
  36.         name = "лежа",
  37.         ACT = 1,
  38.     },
  39.     ["sit_chair"] = {
  40.         name = "сидит",
  41.         ACT = 395,
  42.         Out = {
  43.             ACT = 397,
  44.             SEQUENCE = "sit_chair_to_idle"
  45.         }
  46.     },
  47.     ["sit_ground"] = {
  48.         name = "сидит 2",
  49.         ACT = 392,
  50.         Out = {
  51.             ACT = 394,
  52.             SEQUENCE = "sit_ground_to_idle"
  53.         }
  54.     },
  55.     ["d1_t01_breakroom_sit02_entry"] = {
  56.         name = "садится",
  57.         ACT = 1,
  58.         Out = {
  59.             ACT = 1,
  60.             SEQUENCE = "d1_t01_breakroom_sit02_exit"
  61.         }
  62.     },
  63.     ["plazaidle1"] = {
  64.         name = "облокотился с руками сзади",
  65.         ACT = 1,
  66.         Out = {
  67.             ACT = 1,
  68.             SEQUENCE = "plazastand1"
  69.         }
  70.     },
  71.     ["plazaidle2"] = {
  72.         name = "облокотился на стену",
  73.         ACT = 1,
  74.         Out = {
  75.             ACT = 1,
  76.             SEQUENCE = "plazastand2"
  77.         }
  78.     },
  79.     ["plazaidle3"] = {
  80.         name = "облокотился боком",
  81.         ACT = 1,
  82.         Out = {
  83.             ACT = 1,
  84.             SEQUENCE = "plazastand3"
  85.         }
  86.     },
  87.     ["plazaidle4"] = {
  88.         name = "кортаны",
  89.         ACT = 1,
  90.         Out = {
  91.             ACT = -1,
  92.             SEQUENCE = "plazastand4"
  93.         }
  94.     },
  95.     ["sitcouchtv1"] = {
  96.         name = "сидит с ногой на колене",
  97.         ACT = 1,
  98.     },
  99.     ["sitchair1"] = {
  100.         name = "сидит с грустинкой",
  101.         ACT = 1,
  102.     },
  103.     ["sitcouchknees1"] = {
  104.         name = "сидит с руками под коленями",
  105.         ACT = 1,
  106.     },
  107. }
  108. hook.Add("KeyPress", "ResetAnim", function(ply)
  109.     if CLIENT then return end
  110.     if ply:GetNWBool("Anim") and not ply.SandingUp then
  111.         local data = Anim[ply:GetNWString("DoAnim")]
  112.         local out = data.Out and data.Out.SEQUENCE or nil
  113.         if out then
  114.             print(321)
  115.             ply.SandingUp = true
  116.             ply:SetNWString("DoAnim", out)
  117.             timer.Simple(ply:SequenceDuration(ply:LookupSequence(out)), function()
  118.                 ply:SetNWString("DoAnim", "")
  119.                 ply:SetNWBool("Anim", false)
  120.                 ply.SandingUp = false
  121.             end)
  122.         else
  123.             print(123)
  124.             ply:SetNWString("DoAnim", "")
  125.             ply:SetNWBool("Anim", false)
  126.         end
  127.     end
  128. end)
  129. hook.Add( "StartCommand", "StartCommandExample", function( ply, cmd )
  130.     if ply:GetNWBool("Anim") then
  131.         cmd:ClearMovement()
  132.         --cmd:ClearButtons()
  133.     end
  134. end)
  135. hook.Add("CalcMainActivity", "dasdd", function(ply, vel)
  136.     if not Anim[ply:GetNWString("DoAnim")] then return end
  137.     local data = Anim[ply:GetNWString("DoAnim")]
  138.     if not data then return end
  139.     local out = data.Out and data.Out.SEQUENCE or nil
  140.     if not ply.LastAnim or ply.LastAnim != ply:GetNWString("DoAnim") then
  141.         ply.LastAnim = ply:GetNWString("DoAnim")
  142.         --ply:SetSequence(ply:LookupSequence(ply:GetNWString("DoAnim")))
  143.     end
  144.     ply:FrameAdvance()
  145.     if ply.LastAnim and ply.LastAnim != "" then
  146.         ply:SetNWBool("Anim", true)
  147.         ply:ResetSequence(ply:LookupSequence(ply.LastAnim))
  148.         ply:SetCycle( 0 )
  149.         return -1, ply:LookupSequence(ply.LastAnim)
  150.     end
  151. end)
  152. hook.Add( "UpdateAnimation", "GBAnim", function( ply, _, __ )
  153.     if not ply:Alive() then return end
  154.     if ply:InVehicle() then return end
  155.     if ply:GetNWString("DoAnim") == "" then return end
  156.     ply:SetPlaybackRate( 1 )
  157.     return true
  158. end)
  159.  
  160. if CLIENT then
  161.     local _x, _y = 0, 0
  162.     hook.Add("InputMouseApply", "LookAround", function(c, x, y, a)
  163.         if LocalPlayer():GetNWBool("Anim") then
  164.             c:SetMouseX(0)
  165.             c:SetMouseY(0)
  166.             _x, _y = Lerp(.1, _x, x), Lerp(.1, _y, y)
  167.             return true
  168.         else
  169.             return false
  170.         end
  171.     end)
  172.     hook.Add( "CalcView", "LookAround", function( ply, pos, angles, fov )
  173.         if ply:GetNWBool("Anim") then
  174.             local around = gui.ScreenToVector(ScrW() / 2 + _x, ScrH() / 2 + _y)
  175.  
  176.             local tr = util.TraceLine({
  177.                 start = ply:GetAttachment(ply:LookupAttachment("eyes")).Pos,
  178.                 endpos = pos-(around:Angle():Forward() * 75 - around:Angle():Up() * -15),
  179.                 filter = ply,
  180.             })
  181.             local view = {}
  182.  
  183.             view.origin = tr.HitPos
  184.             view.angles = around:Angle()
  185.             view.fov = fov
  186.             view.drawviewer = true
  187.  
  188.             return view
  189.         end
  190.     end)
  191.     return
  192. end
  193.  
  194. hook.Add("PlayerSay", "Sdpqmdm2", function(ply, txt)
  195.     if ply:InVehicle() then return end
  196.     if ply:GetNWBool("Anim") then return end
  197.     ply:SetNWString("DoAnim", txt)
  198. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement