Forum

> > CS2D > Scripts > How do i make a storage to store all player's data
Forums overviewCS2D overview Scripts overviewLog in to reply

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

4 replies
To the start Previous 1 Next To the start

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

Mami Tomoe
User Off Offline

Quote
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

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

Komo the Cat
User Off Offline

Quote
@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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview