NWInt & PData fail to load? | Help


ply:SetPData( "Save", ply:GetNWInt( "Money" )) 

and then I use

ply:SetNWInt( "Money",  ply:GetPData( "Save" )) 

but when I use it in Initial Spawn anything it dosent load… untill I just reload ingame. And it works perfectly?
Is there a way to make like a Data file and receive the players money when they join? and save it when they leave?

and I use GM:PlayerInitialSpawn( ply ) for receiving data and GM:ShutDown( ply ) & GM:PlayerDisconnect( ply ) for saving data…
Yeah… so is there a way to save a file to the Data file and receiving data??

Thanks - Jacob

[editline]14th August 2016[/editline]

So can someone help?

Try setting a timer.Simple(1, function() code end) arou,d the loading code.

You could alternatively just use SQL

How may I use SQL?

There’s SQLite which is basically a “built-in” SQL for Garry’s Mod.
These are some documented functions and a decent (maybe a bit old) tutorial;

There’s also modules such as tMySQL (personal fav) and MySQLOO which allow you to use external databases which is great for multiple servers.

How may I use the tMySQL in adding like my players money?

You shouldnt use tMySQL unless you plan to have multiple servers running the gamemode/addon