Click + R to unfreeze

I want to take and make it so if you click and press R it unfreezes all ur props but idk how to make it. All i know is

UnfreezeProps()

If you need more info ask me for what variables or w.e

Posting a, So I want ____ but I only have ____ so make me ____ with _____ isn’t going to get you anywhere on this section

Consider giving us more information about what exactly you’re trying to accomplish and we can help you from there :smile:

[editline]09:37PM[/editline]

Or just post in the request section.

My lua is very rusty these days, but use something like “for k, v in pairs.getall( all player props ) do v:Unfreeze() end”

I don’t remember the codes exactly but I’ll get back to you on this. lol

[lua]
for _, Prop in pairs( ents.FindAll() ) do Prop:Unfreez() end
[/lua]

Fixed and [noparse][lua][/lua][/noparse]'d
Im 100% sure that won’t work, as Ent:Unfreez() isn’t a function, but you get the idea

Oh and Overv’s Search is your friend! It lead me to This which pretty much rules out all of what me and PC posted.

Oh and, theres a Newbie Question’s section for a reason… ><

Doesnt Double Click Reload quickly un freeze all your props already? :3:

It’s Prop:GetPhysicsObject():EnableMotion( true ). And, it’s ents.GetAll(), not ents.FindAll().

How would i make this so it only unfreezes your objects, earlier people were saying for k, v, but doesnt that get all players? If you could tell me how to make it for only the player that would help me out for everything im trying to add. I see in some places pl: but idk how to apply iy

this is the code you need:

[lua]
plyprops = {} – create the initial table of player props

function AddPropToTable( ply, model, ent )
if not plyprops.ply:UniqueID() then – if the player spawns a prop for the first time,
plyprops.ply:UniqueID() = {} – create their table!
end
table.insert( plyprops.ply:UniqueID(), ent ) – add the spawned prop to the players table
end
hook.Add( “PlayerSpawnedProp”, “AddPropToTable”, AddPropToTable )

function UnfreezeAllProps ( ply, key )
if key = IN_RELOAD and ply:KeyDown( IN_ATTACK ) then – if the key pressed was RELOAD and mouse1 is held down, continue
if plyprops.ply:UniqueID() then – what if the player never spawned any props and their table doesnt exist?
for k, v in pairs( plyprops.ply:UniqueID() ) do – loop through every prop the player spawned
if v and v:IsValid() then – if prop is valid,
if v:GetPhysicsObject():IsValid() then – if the object is valid,
if not v:GetPhysicsObject():IsMoveable() then – filter out frozen props
v:GetPhysicsObject():EnableMotion( true ) – UNFREEZ!!!
end
end
end
end
end
end
end
hook.Add( “KeyPress”, “UnfreezeAllProps”, UnfreezeAllProps )

function RemovePlayerPropsTable( ply )
if plyprops.ply:UniqueID() then
plyprops.ply:UniqueID() = nil – when the player leaves the server, why keep their table?
end
end
hook.Add( “PlayerDisconnected”, “RemovePlayerPropsTable”, RemovePlayerPropsTable )
[/lua]

I haven’t coded anything in lua for a while so someone please let me know if you see any mistakes. lol

You might want to pay attention to this post rather than spending all this time trying to code it…

Just saying.

All “Your” so thats pretty much SELF

well, ive only been coding in lua for less then a week. Havent looked at it for a couple days now so i cant tell you if i see any mistakes. But thanks i will try this out. Logically it looks correct

[editline]01:54AM[/editline]

ok, i just tried it and it made the orignal mod stop working. Lol. Should i make a new lua script and include it in the other ones? Cause i got an error in the init.lua which is were i put it. Your profile didnt load or anything

In Flood Mod, i think it disables it. Thats why i need to re add it