Hello everybody!
I found this addon on the steam workshop, here is the whole code:
[CODE]-- Freezes all Props!
function FreezeIt( ply )
if ply:IsAdmin() then
print("All Props has been frozen by: " .. ply:Nick())
else
return false
end
local frprops = 0
for k,v in pairs(ents.GetAll()) do
if v:GetClass() == "prop_physics" then
local PhysObj = v:GetPhysicsObject()
PhysObj:EnableMotion(false)
frprops = frprops + 1
end
end
for k,v in pairs(player.GetAll()) do
v:ChatPrint(frprops .. " prop's has been frozen!")
end
end
concommand.Add( "FA", FreezeIt )[/CODE]
And when I type FA its returning an error:
[CODE][ERROR] addons/anti propkill & freeze all props/lua/autorun/antilag.lua:15: Tried to use invalid object (type IPhysicsObject) (Object was NULL or not of the right type)
1. EnableMotion - [C]:-1
2. unknown - addons/anti propkill & freeze all props/lua/autorun/antilag.lua:15
3. unknown - lua/includes/modules/concommand.lua:69
[/CODE]
Could someone please help me with fixing it?
You can just check if the physics object is valid before trying to freeze it.
Although that'd just be covering up the real problem. Maybe try to print out the model name before attempting to freeze it, so you might have a better idea of what you're missing.
Sorry, you need to Log In to post a reply to this thread.