Author Topic: What would this line do  (Read 39 times)

0 Members and 1 Guest are viewing this topic.

Offline GeorgeHennen

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
What would this line do
« on: July 13, 2018, 01:33:57 PM »
Code: [Select]
hook.Add("PlayerSpawn", "_ply_physgungrab", function(ply)
    if ply._ulx_physgun then
        if ply._ulx_physgun.b and ply._ulx_physgun.p then
            timer.Simple(0.001, function()
                ply:SetPos(ply._ulx_physgun.p);
                ply:SetMoveType(MOVETYPE_NONE);
            end);
        end
    end
end)

I've recently downloaded a ULX right click when holding down on a player with a physgun to freeze script and that code seems fishy.

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 759
  • Karma: 48
Re: What would this line do
« Reply #1 on: July 13, 2018, 02:07:07 PM »
I don't know what the _ulx_physgun field on the player is, but if I had to guess, it makes it so when a player spawns if that field is not nil, it sets their location to _ulx_physgun.p and then freezes them (MOVETYPE_NONE means no moving)

So in the context of the add-on, I'd guess that it prevents people from killing themselves to get out of being frozen by resetting their position after spawning.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Discord

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.