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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
local settings = --Settings { 	--Shop menu settings 	menuTitle = "Shop", --Title of menu 	menuPageNext = "Next page", --Text of next page button 	menuPagePrev = "Previous page", --Text of previous page button 	 	--Chat command settings 	commandShop = "shop", --Chat command to open shop (dont include "!") 	commandHelp = "shophelp", --Chat command to see shop help? (dont include "!") 	helpColor = "000200000", --Color the help text got 	hideCommands = 0, --Hide chat commands? (1 = yes, 0 = no) 	 	--Point settings 	startPoints = 10000, --Amount of points each player got at start 	killPoints = 1, --Amount per kill, the amount will be a random one between the 2 numbers 	freePointsTime = 0, --How many secs between each player get free points 	freePointsAmount = 0, --The amount of money they get each time 	 	--HUD settings 	pointId = 10, --The id of this hud text, if it dont shop up in server you may need to change it 	pointText = "Points: ", --Text in front of the point number 	pointColor = "200200000", --Color the point text got 	pointPos = {10, 200}, --The x and y position of the text 	 	--No money settings 	noMoneyText = "You dont have enough points!", --Text it will say if the player dont have enough money 	noMoneyColor = 255000000 --Color of text for no money } local commands = {} function ChatCommands(id, msg) --My chat command system 	local cmd = string.lower(msg) 	 	if commands[cmd] then 		commands[cmd](id) 		 		return settings.hideCommands 	end end addhook("say", "ChatCommands") local function AddCommand(cmd, OnSay) --Used to add a chat command 	commands["!"..string.lower(cmd)] = OnSay end AddCommand(settings.commandHelp, function(id) --Chat command to display help 	parse('msg2 '..id..' "©'..settings.helpColor.."-----------------------Shop help-----------------------") 	parse('msg2 '..id..' "©'..settings.helpColor.."Kill enemies to get points (you will get "..settings.killPoints.." points") 	parse('msg2 '..id..' "©'..settings.helpColor.."Type "..settings.commandShop.." to open the shop") 	parse('msg2 '..id..' "©'..settings.helpColor.."Type "..settings.commandHelp.." to see this") 	parse('msg2 '..id..' "©'..settings.helpColor.."--------------------------------------------------------") end) local playerData = {} --Table containing all player info local function SetPoints(id, points) --Used to set point of a player 	if player(id, "bot") == false then 		playerData[id].points = points 		 		parse('hudtxt2 '..id..' '..settings.pointId..' "©'..settings.pointColor..settings.pointText..playerData[id].points..'" '..settings.pointPos[1]..' '..settings.pointPos[2]) 	end end function SetupPlayer(id) --setup player info 	if player(id, "bot") == false then 		playerData[id] = {} 		playerData[id].page = 1 		 		SetPoints(id, settings.startPoints) 	end end addhook("join", "SetupPlayer") function AddPointsWhenKill(killer, victim, weapon, x, y) --When a player kills another player he will get points 	if player(killer, "bot") == false then 		SetPoints(killer, playerData[killer].points+settings.killPoints) 	end end addhook("kill", "AddPointsWhenKill") local items = {} --Table containing all item info local function AddItem(name, price, OnBuy) --Used to add a item to the shop 	table.insert(items, {name = name, price =price, OnBuy = OnBuy}) end local function AddItemWeapon(weapon, price) --Used to add a weapon to the shop 	AddItem(itemtype(weapon, "name"), price, function(id) 		parse('equip '..id..' '..weapon) 		parse('setweapon '..id..' '..weapon) 	end) end --Add items here---------------------------------------------------------------------------------------------------------------------- --Page 1 AddItemWeapon(46, 150) --Flamethrower AddItemWeapon(47, 300) --RPG AddItemWeapon(88, 400) --Portal gun AddItemWeapon(45, 500) --Laser AddItemWeapon(49, 500) --Grenade Launcher AddItemWeapon(90, 450) --M134 --Page 2 AddItem("White glow", 10, function(id) 	local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id) 	freeimage(id) 	imagecolor(glow, 255, 255, 200) 	imagescale(glow, 0.7, 0.7) 	imageblend(glow, 1) 	imagealpha(glow, 0.5) end) AddItem("Red glow", 10, function(id) 	local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id) 	freeimage(id) 	imagecolor(glow, 255, 0, 0) 	imagescale(glow, 0.7, 0.7) 	imageblend(glow, 1) 	imagealpha(glow, 0.5) end) AddItem("Green glow", 10, function(id) 	local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id) 	freeimage(id) 	imagecolor(glow, 0, 255, 0) 	imagescale(glow, 0.7, 0.7) 	imageblend(glow, 1) 	imagealpha(glow, 0.5) end) AddItem("Blue glow", 10, function(id) 	local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id) 	freeimage(id) 	imagecolor(glow, 0, 0, 255) 	imagescale(glow, 0.7, 0.7) 	imageblend(glow, 1) 	imagealpha(glow, 0.5) end) AddItem("Headcrab hat", 15, function(id) 	local headcrab = image("gfx/npc/headcrab.bmp<m>", 1, 0, 200+id) 	freeimage(id) end) AddItem("Snark hat", 15, function(id) 	local headcrab = image("gfx/npc/snark.bmp<m>", 1, 0, 200+id) 	freeimage(id) 	imagescale(headcrab, 2, 2) end) --Page 3 AddItemWeapon(74, 100) --Wrench AddItemWeapon(85, 35) --Chainsaw AddItemWeapon(78, 25) --Claw AddItemWeapon(69, 30) --Machete AddItemWeapon(73, 40) --Molotov Cocktail AddItemWeapon(41, 30) --Tactical Shield --Page 4 AddItemWeapon(79, 25) --Light Armor AddItemWeapon(80, 50) --Armor AddItemWeapon(81, 75) --Heavy Armor AddItemWeapon(82, 60) --Medic Armor AddItemWeapon(83, 95) --Super Armor AddItemWeapon(84, 300) --Stealth Suit -------------------------------------------------------------------------------------------------------------------------------------- local page = 1 local pages = {} pages[page] = {} local pageCheck = 0 for k, v in pairs(items) do --Here I am settings up the pages table so I can easly add items without worring about space in the menu 	pageCheck = pageCheck+1 	 	if pageCheck == 7 then 		page = page+1 		pages[page] = {} 		 		pageCheck = 1 	end 	 	table.insert(pages[page], k) --Insert the item index into the page end local function GenerateButtonString(item) --I made this so I dont have to type as much over and over 	if item then --If item is valid 		return item.name.."|"..item.price --Return the button text 	else 		return "" --Return no button 	end end local function OpenShopMenu(id) --Used to open the shop 	local indexes = pages[playerData[id].page] --Gets a table of the indexes for this page 	 	menu(id, settings.menuTitle..","..GenerateButtonString(items[indexes[1]])..","..GenerateButtonString(items[indexes[2]])..","..GenerateButtonString(items[indexes[3]])..","..GenerateButtonString(items[indexes[4]])..","..GenerateButtonString(items[indexes[5]])..","..GenerateButtonString(items[indexes[6]])..",,"..(pages[playerData[id].page+1] and settings.menuPageNext or "")..","..(pages[playerData[id].page-1] and settings.menuPagePrev or "")) end AddCommand(settings.commandShop, OpenShopMenu) function ShopMenuHook(id, title, button) 	if title == settings.menuTitle then --If its my shop menu 		local index = pages[playerData[id].page][button] --Index of item 		local price = items[index] and items[index].price or nil --Price of item 		 		if button <= 6 then --If one of the 6 buttons is the one pressed then 			if playerData[id].points >= price then --If the players money is more than the price then 				items[index].OnBuy(id) --Do what the items gives 				SetPoints(id, playerData[id].points-price) --Take the players money 			else 				msg2(id, "©"..settings.noMoneyColor..settings.noMoneyText) --Message if the player dont have enough money 			end 		end 		 		if button == 8 then --If button is the "Next page" button 			playerData[id].page = playerData[id].page+1 --Increment the page number for that player 			OpenShopMenu(id) --And open the menu agian with the new page 		elseif button == 9 then --If button is the "Prev page" button 			playerData[id].page = playerData[id].page-1 --Decrement the page number for that player 			OpenShopMenu(id) --And open the menu agian with the new page 		end 		 	end end addhook("menu", "ShopMenuHook") function AddPointsTimer() --Used to give all players some free points 	local playerList = player(0, "table") --Get all players in a table 	 	for k, v in pairs(playerList) do 		if player(v, "bot") == false then 			SetPoints(v, playerData[v].points+settings.freePointsAmount) --Give all existing players some points 		end 	end end timer(settings.freePointsTime*1000, "AddPointsTimer", "", 0) --Infinite timer
If i buy a FlameThrower the item will be on the ground not in my hand, I know it's easy but i don't understand