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
function TMW.say(id, text)
	if text :sub(1, 4) :lower() == "tmw" and TMW.permission_check(id, TMW.PNODE_OPENMENU) then
		
		local from, to, targetID = text:find(" ?(%d+)", 5)	-- returns 3 values: from, to, string
		targetID = tonumber(targetID)
		print(targetID, text:find(" ?(%d+)", 5))
		if not targetID then	-- equip himself
		
			if player(id, "health") ~= 0 then
				TMW.GUI_open(id)
			else
				msg2(id,"©255255255[TooManyWeapons] You can't equip yourself, you're D E A D!")
			end
			
		elseif TMW.permission_check(id, TMW.PNODE_EQUIPOTHER) then	-- equip other player
		
			if TMW.validPlayerID(targetID) and player(targetID, "exists") then
				if player(targetID, "health") ~= 0 then
					TMW.GUI_open(id, targetID)
					
					msg2(id, "©170170255[TMW] Opened menu to equip player (".. targetID ..") ".. player(targetID, "name") ..", #".. player(targetID, "usgn"))
				end
			else
				msg2(id, "©255255255[TooManyWeapons] Player with ID ".. targetID .." doesn't exist!")
			end
			
		end
		
		return 1
	end
end