yes lol NO idea why it does that!!!
and no, it's when someone tries to build next to someone else.
the one building needs to build somewhere his friends aren't or it will kick his friends XD[DOUBLEPOST=1414549085][/DOUBLEPOST]i've looked in the code i have no idea where this comes from --'
any way i guess i'll have to debug it tomorrow.
Building Owners
Sets owners of houses when someone builds a house part
Total Downloads: 12,016 - First Release: Apr 3, 2015 - Last Update: Jul 30, 2016
- 5/5, 23 likes
-
Hey Boomshay,
I had the same issue, most of the time it works but the odd placement doesn't work and from then on seems to not work for that player. Not sure if its the correct solution but its the only thing I changed to stop DCs on my end.
Try this:
Code:function FindPlayer(entity) if(entity == nil) then -- this check stopped the DC on placement for me return false end local arr = util.TableToArray( { entity.transform.position , playerradius } ) util.ConvertAndSetOnArray(arr, 1, playerradius, System.Single._type) local hits = UnityEngine.Physics.OverlapSphere["methodarray"][1]:Invoke(nil,arr) local it = hits:GetEnumerator() local baseplayer = false while (it:MoveNext()) do if(it.Current:GetComponent("BasePlayer")) then if(baseplayer) then return false, baseplayer, it.Current:GetComponent("BasePlayer"), "If you are not building, please move away, your friend can't build while you are here" end if(it.Current:GetComponent("BasePlayer").userID and it.Current:GetComponent("BasePlayer").userID ~= "userID") then baseplayer = it.Current:GetComponent("BasePlayer") end end end return baseplayer end
-
Hmmm no that won't change anything
As i said players get kicked when the builder builds the First foundation next to another player (after placing the first foundation it doesnt kick) -
Code:function PLUGIN:OnEntitySpawn(entity) if(self.ServerInitialized) then if(entity:GetComponent("BuildingBlock")) then if(self.Config.useByType == 1) then local buildingowner, buildingownername = FindBuildingOwner(entity) if(buildingowner and tostring(buildingowner) ~= "0") then entity:GetComponent("BuildingBlock").deployerUserID = buildingowner entity:GetComponent("BuildingBlock").deployerUserName = buildingownername else local baseplayer, err1, err2, err3 = FindPlayer(entity) if(not baseplayer and err1) then err1:ChatMessage(err3) err2:ChatMessage(err3) end if(not baseplayer) then self:DestroyNewEntity(entity) return end entity:GetComponent("BuildingBlock").deployerUserID = baseplayer.userID entity:GetComponent("BuildingBlock").deployerUserName = baseplayer.displayName end elseif(self.Config.useByType == 2) then local baseplayer, err1, err2, err3 = FindPlayer(entity) if(not baseplayer and err1) then err1:ChatMessage(err3) err2:ChatMessage(err3) end -- if(not baseplayer) then self:DestroyNewEntity(entity) return end --Found this commented too entity:GetComponent("BuildingBlock").deployerUserID = baseplayer.userID entity:GetComponent("BuildingBlock").deployerUserName = baseplayer.displayName end end end end
I have changed this a lot on my own server now but using your original script that worked and still does for me if I test it
Like I said it isn't the best solution but id rather it either return or not remove something someone has placed than DC them out right. Maybe I am missing something but it definitely works for me (I use it for remove and door sharing). -
Well î guess i know what makes the DC !
Only problem is that now when 2 players build next to each other the building owner Will not be set.
As you commented the building destruction. -
Not sure how to get rid of that and there are some more weird issues, like having another players tool or weapon in your inventory can make it place for the other user and not your self.
I've come up with this so far:
Code:function FindPlayer(entity) if(entity == nil)then return false end local arr = util.TableToArray( { entity.transform.position , playerradius } ) util.ConvertAndSetOnArray(arr, 1, playerradius, System.Single._type) local hits = UnityEngine.Physics.OverlapSphere["methodarray"][1]:Invoke(nil,arr) local it = hits:GetEnumerator() local baseplayer = false if(it ~= nil ) then while (it:MoveNext()) do if(it.Current:GetComponent("BasePlayer")) then if(baseplayer) then global.ConsoleSystem.Broadcast("chat.add \"Server\" \"Ownership failed! User is too far from the placed object or too many surrounding users!\"") --Broadcast to server there was an issue, all knowing players can move accordingly return false, baseplayer, it.Current:GetComponent("BasePlayer"), "If you are not building, please move away, your friend can't build while you are here" end if(it.Current:GetComponent("BasePlayer").userID and it.Current:GetComponent("BasePlayer").userID ~= "userID") then baseplayer = it.Current:GetComponent("BasePlayer") if(baseplayer ~= nil) then if(baseplayer.displayName ~= nil) then deployer = global.BasePlayer.Find(baseplayer.displayName) if(deployer == nil) then global.ConsoleSystem.Broadcast("chat.add \"Server\" \"Ownership failed! User was not found!\"") -- Just in case you never know return false end deployer:ChatMessage("Owner: " .. baseplayer.displayName) -- Tell the user that it deployed and who it belongs to deployer:ChatMessage("If the owner name is not yours then you have someone elses equipment!") --Inform them if wrong owner how to fix, this part is optional i guess as they will see the incorrect user end end end end end else global.ConsoleSystem.Broadcast("chat.add \"Server\" \"Ownership failed! User is too far from the placed object or too many surrounding users!\"") return false, baseplayer, it.Current:GetComponent("BasePlayer"), "If you are not building, please move away, your friend can't build while you are here" end return baseplayer end
Edit: Yeah Reneb you are correct I am using Type 2.
Will give type 1 a shot, but people like having the ability to build together while being able to remove each others stuff (if friends) and use each others doors (again if friends)Last edited by a moderator: Oct 29, 2014 -
Lol then it's because you use the type:2.
This can't be an issue on type 1, as when the First foundation is set, all the building parts Will be hooked to the owner of that foundation.
It Will not longer test for other players.
If the First foundation has no owner then the rest of the building Will also have no owner (must use /changeowner to set the owner) -
Would be good to see this expand to allow owner be set to a group (if/when a group plugin appears), combination of this, group and remove would be helpful... or even just add individual friends as joint owners? either way.. seed planted! my work is done
-
Reneb updated Building Owners with a new update entry:
fixed the kick
-
Code:
[Oxide] 9:08 PM [Error] buildingowners: field or property 'deployerUserID' does not exist at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 bioptimale joined
-
I know doesnt work with update. Can look into Any of my plugins until tomorrrow
-
Your the fucking best.
-
Either they just changed the name, or just deleted it. So if they just changed it it Will be easy to fix, if they deleted it it'll take à little more time !
-
Yeah sethome is broken for now
-
- hey Mughisi...you see this?
-
-
getting spammed with this error after server update, plugin update, completely fresh setup of everything:
Code:[Oxide] 5:54 PM [Error] buildingowners: field or property 'deployerUserID' does not exist at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
-
Yeah looks like in the reflected updated code they no longer have deployerUserID on the building block item, only on deployed items. I am sure Reneb will figure it out! He is the master of all things objects in the rust world!
-
-