Forum

> > CS2D > Scripts > saving directory outside sys folder.
Forums overviewCS2D overview Scripts overviewLog in to reply

English saving directory outside sys folder.

5 replies
To the start Previous 1 Next To the start

old saving directory outside sys folder.

ZaibatsuTEAM
User Off Offline

Quote
This is my save function for one of the things on my server.
1
2
3
4
5
6
7
8
9
10
11
function min2()
for id=1,32 do
if player(id,"exists") then
io.output(io.open("sys/lua/usergems/"..player(id,"usgn")..".txt","w+"))
io.write( yourgem[id])
io.close()
msg2 (id,""..copyright.."000255000Saved!@C")
end
end
hud(id)
end
I'd like to be able to both save and load "yourgem" on all my servers and I want the savefiles to be the same as the other servers. that's why i want to save the files on, my desktop for example... and make all servers access those savefiles. Does anyone know how I can change the code that I provided, to be able to save and load outside the sys directory of cs2d? Thanks

old Re: saving directory outside sys folder.

Yates
Reviewer Off Offline

Quote
Enter the full path, on Linux for example, this would look something like this:
/home/<user>/cs2d/<save folder>/<usgn>.txt

All my Counter-Strike 2D servers are in the cs2d folder so it doesn't get messy.

Want to know the full path on Windows? Open the folder the saves will be saved into and click on the path bar, copy/paste that into your code as the path.

old Re: saving directory outside sys folder.

VADemon
User Off Offline

Quote
If the full path is
1
/home/<user>/cs2d/savefolder/<usgn>.txt
And each server is in
1
/home/<user>/<server name>/
Then you can
1
io.open("../cs2d/savefolder/"..player(id,"usgn")..".txt","w+")
The ../ will point to the parent directory, /home/<user>/

~Just CLI things~
edited 1×, last 30.10.15 05:25:46 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview