-> sys/lua/cs2dtibia/hooks.lua:405: in function <sys/lua/cs2dtibia/hooks.lua:404>
-> [C]: in function 'parse'
-> sys/lua/cs2dtibia/hooks.lua:383: in function 'EXPhit'
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
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
addhook("hit","EXPhit") function EXPhit(id,source,weapon,hpdmg,apdmg) 	local HP, dmg, wpnName, name = player(id, "health") 	if hpdmg <= 0 or source == 0 then 		PLAYERS[id].HP = HP-hpdmg 		return 	end 	if type(source) == "table" then 		if gettile(PLAYERS[id].x, PLAYERS[id].y).SAFE then return 1 end 		dmg = math.ceil(math.random(10,20)*hpdmg*source.atk/PLAYERS[id].tmp.def/15) 		source, wpnName = 0, source.name 		--print(wpnName .. " deals " .. dmg .. " damage to " .. player(id, "name") .. ".") 	elseif player(source, 'health') > 0 then 		if id == source then return 1 end 		if inarray({400, 401, 402, 403, 404, 405, 406 ,407}, PLAYERS[source].Equipment[7]) then message(source, "You may not attack on car or wing.") return 1 end 		if gettile(PLAYERS[id].x, PLAYERS[id].y).SAFE or gettile(PLAYERS[source].x, PLAYERS[source].y).SAFE then message(source, "You may not attack someone in a safezone.") return 1 end 		if not PLAYERS[id].Tutorial.hit then 			message(id, "A player is attacking you! You can fight back by swinging your weapon at him.", "255128000") 			PLAYERS[id].Tutorial.hit = true 		end 		local atk = PLAYERS[source].tmp.atk 		local def = PLAYERS[id].tmp.def 		if weapon == 251 then 			dmg = math.ceil(2500/math.random(80,120)) 			wpnName = 'rune' 		elseif weapon == 46 then 			dmg = math.ceil(500/math.random(80,120)) 			wpnName = 'firewave' 		else 			local dmgMul = ((PLAYERS[id].Level+50)*atk/def)/math.random(60,140) 			dmg = math.ceil(20*dmgMul) 			wpnName = PLAYERS[source].Equipment[3] and ITEMS[PLAYERS[source].Equipment[3]].name or 'dagger' 		end 		--print(player(source, "name") .. " deals " .. dmg .. " damage to " .. player(id, "name") .. ".") 	end 	local resultHP = HP-dmg 	if resultHP > 0 then 		sethealth(id,resultHP) 	else 		parse('customkill ' .. source .. ' "' .. wpnName .. '" ' .. id) 	end 	PLAYERS[id].HP = resultHP 	return 1 end addhook("kill","EXPkill") function EXPkill(killer,victim,weapon,x,y) 	if gettile(player(victim, "tilex"), player(victim, "tiley")).PVP then 		return 	end 	if not player(killer, 'exists') then return end 	if not PLAYERS[killer].Tutorial.kill then 		message(killer, "You have killed a player! This is allowed, but it may create conflict between players.", "255128000") 		PLAYERS[killer].Tutorial.kill = true 	end 	local exp = PLAYERS[victim].Level+10 	addexp(killer, math.floor(exp*math.random(50,150)/100*CONFIG.EXPRATE)) end
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
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
addhook("die","EXPdie") function EXPdie(victim,killer,weapon,x,y) 	local PVP = gettile(PLAYERS[victim].x, PLAYERS[victim].y).PVP 	if not PVP then 		if not PLAYERS[victim].Tutorial.die then 			message(victim, "You are dead. Try your best not to die, you'll drop some of your equipment and money if you do.", "255128000") 			PLAYERS[victim].Tutorial.die = true 		end 		local money = math.min(getmoney(victim), math.floor(PLAYERS[victim].Level*math.random(1,4)/10*CONFIG.PLAYERMONEYRATE)) 		if money ~= 0 then 			addmoney(victim, -money) 			spawnitem(1337, player(victim, "tilex"), player(victim, "tiley"), money) 		end 		if PLAYERS[victim].Level >= 5 then 			local previtems = {} 			for i, v in ipairs(CONFIG.SLOTS) do 				if PLAYERS[victim].Equipment[i] and math.random(10000) <= CONFIG.PLAYERDROPRATE then 					dropitem(victim, i, true) 				end 			end 		end 		PLAYERS[victim].HP, PLAYERS[victim].x, PLAYERS[victim].y = 85, nil, nil 	else 		PLAYERS[victim].HP, PLAYERS[victim].x, PLAYERS[victim].y = 5, nil, nil 		if addmoney(victim, -500) then 			spawnitem(1337, 122, 72, 500) 		end 	end 	local x = player(victim, 'x') 	local y = player(victim, 'y') 	local newitems, previtems = {}, {} 	for i, v in ipairs(CONFIG.SLOTS) do 		previtems[i] = PLAYERS[victim].Equipment[i] 		newitems[i] = 0 	end 	updateEQ(victim, newitems, previtems) 	radiussound("weapons/c4_explode.wav", x, y) end