I was wondering how I would go about making every object not mave at all and stay in the position they are in. Except when using a physgun on them which would turn and move them about but they would still be "frozen"
How would I go about this?
Without turning every prop into an ent
I am not 100% sure, but I think this would work:
[lua]for _, ent in ipairs(ents.GetAll()) do
if ent:GetClass():find("prop_physics") then
ent:SetMoveType(MOVETYPE_NONE)
end
end[/lua]
And how would i get that running all the time? do i put it in autorun or hook it or something? make every prop frozen always
[editline]07:08PM[/editline]
Would i use a hook and if so, what should need to be called to make it run either all the time or when a prop is spawned? or could i make it run every 10 seconds or so and on prop spawn?
[editline]07:09PM[/editline]
Or how would i make it only run for the prop that has just been spawned
[editline]08:05PM[/editline]
Please can someone help?
NullPoint's code only needs to be run once. What exactly happens is all the props on the map get super-frozen and stay that way until some other code un-super-freezes it again. But, of course, it doesn't automatically freeze props you spawn. What you'd want to do there is add a hook that freezes any prop you spawn. For this the PlayerSpawnedProp hook is used:
[lua]
local function FreezeMyProps(ply, model, prop)
prop:SetMoveType(MOVETYPE_NONE)
end
hook.Add("PlayerSpawnedProp", "AutoPropSuperFreeze", FreezeMyProps)
[/lua]
Oh, thank you!
Sorry, you need to Log In to post a reply to this thread.