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
function initArray2(f,v)
local cmd={}
for c=1,f do
cmd[c]=v
end
return cmd
end
machete=initArray2(32,0)
imagex=initArray2(256,0)
imagey=initArray2(256,0)
addhook("serveraction","throwmachete")
function throwmachete(id,a)
if (a==3) then
throwmachete(id)
end
end
function csconvert(rot,x,y,factor)
if rot<-90 then rot=rot+360 end
local angle=math.rad(math.abs(rot+90))-math.pi
local cx=x+(math.cos(angle)*factor)
local cy=y+(math.sin(angle)*factor)
return cx,cy
end
function dist(x1,y1,x2,y2)
return x1+x2,y1+y2
end
function throwmachete(id)
local cx,cy=csconvert(player(id,"rot"),player(id,"x"),player(id,"y"),128)
local dx,dy=dist(player(id,"x"),player(id,"y"),cx,cy)
local ox,oy=player(id,"x"),player(id,"y")
parse("strip "..id.." 69")
machete[id]=image("gfx/sprites/block.bmp",player(id,"x"),player(id,"y"),1)
tween_move(machete[id],(dx*0.25)+(dy*0.25),cx,cy,120)
msg(ox+cx)
msg(oy+cy)
msg(((dx*0.25)+(dy*0.25)))
factorx=((ox+cx)/((dx*0.25)+(dy*0.25)))
factory=((oy+cy)/((dx*0.25)+(dy*0.25)))
msg(factorx)
msg(factory)
thrower=id
imagex[machete[id]]=ox
imagey[machete[id]]=oy
timer(1,"parse","lua imagex["..machete[id].."]="..ox.."+"..factorx)
timer(1,"parse","lua imagey["..machete[id].."]="..oy.."+"..factory)
timer(2,"parse","lua imagex["..machete[id].."]="..imagex[machete[id]].."+"..factorx,((dx*0.5)+(dy*0.5)))
timer(2,"parse","lua imagey["..machete[id].."]="..imagey[machete[id]].."+"..factory,((dx*0.5)+(dy*0.5)))
for time=10,((dx*0.25)+(dy*0.25)),10 do
timer(time,"parse","lua machetehitplayers("..imagex[machete[id]]..","..imagey[machete[id]]..","..id..")")
end
end
addhook("ms100","checkifhit")
function checkifhit()
for id=1,32 do
if (machete[id]~=0) then
imagex[machete[id]]=imagex[machete[id]]+1
imagey[machete[id]]=imagey[machete[id]]+1
if (id~=thrower and player(id,"exists") and player(id,"x")>=imagex[machete[id]]-8 and player(id,"x")<=imagex[machete[id]]+8 and player(id,"y")>=imagey[machete[id]]-8 and player(id,"y")<=imagey[machete[id]]+8) then
parse("customkill "..thrower.." \"Thrown Machete\" "..id)
end
end
end
end
function machetehitplayers(x,y,o)
for id=1,#player(0,"table") do
if (id~=o and player(id,"exists") and player(id,"x")>=x-8 and player(id,"x")<=x+8 and player(id,"y")>=y-8 and player(id,"y")<=y+8) then
parse("customkill "..o.." \"Thrown Machete\" "..id)
end
end
end