English Saving script

1 reply
Goto Page
To the start Previous 1 Next To the start
29.04.20 11:15:56 am
Up
LiME1516
User
Offline Off
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 >
S.T.A.L.K.E.R. RP - https://discord.gg/wQUEKSB
29.04.20 01:03:33 pm
Up
Cebra
User
Offline Off
i assume that your arrays are global arrays, otherwise there is your bug.

to save several vars in one file:

Code:
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:

Code:
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
loading...
To the start Previous 1 Next To the start