General > Developers Corner

What would this line do

(1/1)

GeorgeHennen:

--- Code: ---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)
--- End code ---

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.

iViscosity:
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.

Navigation

[0] Message Index

Go to full version