Im trying to learn PData and i have hit a problem. Im making a store addon and im trying to set if they player has bought the item with
ply:SetPData( "Owned" .. boughtItem, true)
which should return something like Owned1 but when i open the sv.db i go to the player data i see the infoid column is 1[Owned1] and when i call
if ply:GetPData( "Owned1" ) == true then
it always returns false Im guessing the 1 at the from is my Unique ID as im on singleplayer.
How do i go about solving this problem?
Try it with an local server, not singleplayer
^ While he is correct, this isn’t your problem.
GetPData returns a string, no matter what value was inserted into it. Either do == “true” or use tobool
Now as for the local server thing:
PData is stored within sv.db and cl.db, depends on where you set it from. On a local server, you are both the client AND the server, so some things may work even if you stored data on the client and retrieved it on the server.
These things will not work on a normal dedicated server and it can be very frustrating, so you might want to avoid that (Or pay very very close attention to where you use Set and Get in your codes)