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
47
48
49
50
51
52
53
addons = {
	{"Wings", 50000},
	{"Terminator", 100000},
	{"Death", 150000}
}
val.addon = {}
for id = 1, 32 do
	val.addon[id] = {}
	
	for addon = 1, #addons do
		val.addon[id][addon] = 0
	end
end
function loadaddons (id)
	local file = io.open ("sys/lua/save/" .. player (id, "usgn") .. ".txt", "r")
	
	if (file) then
		local values = {}
		
		for value in file:read ():gmatch ("[^%s]+") do
			table.insert (values, value)
		end
		
		for addon = 1, #addons do
			val.addon[id][addon] = values[addon]
		end
	end
end
function saveaddons (id)
	local file = io.open ("sys/lua/save/" .. player (id, "usgn") .. ".txt", "w+")
	local content = ""
	
	for addon = 1, #addons do
		content = content .. val.addon[id][addon] .. " "
	end
	
	file:write (content)
	file:close ()
end
function getaddonsmenu (id)
	local field = ""
	
	for key, addon in ipairs (addons) do
		field = field .. addon[1] .. "|$" .. addon[2] .. ","
	end
	
	menu (id, "Add-ons," .. field)
end
It uses the same condition, 0 for