Over the past 2 days I have been trying to integrate FPP into an outdated gamemode plus fix some bugs etc. I am having some issues with this tho hence why I am here.
When a player disconnects from the server their previously owned props are now owned by "Player [NULL]" is there a way for the player that disconnected to retain ownership and have the prop still display there name when someone hovers over the prop even when they are not connected to the server?
From my understanding of FPP a player should regain ownership of his/her prop when they reconnect to the server but the props they once owned dont default back to them. They still show as "Player [NULL]" when hovered over and he/she is unable to interact with them. Is there some code I need to implement in order for this to happen? If there isn't then what could cause FPP to not reassign players there props?
The way I am setting prop ownership when the prop is spawned is like:
[code]
ent:CPPISetOwner(ply)
ent:CPPISetOwnerUID(ply:UniqueID())
[/code]
You're on the right track by making special Set/GetOwner methods. Are you still using ent:GetOwner() or did you make an ent:CPPIGetOwner() method?
Also, I've never looked at FPP's code before but maybe it has a PlayerDisconnected hook somewhere that's resetting it.
I have been using ent:CPPIGetOwner() to get the props owner.
FPP has a method which should be reassigning a player props when he/she reconnects to a server after disconnecting but it isn't so I was wondering if I was doing something wrong when setting a props owner or if there is something I need to do when they reconnect?
[QUOTE=Rambomst;29497867]I have been using ent:CPPIGetOwner() to get the props owner.
FPP has a method which should be reassigning a player props when he/she reconnects to a server after disconnecting but it isn't so I was wondering if I was doing something wrong when setting a props owner or if there is something I need to do when they reconnect?[/QUOTE]
Where are you setting it?
Where am I setting what exactly?
[QUOTE=Rambomst;29520177]Where am I setting what exactly?[/QUOTE]
Where are you calling CPPISetOwner?
In several different places. I am using it whenever I need to set the owner of a prop/ent.
A few examples of how I am using it.
[code]
function PlayerMeta:CreateSite(pos,angle,model,class,cost)
local rep = ents.Create("site")
local tbl = rep:GetTable()
rep:SetAngles(angle)
rep.Costs = cost
tbl:Setup(model,class)
rep:SetPos(pos)
rep:Spawn()
rep.Player = self
self:SetNetworkedEntity('Hassite', rep)
rep:CPPISetOwner(self)
rep:CPPISetOwnerUID(self:UniqueID())
return rep
end
function ENT:WithdrawItem( class )
for k, v in pairs( self.Contents ) do
if ""..v.class.."" == ""..class.."" then
local item = ents.Create( "gms_resourcedrop" )
item:SetPos( self:GetPos() + self:GetForward() * 10 + self:GetUp() * 40 )
item:Spawn()
item:Activate()
if v.rot then
item.rotten = true
end
item.Type = v.entType
item.Amount = v.entAmount
item:SetResourceDropInfo(item.Type,item.Amount)
item:CPPISetOwner(v.owner)
item:CPPISetOwnerUID(v.owner:UniqueID())
umsg.Start( "removeItem" )
umsg.Short( self:EntIndex() )
umsg.String( class )
umsg.End()
table.remove( self.Contents, k )
self.numberContents = (self.numberContents - 1)
return
end
end
end
function PROCESS:OnStop()
self.Owner:DecResource("Melon_Seeds",1)
self.Owner:IncXP("Planting",math.Clamp(math.Round(50 / self.Owner:GetSkill("Planting")),1 , 1000))
self.Owner:SendMessage("Successfully planted.", 3, Color(10,200,10,255))
local ent = ents.Create("seed")
ent:CPPISetOwner(self.Owner)
ent:CPPISetOwnerUID(self.Owner:UniqueID())
ent:SetPos(self.Data.Pos)
local tbl = ent:GetTable()
tbl:Setup("melon",160 - math.Clamp(self.Owner:GetSkill("Planting"),0,60) + math.random(-20,20),self.Owner)
ent:Spawn()
self.Owner:Freeze(false)
end
[/code]
Still having this issue :<
bump
Shameless bump!
BUMP!!!!! :D
Oh for the love of god... Someone tell me how to fix this issue!!!
Whoever helps me solve this issue will get $15 in a Paypal account of there choosing.
Post the SetOwner function, and please, in lua tags.
For that I am using [url]http://www.facepunch.com/threads/786522-FPP-Falco-s-Prop-Protection-and-anti-spam/[/url] It isn't my code but works fine for others.
bump
might work , might not , might be total crap or it might be great , but this is what I think you should approximately do to give them back their entities.
[lua]
function GiveMeBackMyProps( ply )
local uid = ply:UniqueID()
for k,v in pairs(ents.FindByClass("site")) do
if v:CPPIGetOwnerUID() == uid then -- assuming you have a get owner function somewhere?
v:CPPISetOwner(ply)
else end
end
hook.Add( "PlayerInitialSpawn", "propreturn", GiveMeBackMyProps )
[/lua]
This script of course assumes you have a GetOwner function somewhere in there.
Sorry, you need to Log In to post a reply to this thread.