• Money System help doesnt create txt file
    4 replies, posted
Hello, Some one helped me make an Money System and it works in the listen server. But it doesn't in the SRDCS Dedicated server. It doesn't create the txt file in the data folder Somehow. Help plz? Thanks
[QUOTE=Dave_Parker;18128390]Are you running file.Write on the client? Are you writing outside of the data folder? Are you getting an error in the function that writes the txt? Seriously, need more info.[/QUOTE] It works But i need help with something else read my other thread
[QUOTE=spekki7;18128507]It works But i need help with something else read my other thread[/QUOTE] Put this in init.lua [lua] function money(pl) file.Write(pl:SteamID(),"money/"..pl:GetNWInt("money")) end hook.Add( "PlayerInitialSpawn", "writemoneyduhh",money ) [/lua] [lua] function readmoney(pl) file.Read("money/"..pl:SteamID()) end hook.Add( "PlayerInitialSpawn", "Readmoneyduhh",readmoney ) [/lua]
I use this: [lua] require( "glon" ) function GM:PlayerInitialSpawn( ply ) if( not file.Exists( "money.txt" ) ) then file.Write( "money.txt", "" ) end end [/lua] Saving: [lua] function DataSaving( ply ) --Money local moneydata = glon.decode( file.Read( "money.txt" ) ) moneydata[ ply:SteamID() ] = ply:GetNWInt( "playermoney" ) file.Write( "money.txt", glon.encode( moneydata ) ) end [/lua] Loading: [lua] function DataLoading( ply ) --Money local moneydata = glon.decode( file.Read( "money.txt" ) ) ply:SetNWInt( "playermoney", moneydata[ ply:SteamID() ] ) end [/lua]
Sorry, you need to Log In to post a reply to this thread.