Is it possible to check if player has specific weapon when he uses "script shop", E.g. equip "..id.." 46 / Flamethrower.
If the player already has this item it will still remove -200 points from him but give him nothing. I'm trying to block this with some kinda of error message like "msg2(id,"©255000000You already have this!@C")" -> end
Thanks in advance!
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
if title == "Special Weapons" then 		if sel == 1 then 			if ms.money[id] > 199 then 				parse("equip "..id.." 46") 				msg2(id,"©000255000You've buy Flamethrower!@C") 				ms.money[id]=ms.money[id]-200 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end
Here is the shop "base" that I'm using:
Spoiler
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
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
--------------------------------------- -- Example of shops -- -- by: MS'ek -- --------------------------------------- ms={} ---------------------- -- Initial Setup -- ---------------------- function initArray(m) 	local array = {} 	for i = 1, m do 		array[i]=0 	end 	return array end ms.money=initArray(32) function ms.moneyshow(id) 	parse('hudtxt2 '..id..' 1 "©255075000Money: '..ms.money[id]..' " 13 200') end ---------------------- -- Shops -- ---------------------- function ms.shopa(id) 	menu(id,"Special Weapons,Flamethower|200,RPG Launcher|250,Rocket Launcher|150,Grenade Launcher|150,Laser|500") end function ms.shopb(id) 	menu(id,"Armors,Light Armor|150,Medium Armor|220,Heavy Armor|300,Medic Armor|320,Super Armor|350,Stealch Suit|220") end function ms.shopc(id) 	menu(id,"Potions,25hp|10,50hp|15,75hp|20,100hp|25") end ---------------------- -- Shop func's -- ---------------------- addhook("menu","ms.buy") function ms.buy(id,title,sel) 	if title == "Special Weapons" then 		if sel == 1 then 			if ms.money[id] > 199 then 				parse("equip "..id.." 46") 				msg2(id,"©000255000You've buy Flamethower!@C") 				ms.money[id]=ms.money[id]-200 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 2 then 			if ms.money[id] > 249 then 				parse("equip "..id.." 47") 				msg2(id,"©000255000You've buy RPG Launcher!@C") 				ms.money[id]=ms.money[id]-250 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 3 then 			if ms.money[id] > 149 then 				parse("equip "..id.." 48") 				msg2(id,"©000255000You've buy Rocket Launcher!@C") 				ms.money[id]=ms.money[id]-150 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 4 then 			if ms.money[id] > 149 then 				parse("equip "..id.." 49") 				msg2(id,"©000255000You've buy Grenade Launcher!@C") 				ms.money[id]=ms.money[id]-150 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 5 then 			if ms.money[id] > 499 then 				parse("equip "..id.." 45") 				msg2(id,"©000255000You've buy Laser!@C") 				ms.money[id]=ms.money[id]-500 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 	end 	if title == "Armors" then 		if sel == 1 then 			if ms.money[id] > 149 then 				parse("setarmor "..id.." 201") 				msg2(id,"©000255000You've buy Light Armor!@C") 				ms.money[id]=ms.money[id]-150 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 2 then 			if ms.money[id] > 219 then 				parse("setarmor "..id.." 202") 				msg2(id,"©000255000You've buy Medium Armor!@C") 				ms.money[id]=ms.money[id]-220 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 3 then 			if ms.money[id] > 299 then 				parse("setarmor "..id.." 203") 				msg2(id,"©000255000You've buy Heavy Armor!@C") 				ms.money[id]=ms.money[id]-300 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 4 then 			if ms.money[id] > 319 then 				parse("setarmor "..id.." 204") 				msg2(id,"©000255000You've buy Medic Armor!@C") 				ms.money[id]=ms.money[id]-320 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 5 then 			if ms.money[id] > 349 then 				parse("setarmor "..id.." 205") 				msg2(id,"©000255000You've buy Super Armor!@C") 				ms.money[id]=ms.money[id]-350 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 6 then 			if ms.money[id] > 219 then 				parse("setarmor "..id.." 206") 				msg2(id,"©000255000You've buy Stealch Suit@C") 				ms.money[id]=ms.money[id]-220 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 	end 	if title == "Potions" then 		if sel == 1 then 			if ms.money[id] > 9 then 				parse("sethealth "..id.." "..player(id,"health")+25) 				msg2(id,"©000255000You've buy 25hp potion!@C") 				ms.money[id]=ms.money[id]-10 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 2 then 			if ms.money[id] > 14 then 				parse("sethealth "..id.." "..player(id,"health")+50) 				msg2(id,"©000255000You've buy 50hp potion!@C") 				ms.money[id]=ms.money[id]-15 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 3 then 			if ms.money[id] > 19 then 				parse("sethealth "..id.." "..player(id,"health")+75) 				msg2(id,"©000255000You've buy 75hp potion!@C") 				ms.money[id]=ms.money[id]-20 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 		if sel == 4 then 			if ms.money[id] > 24 then 				parse("sethealth "..id.." "..player(id,"health")+100) 				msg2(id,"©000255000You've buy 100hp potion!@C") 				ms.money[id]=ms.money[id]-25 				ms.moneyshow(id) 			else 				msg2(id,"©255000000You have not enouch money!@C") 			end 		end 	end end ----------------------- -- Serveractions -- ----------------------- addhook("serveraction","ms.action") function ms.action(id,action) 	if action == 1 then 		ms.shopa(id) 	end 	if action == 2 then 		ms.shopb(id) 	end 	if action == 3 then 		ms.shopc(id) 	end end ------------------------ -- Kill and spawn -- ------------------------ addhook("spawn","ms.spawn") function ms.spawn(id) 	ms.moneyshow(id) end addhook("kill","ms.kill") function ms.kill(id) 	ms.money[id]=ms.money[id]+10 	ms.moneyshow(id) end addhook("die","ms.die") function ms.die(id) 	ms.money[id]=ms.money[id]-2 	ms.moneyshow(id) end