someone can help me create a lua so that the hats are saved? something that works with this lua of hats.
to be stored in a folder and when the person enters, have that hat
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
hats = {} hats.hooks = {"serveraction","menu","startround"} hats.items = { ["Angel"] = {view = "2D", path = "angel.png"}, -- don't forget the commas ["Devil"] = {view = "2D", path = "devil.png"}, ["Gandalf"] = {view = "2D", path = "gandalf_hat.png"}, ["Graduation"] = {view = "2D", path = "graduation_hat.png"}, ["Party"] = {view = "2D", path = "party_hat.png"}, ["Pirate"] = {view = "2D", path = "pirate_hat.png"}, ["Pumpkin"] = {view = "2D", path = "pumpkin_head.png"}, ["Santa"] = {view = "2D", path = "santa_hat.png"}, ["Snowman"] = {view = "2D", path = "snowman.png"}, ["Spear"] = {view = "2D", path = "spear.png"} } --hats.count = #hats.items hats.counter = 0 hats.menus = {} hats.player = {} for k,_ in pairs (hats.items) do hats.counter = hats.counter + 1 hats.items[k].ID = hats.counter end hats.count = hats.counter for _,hook in pairs (hats.hooks) do addhook(hook,"h_"..hook) end if hats.count <= 9 then hats.menus[1] = "Hats Menu" for k,v in pairs (hats.items) do hats.menus[1] = hats.menus[1] .. "," .. k .. "|" .. v.view end elseif hats.count > 9 then local index = 1 local counter = 0 hats.menus[index] = "Hats Menu ["..index.."]" for k,v in pairs (hats.items) do hats.menus[index] = hats.menus[index] .. "," .. k .. "|" .. v.view counter = counter + 1 if counter == 7 then if index == 1 then hats.menus[index] = hats.menus[index] .. ",(Previous Page),Next Page" else hats.menus[index] = hats.menus[index] .. ",Previous Page,Next Page" end counter = 0 index = index + 1 hats.menus[index] = "Hats Menu ["..index.."]" end end index = nil counter = nil end function h_serveraction(id, b) if b == 1 then menu(id,hats.menus[1]) end end function findHat(ID) for k,v in pairs (hats.items) do if v.ID == ID then return k end end end function removeHat(id) if hats.player[id] then freeimage(hats.player[id]) hats.player[id] = nil end end function h_menu(id, t, b) if t == "Hats Menu" then removeHat(id) hats.player[id] = image("gfx/hat/"..hats.items[findHat(b)].path,1,1,200+id) elseif t:find("Hats Menu") then local page = t:sub(12,12) if tonumber(t:sub(12,13)) then -- in case of more than single digit page amount page = page .. t:sub(12,13) end page = tonumber(page) local ID = page*7+b-7 if b <= 7 then removeHat(id) hats.player[id] = image("gfx/hat/"..hats.items[findHat(ID)].path,1,1,200+id) elseif b == 8 then menu(id,hats.menus[page-1]) elseif b == 9 then menu(id,hats.menus[page+1]) end ID = nil page = nil end end function h_startround() for _,id in pairs (player(0,"tableliving")) do removeHat(id) end end hats.count = nil hats.counter = nil hats.hooks = nil
this lua was creator by Rainoth