Freeze player in air.

Hello, i tried to freeze a player when i drag he with my physgun in the air and then i right click in the air (like the props) but that he can moove his head.
Someone can help me please ?
Thank’s

Set the player’s ViewAngles to vector_origin in a

GM:CreateMove or

GM:StartCommand hook. Alternatively, you can store the their view angles before freezing to maintain them at their last position, but that would require you to modify the freeze command.

Can be this ? : hook.Add(“OnPhysgunFreeze”, “RightClickFreeze”, function(ent, ply)
local acces, tag = ULib.ucl.query( ply, “ulx physgunplayer” )
ent:SetMoveType( MOVETYPE_NONE )
return true
else
return false
end
end
end
end)

Yeah, if that hook is shared, you can store the ViewAngles to a player variable then set it to the saved value in a shared StartCommand hook. Also, that code seems to have a syntax issue. Try this:


hook.Add("OnPhysgunFreeze", "", function(_, _, ent, ply)
   if (ent:IsPlayer() and ULib.ucl.query(ply, "ulx physgunplayer")) then
      ent:SetMoveType(MOVETYPE_NONE)
      
      return true
   end
end)

As for the view angles, I forgot that OnPhysgunFreeze is serverside only, which means you will have to either network the angle or go back to the previous method of just forcing it to vector_origin.

Thank’s, but must i do it in a file from the server or create a file and put it in the addon folder ?
Thank’s !

You can do it anywhere in the serverside realm for the OnPhysgunFreeze hook, and anywhere shared for the StartCommand hook.