Changing printer ownership when pocketed

I’m trying to make it where when you pocket a printer, it changes the owner of it to who ever put it in their pocket. I have the code laid out with no lua errors, but it’s not working. I check if when pocketed it is a certain ent, but it always comes back as false, even though its the correct one. I made it change the owner if it was true or not, just for testing, but it is still not working, and is always coming back as false.




printers = {"sp_printer_high","sp_printer_low","sp_printer_medium","sp_printer_premium","sp_printer_rare","sp_printer_eco"}

function ChangePrinterOwner(ply,ent,var1,var2)

	--print("message")
	if ent == "money_printer" then   --(table.HasValue( printers, ent)) then
		ent:SetOwner(ply)
		print("has value")
	else
		ent:SetOwner(ply)
		print("doesnt have value")
	end
end
hook.Add("onPocketItemDropped","ChangePrinterOwner", ChangePrinterOwner )




I highly suggest you ask the creator of stuffed printers.

First of all.

Second argument on ChangePrinterOwner gives you class or just entity?
If not use ent:GetClass()

Then.
Explore how your printers get owner.
If not owner geting from your printers code then use FPP set owner.

P.S Johny, get out here stalker.

I was testing it with regular printers also and that didn’t work. Notice how the stuffed printers are commented out?

You do know he probably isn’t using the legitement version of the script right?

Yes, but considering you bought the addon I’m quite sure author will help you out.

Maybe this printers is free?

They aren’t.

-snip-

I really don’t care about this working on stuffed printers though, I just want it to work in general. The only reason I am using stuffed printers for it is because it is the only printer addon I have purchased.

Thanks for literally destroying what we were aiming for, now I have literally no chance of finding out who that is…

Your welcome.

Edit:

I found his Steam ID in the third post down on this thread: http://forum.facepunch.com/showthread.php?t=1518378&p=50306203#post50306203

Or a simple search of danker peppers on sf would of found him https://scriptfodder.com/users?search=danker+pepers

http://puu.sh/oT4xi/6e4abc5750.png

Would you rather have me make a support ticket through scriptfodder for help, rather than do it through here?

[editline]15th May 2016[/editline]

I have it bought on a different account, so I can link this thread to you in the support ticket if you want some proof of me owning it.

I was kinda pushing you into contacting me so I find out if you use a leak or not.
The printers aren’t meant to be pocketable - if you understood how pocket works you would quickly drop the idea.
DarkRP pocket used to make stuff invisible and incollidable at the place you pocket it and then teleport it upon dropping it out of pocket and make it visible/collidable again.
Now DarkRP pocket actually removes the entity and stores it’s data inside pocket.

Sadly, it stores only NetworkedVars setup via SetupDataTable, which I won’t use because it’s gay and updates all the time even when value doesn’t change so it’s really stupid resource-wise to use it for anything else than variables that constantly change (that’s why SP will never work with pocketting).

In addition, the fact that entity is actually removed from the world means that you can bypass entity limit with it.
When you buy a printer, gamemode loops through printers on the map and checks the owner, then if amount of printers owned by you is higher or equal maximum, it obviously returns an error message saying you already have max printers - now imagine what would happen if that printer didn’t exist on the map, but did exist in your pocket?

[editline]15th May 2016[/editline]

Ofcourse all of that could be fixed by migrating Stuffed Printers from net library to networked variables and adding a custom check to printers that checks for contents of a pocket… but it’s really not worth the effort.

So it’s not really possible to change the owner of a printer when you put it in your pocket? Also do you want me to submit a support ticket to prove ownership?

It is possible, but why would you do that?
If you change ownership - that’ll also bypass maximum printer limit.

One guy will keep buying printers, the other guy will keep taking ownership.

Mind you, all of this is possible and easily do-able… but not without editting DarkRP core files and changing the way it checks for max entities et cetera.

The main purpose of what I was trying to do is make it so when you raid someone for printers, and they log off, you can keep them. I saw that this would be easily exploited, but I was going to try and find a way to patch that after I got the initial part working. I’m not sure how I would do it, but I would figure whether or not to keep the script down the line, depending on if I fixed the exploit or not. But seriously, I purchased the printers. I will submit a ticket if you say so, to prove I have bought them. I don’t want to be known as someone who uses leaked scripts, because that’s a shitty thing to do.

Just set so unowned entities are removed after 30 minutes rather than 5 minutes, that’ll make robbers atleast have a bit of use from it and it’s not long enough to make “spawn, disconnect, repeat” worth it.

Well thanks for the help, I guess I’m gonna do that instead of going through the trouble of changing owner. Can you please answer my question if you want me to verify the ownership of the printers?