Forum

> > CS2D > Scripts > Saving script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Saving script

1 Antwort
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Saving script

_Lima_
User Off Offline

Zitieren
Hi, I need some help. How to make a rank, score, reputation saved in 1 file. And how to fix a bug when a player enters the server but stops loading and exits, then his reputation is saved as 0 (Need 20).

Spoiler >

alt Re: Saving script

Cebra
User Off Offline

Zitieren
i assume that your arrays are global arrays, otherwise there is your bug.

to save several vars in one file:

1
2
3
4
-- untested code
local file = [to be inserted]
file:write (Rank[id].." "..player(id,"score").." "..Reputation[id])
file:close()

then you load them with:

1
2
3
4
5
6
-- untested code
local file = [to be inserted]
Rank[id] = file:read("*n")
parse("setscore "..id.." "..file:read("*n"))
Reputation[id] = file:read("*n")
file:close()

this will also reduce the amount of functions (there are too many)

edit: it looks like the
end
in line 9,22,34 & 57 have to move a few line down. (look here)

does you code run without throwing errors? 0o
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht