Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
save file
7 replies![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)
![cs2d lua hook](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
With conjunction with file:open, file:write, file:read, and file:close, as well as the datatype of your choice (plaintext, json, serialized, pickle, custom), you can load and read usgn save files.
To get player USID you can use player(id,"usgn"),
![cs2d lua cmd](img/i_codehelp.png)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if a==nil then a={} function initArray(m) 	local array = {} 	for i = 1,m do 		array[i]=0 	end 	return array end level=initarray(32) addhook("kill","a.kill") function a.kill(id) 	level[id]=level[id]+1 	end end
How to make save file for it?
![file](img/i_file.png)
![cs2d](img/icons/cs2d.png)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
a=a or {} function initArray(m) 	local array = {} 	for i = 1,m do 		array[i]=0 	end 	return array end level=initarray(32) addhook("kill","a.kill") function a.kill(id) 	level[id]=level[id]+1 end addhook("leave","a.leave") function a.leave(id) 	if player(id,"usgn")>0 then 		local temp=io.open("sys/lua/gelap/"..player(id,"usgn")..".txt","w") 		temp:write(level[id]) 		temp:close() 	end 	level[id]=0 end addhook("join","a.join") function a.join(id) 	level[id]=0 	if player(id,"usgn")>0 then 		local temp=io.open("sys/lua/gelap/"..player(id,"usgn")..".txt","r") 		if temp then 			level[id]=tonumber(temp:read("*a")) 		end 	end end addhook("minute","a.minute") function a.minute() 	for _, id in pairs(player(0,"table")) do 		if player(id,"usgn")>0 then 			local temp=io.open("sys/lua/gelap/"..player(id,"usgn")..".txt","w") 			temp:write(level[id]) 			temp:close() 		end 	end end
I also add a
![cs2d lua hook](img/i_codehelp.png)
Also you need to add "gelap" folder at "sys/lua"
edited 1×, last 04.08.13 03:43:17 am
![user](img/i_friend.png)
Make your script like this lua
Score save system. (5)
![file](img/i_file.png)
![cs2d](img/icons/cs2d.png)
I lol'd
Admin/mod comment
![Rules](img/v_illegal.png)
![user](img/i_friend.png)
![user](img/i_friend.png)
Thank you all.These help me continued my scription.Thank you thank you thank you thank you.
![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)