-3

I am trying to make a specific player render above everything else. I've tried to do multiple things, including using ClientsideModel(), DrawModel() and stuff like that to no avail. If someone could help, that'd be nice! I couldn't find anyone else asking this.

4

1 回答 1

0

最好的方法是使用玩家的HUDPaint而不是模型绘制,因为这被称为最后。所以我们可以从:

hook.Add("HUDPaint", "playerOverride", function()

end)

这是一个 2D 渲染上下文,所以我们需要启动一个 3D 上下文,这很容易cam.start3D()

hook.Add("HUDPaint", "playerOverride", function()
    cam.Start3D()
    cam.End3D()
end)

然后,当然,我们只是绘制目标模型Entity:DrawModel()

hook.Add("HUDPaint", "playerOverride", function()
    cam.Start3D()
        target:DrawModel()
    cam.End3D()
end)

上面的代码假设您已经有了一个目标,您可以设置target或替换它。

如果您希望将此应用于每个人,(我希望您不是在写墙黑客),那么您可以使用player.getAll()

hook.Add("HUDPaint", "playerOverride", function()
    cam.Start3D()
        for k,v in pairs(player.GetAll()) do
            if v ~= LocalPlayer() then -- Make sure we don't redraw ourselves
                v:DrawModel()
            end
        end
    cam.End3D()
end)

(请注意,我目前无法对此进行测试,但我对此相当有信心)

于 2017-09-13T05:22:43.233 回答