Forum

> > CS2D > Scripts > How do i make a storage to store all player's data
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How do i make a storage to store all player's data

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: How do i make a storage to store all player's data

Mami Tomoe
User Off Offline

Zitieren
Use file reading and writing.

Write to save, read to load.

You can write it in many formats such as but not limited to:
> CSV: Easy and fast, but limited to basic variables
> Json: Harder, universal, slowest
> Pure Lua (table): Slow but somewhat easy to implement

alt Re: How do i make a storage to store all player's data

Komo the Cat
User Off Offline

Zitieren
@user Mami Tomoe: I think using Lua tables is better, but the problem is that I have to create a variable for the player's data.

Ex :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Variable(s) --

local dataPlayer = {}
local dataPlayer.amPlayer = {}

-- Hook(s) --

addhook("join","j_func")
addhook("leave","l_func")

-- Function(s) --

function j_func(id)
    dataPlayer.amPlayer[id] = 0
end

function l_func(id)
    dataPlayer.amPlayer[id] = nil
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht