now need help with a LUA of the RPG tibia
this is the code
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
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
-- EQUIP --
function eat(id, itemslot, itemid, equip)
	radiusmsg(player(id,"name") .. " eats " .. ITEMS[itemid].article .. " " .. ITEMS[itemid].name .. ".", player(id,"x"), player(id,"y"), 384)
	local health = player(id, "health") + ITEMS[itemid].food()
	parse("sethealth " .. id .. " " .. health)
	PLAYERS[id].HP = health
	destroyitem(id, itemslot)
end
function explosion(x, y, size, damage, id)
	for _, m in ipairs(MONSTERS) do
		if math.sqrt((m.x-player(id,'x'))^2+(m.y-player(id,'y'))^2) <= size then
			m:damage(id, math.floor(damage*math.random(60,140)/100), 251)
		end
	end
	parse("explosion " .. x .. " " .. y .. " " .. size .. " " .. damage .. " " .. id)
end
function equip(id, itemslot, itemid, equip)
	local index = equip and "Equipment" or "Inventory"
	local previtems, newitems = {}, {}
	if equip then
		if not additem(id, itemid) then return end
		previtems[itemslot] = PLAYERS[id].Equipment[itemslot] or 0
		PLAYERS[id].Equipment[itemslot] = nil
		newitems[itemslot] = 0
	else
		if ITEMS[itemid].level and PLAYERS[id].Level < ITEMS[itemid].level then
			message(id, "You need to be level " .. ITEMS[itemid].level .. " or above to equip it.", "255255255")
			return
		end
		newitems[ITEMS[itemid].slot] = itemid
		if ITEMS[itemid].slot == 4 then
			if PLAYERS[id].Equipment[3] then
				if ITEMS[PLAYERS[id].Equipment[3]].twohand then
						if not additem(id, PLAYERS[id].Equipment[3]) then return end
						previtems[3] = PLAYERS[id].Equipment[3] or 0
						PLAYERS[id].Equipment[3] = nil
						newitems[3] = 0
				end
			end
		elseif ITEMS[itemid].slot == 3 then
			if ITEMS[itemid].twohand then
				if PLAYERS[id].Equipment[4] then
					if not additem(id, PLAYERS[id].Equipment[4]) then return end
					previtems[4] = PLAYERS[id].Equipment[4] or 0
					PLAYERS[id].Equipment[4] = nil
					newitems[4] = 0
				end
			end
		end
		destroyitem(id, itemslot)
		if PLAYERS[id].Equipment[ITEMS[itemid].slot] then
			previtems[ITEMS[itemid].slot] = PLAYERS[id].Equipment[ITEMS[itemid].slot]
			additem(id, PLAYERS[id].Equipment[ITEMS[itemid].slot])
		else
			previtems[ITEMS[itemid].slot] = 0
		end
		PLAYERS[id].Equipment[ITEMS[itemid].slot] = itemid
	end
	updateEQ(id, newitems, previtems)
end
function updateEQ(id, newitems, previtems)
	if not previtems then
		previtems = {}
	end
	if not newitems then return end
	parse("equip " .. id .. " 50;setweapon " .. id .. " 50")
	local hp, spd, atk, def = 0, 0, 0, 0
	local equip, strip = playerweapons(id), {50, 41}
	for i, v in pairs(newitems) do
		if previtems[i] then
			if PLAYERS[id].tmp.equip[i].image then
				freeimage(PLAYERS[id].tmp.equip[i].image)
				PLAYERS[id].tmp.equip[i].image = nil
			end
			if PLAYERS[id].tmp.equip[i].equip then
				parse("strip " .. id .. " " .. PLAYERS[id].tmp.equip[i].equip)
				table.insert(strip, PLAYERS[id].tmp.equip[i].equip)
				PLAYERS[id].tmp.equip[i].equip = nil
			end
			if ITEMS[previtems[i]].hp then
				hp=hp-ITEMS[previtems[i]].hp
			end
			if ITEMS[previtems[i]].speed then
				spd=spd-ITEMS[previtems[i]].speed
			end
			if ITEMS[previtems[i]].atk then
				atk=atk-ITEMS[previtems[i]].atk
			end
			if ITEMS[previtems[i]].def then
				def=def-ITEMS[previtems[i]].def
			end
		end
		if newitems[i] ~= 0 then
			if ITEMS[newitems[i]].hp then
				hp=hp+ITEMS[newitems[i]].hp
			end
			if ITEMS[newitems[i]].speed then
				spd=spd+ITEMS[newitems[i]].speed
			end
			if ITEMS[newitems[i]].atk then
				atk=atk+ITEMS[newitems[i]].atk
			end
			if ITEMS[newitems[i]].def then
				def=def+ITEMS[newitems[i]].def
			end
			if ITEMS[newitems[i]].equip then
				PLAYERS[id].tmp.equip[i].equip = ITEMS[newitems[i]].equip
				parse("equip " .. id .. " " .. ITEMS[newitems[i]].equip)
				table.insert(equip, ITEMS[newitems[i]].equip)
			end
			if ITEMS[newitems[i]].eimage then
				if not PLAYERS[id].tmp.equip[i].image then
					PLAYERS[id].tmp.equip[i].image = image(ITEMS[newitems[i]].eimage, ITEMS[newitems[i]].static and 0 or 1, 0, (ITEMS[newitems[i]].ground and 100 or 200)+id)
					if ITEMS[newitems[i]].r then
						imagecolor(PLAYERS[id].tmp.equip[i].image, ITEMS[newitems[i]].r, ITEMS[newitems[i]].g, ITEMS[newitems[i]].b)
					end
					local scalex, scaley = ITEMS[newitems[i]].escalex or 1, ITEMS[newitems[i]].escaley or 1
					scalex = scalex * -1
					imagescale(PLAYERS[id].tmp.equip[i].image, scalex, scaley)
					if ITEMS[newitems[i]].blend then
						imageblend(PLAYERS[id].tmp.equip[i].image, ITEMS[newitems[i]].blend)
					end
				end
			end
		end
	end
	for i, v in ipairs(equip) do
		if not inarray(strip, v) then
			parse("setweapon " .. id .. " " .. v .. ";strip " .. id .. " 50")
		end
	end
	PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk+atk
	PLAYERS[id].tmp.def = PLAYERS[id].tmp.def+def
	PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd+spd
	PLAYERS[id].tmp.hp = PLAYERS[id].tmp.hp+hp
	parse("setmaxhealth " .. id .. " " .. PLAYERS[id].tmp.hp .. "; speedmod " .. id .. " " .. PLAYERS[id].tmp.spd .. "; sethealth " .. id .. " " .. player(id, "health"))
end
-- END OF EQUIP --
mainly I want is, add new weapons to the game. Only 2 guns can hurt away, the scuot and five-seven. the other need to approach the monster at a distance where the monster can attack to do damage.
please help
RPG tibia new weapons
1 
Offline

§2.1 - No needless and/or doubled posts (spam)
Dimas541