• Help freezing a specific players props
    5 replies, posted
Hi, I've been having issues with my code, it's meant to find all of the entities that are prop_physics, check if they're valid, check if the prop owner is equal to the target player and if that's true, then freeze the prop and repeat. However it fails on the ent:getowner() tag and i'm not sure why, can anyone help me out? thanks. [CODE]function ulx.plyfreezeprops( calling_ply, target_ply ) local Ent = ents.FindByClass("prop_physics") for _,Ent in pairs(Ent) do if Ent:IsValid() then if target_ply == Ent:GetOwner() then local phys = Ent:GetPhysicsObject() phys:EnableMotion(false) end end end ulx.fancyLogAdmin( calling_ply, "#A froze #T's props", target_ply ) end local plyfreezeprops = ulx.command( CATEGORY_NAME, "ulx plyfreezeprops", ulx.plyfreezeprops, "!plyfreezeprops" ) plyfreezeprops:defaultAccess( ULib.ACCESS_ADMIN ) plyfreezeprops:addParam{ type=ULib.cmds.PlayerArg } plyfreezeprops:help( "Freezes <target>'s props on the server." )[/CODE]
local Ent = ents.FindByClass("prop_physics") for _,Ent in pairs(Ent) do to local EntTab = ents.FindByClass("prop_physics") for _,Ent in pairs(EntTab) do
I changed that and now it's outputting #A froze etc but it's not actually freezing any of the players props, is there something wrong with anything else? [CODE] function ulx.plyfreezeprops( calling_ply, target_ply ) local EntTab = ents.FindByClass("prop_physics") for _,Ent in pairs(EntTab) do if Ent:IsValid() then if target_ply == Ent:GetOwner() then local phys = Ent:GetPhysicsObject() phys:EnableMotion(false) end end end ulx.fancyLogAdmin( calling_ply, "#A froze #T's props", target_ply ) end local plyfreezeprops = ulx.command( CATEGORY_NAME, "ulx plyfreezeprops", ulx.plyfreezeprops, "!plyfreezeprops" ) plyfreezeprops:defaultAccess( ULib.ACCESS_ADMIN ) plyfreezeprops:addParam{ type=ULib.cmds.PlayerArg } plyfreezeprops:help( "Freezes <target>'s props on the server." )[/CODE]
Have you tried using [lua]Ent:CPPIGetOwner()[/lua] instead of [lua]Ent:GetOwner()[/lua] to make it compliant with falco's prop protection
I was testing it on a server without FPP, with both CPPIGetOwner() and GetOwner() it isn't freezing the prop so i'd assume it's something to do with my comparison?
[QUOTE=ExcitedPengui;50560191]I was testing it on a server without FPP, with both CPPIGetOwner() and GetOwner() it isn't freezing the prop so i'd assume it's something to do with my comparison?[/QUOTE] If you don't have any prop protection then props aren't owned by players. Get/SetOwner makes the player not collide with the prop, it is used for setting the owner of weapons and other entities, not for prop protection ownership.
Sorry, you need to Log In to post a reply to this thread.