When I have one of my entities spawn, I’m getting the owner of the entity (I have falco’s prop protect) by using:
[lua]mrobot.OGOwner = mrobot:CPPIGetOwner()[/lua]
So, what I’m doing here is, I’m creating a variable called “OGOwner” that is stored in each entity I create, and that variabl****e stores the ORIGINAL owner that spawned the entity.
Now over to my init.lua file of my entity. I coded so that when the entity takes damage, it prints what it’s OGOwner variable is.
I shoot the entity. This appears in console:
Now here’s the perplexing part.
When I LEAVE the server (this is a dedicated server), and come back, and then shoot the entity, this appears:
How the hell is this possible? The variable self.OGOwner is a variable! Variables don’t update!
This leads me to one conclusion, that userdata updates in real time, even if you make a variable store it.
So here’s the question: **How the hell do I make a variable that stores the userdata statically, that does not change when I quit and then come back?
I’m doing this because I’m trying to get it so that a person can only spawn 1 of this entity, and in my entities ENT:Remove() function (when the entity gets removed by FPP or otherwise) the server subtracts one from the players Pdata.However, when the player leaves and then comes back, the server apparently thinks OGOwner is null, even though variables don’t change, but I guess userdata does, even in a variable.