Hey guys, i've got a little problem here.
Everybody can physgun the windows.
They are initially set to the owner N/A so nil i guess,
and when they get touched they convert the owner to the one that touched them.
now is there a possibility to stop that? i was thinking about something like
[code]
function PLUGIN.initPostEntity()
for _,v in pairs(ents.FindByClass("func_breakable_surf")) do
v:SetOwner("world")
end
end
[/code]
would that work?
where is PLUGIN. comming from?
ah its just cause its part of an external init lua in a plugin for cleaning a map, its not neccessary but it doesnt break the command either :)
oh yeah edit:
when i start the map the windows are owner World and not physgunnable. after they got destroyed and respawn, they are owner N/A and are phygunnable
Try turning on "Limited Physgun" in the Options menu before starting playing on a map, it worked for me and I couldn't physgun even "prop_dynamic"s
You could try something like this.
[lua]
hook.Add("OnEntityCreated", "window owner world blah", function(entity)
if(entity:GetClass() == "func_breakable_surf") then
entity:SetOwner("world");
end
end);
[/lua]
If your prop protection or cleanup addon uses CPPI, you can use the CPPI callbacks, but if not then you're going to need to work it into what ever code they use.
Well for one SetOwner() does not use a string. So if your going to use
[code]
SetOwner()
[/code]
instead of doing
[code]
SetOwner("world")
[/code]
use
[code]
SetOwner(GetWorldEntity())
[/code]
I just thought that it was a part of the OP's prop protection.
Sorry, you need to Log In to post a reply to this thread.