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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
addhook("join","inv.join")
function inv.join(id)
	local us = player(id, "usgn")
	inv.inv[id] = {}
	inv.page[id] = 0
	inv.looks[id] = 0
	if inv.adm and inv.adm.join then inv.adm.join(id) end
	if us > 0 then
		for lines in io.lines("sys/lua/rp_citylife/invitems.txt") do
			local line = lines:toTable(":")
			if tonumber(line[1]) == us then
				for i = 2, table.maxn(line) + 1, 1 do
					local v = line[i]
					if v ~= " " and v then
						inv.inv[id][i - 1] = {tonumber(v:toTable(",")[1]), tonumber(v:toTable(",")[2])}
					else
						inv.inv[id][i - 1] = nil
					end
				end
				break
			end
		end
	end
	if inv.items.join then inv.items.join(id) end
end
--[[Removed]]--
addhook("leave","inv.leave")
function inv.leave(id, r)
	local us = player(id, "usgn")
	if us > 0 then
		local s = ""
		local c = false
		for lines in io.lines("sys/lua/rp_citylife/invitems.txt") do
			local line = lines:toTable(":")
			if tonumber(line[1]) == us then
				local f = ""
				for i = 1, table.maxn(inv.inv[id]) + 1, 1 do
					local v = inv.inv[id][i]
					if v then
						f = f .. tostring(v[1]) .. "," .. tostring(v[2]) .. ":"
					else
						f = f .. " :"
					end
				end
				s = s .. us .. ":" .. f .. "\n"
				c = true
			else
				s = s .. lines .. "\n"
			end
		end
		if c == true then
			local f = io.open("sys/lua/rp_citylife/invitems.txt", "w")
			f:write(s)
			f:close()
		else
			local x = ""
			for i = 1, table.maxn(inv.inv[id]) + 1, 1 do
				local v = inv.inv[id][i]
				if v then
					x = x .. tostring(v[1]) .. "," .. tostring(v[2]) .. ":"
				else
					x = x .. " :"
				end
			end
			x = us .. ":" .. x .. "\n"
			local f = io.open("sys/lua/rp_citylife/invitems.txt", "a")
			f:write(x)
			f:close()
		end
	end
	inv.inv[id] = {}
	inv.page[id] = 0
	inv.looks[id] = 0
	if inv.items.leave then inv.items.leave(id, r) end
end